ray-tracer icon indicating copy to clipboard operation
ray-tracer copied to clipboard

Shadows!

Open w23 opened this issue 7 years ago • 2 comments

w23 avatar Jul 31 '18 16:07 w23

@w23 do shadows require anything special to implement? I thought they gonna naturally emerge from the ray tracing itself. Like if a ray never hits an area it's just black. Please correct me if I'm wrong.

rexim avatar Jul 31 '18 19:07 rexim

They kind of appear naturally in path-tracing. For other methods, however, where you're stuck with enumerating all light sources to account for each light influence, you do need to check that the light is not obstructed. That usually involves casting a ray into each light's direction and checking whether it has hit anything opaque or not. As it is basically a boolean yes/no check, this will give you hard shadows. There are various ways to approximate soft shadows, but that will come later.

w23 avatar Aug 01 '18 10:08 w23