World's most popular travel blog for travel bloggers.

[Solved]: Why there is light source?

, , No Comments
Problem Detail: 

In ray tracing if we are tracing a ray from camera to the object, then why there is need for light source as in this image and also rays are going towards the light source instead of outgoing from the light source?

Ray Tracing
Recursive ray tracing associates an entire tree of rays with each image location.
Image from: Physically Based Rendering: From Theory to Implementation by Matt Pharr, ‎Greg Humphreys, 2010

Asked By : Mr.Grey

Answered By : Pseudonym

There are two questions that you're asking here.

The first is why there is a light source. That's the easy part. Think what happens in the real world: if there's no light source, everything is dark and you can't see anything. That's an uninteresting case in computer graphics, so we usually don't consider it.

The second question is why rays are pointing to the light source instead of away from it. Physically, photons are emitted by light sources, and scatter around the physical environment, before hitting the imaging device (e.g. eye, camera).

It's possible to produce an image this way, like this for example:

Photon Soup

Richard Keene produced this image in 1991. It was produced by tracing almost 30 billion photons from the light sources, which scattered around the scene until they hit the virtual camera lens. This took a month of compute time on 100 SPARCstations, each with 10MHz CPUs, and it's still quite noisy.

Keene repeated the experiment in 2004, this time using volunteers around the Internet donating computer time. I can't recall how long this one took, but 382 billion photons were traced in total:

Photon Soup 2

The important thing here is that this technique is highly impractical. If you need to render an 85 minute movie at 24 frames per second, and allow a year of compute time, this turns out to be less than 5 minutes per frame. Clearly you can't spend 100 CPU-months on each image.

The problem is that if you trace photons from light sources, most photons don't hit the camera lens most of the time. If you continue scattering until they do hit the camera lens, they're usually so attenuated by that point that they contribute very little to the final image.

Ray tracing fixes this problem by tracing from the camera lens instead. Mathematically, a ray is the adjoint of a photon. This ensures that every trace contributes to the final image. However, you do then have the opposite problem. If you trace a photon from a light source, there's no guarantee that it will end up in the camera lens, but if you trace a ray from the camera, there's no guarantee that it will end up at a light source.

For this reason, most modern rendering algorithms (well, the ones that attempt to solve Kajiya's rendering equation) actually work in both directions. Photon mapping, bidirectional path tracing, and the Metropolis light transport algorithm (to pick but three) use information both from the camera and the light sources to try to spend most of the computer time on light paths which contribute to the final image.

If you're reading the book that I think you're reading, you'll get to all this in time.

EDIT Richard Keene himself chimed in, but unfortunately doesn't have enough rep yet to post comments on questions. So here's the link to his Photon Soup paper.

Richard, welcome to cs.se!

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/40130

3.2K people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback