How to render soft shadow from directional light back

Board: Home Board index Raytracing General Development

(L) [2014/10/24] [tby shiqiu1105] [How to render soft shadow from directional light] Wayback!

Hi,
My question is really simple.
In ray tracing, sun-like light source is directional, which results in perfectly hard shadows.
In nature, however, shadow of the sun usually is a little fuzzy too.
How to achieve that in ray tracing?
Thanks
(L) [2014/10/25] [tby AranHase] [How to render soft shadow from directional light] Wayback!

For point light the most straightforward way of producing soft shadows is to give an area to your light source, and take more than one sample for your shadow rays. This was initially proposed by Cook ([LINK http://en.wikipedia.org/wiki/Distributed_ray_tracing]).
For directional light, maybe use distance to the geometry? [LINK http://www.iquilezles.org/www/articles/rmshadows/rmshadows.htm]
(L) [2014/10/25] [tby ingenious] [How to render soft shadow from directional light] Wayback!

It's pretty easy. Instead of shooting shadow rays in a single direction, you can generate their directions uniformly in a small cone around this direction.
(L) [2014/10/25] [tby shiqiu1105] [How to render soft shadow from directional light] Wayback!

>> ingenious wrote:It's pretty easy. Instead of shooting shadow rays in a single direction, you can generate their directions uniformly in a small cone around this direction.
Sounds like a good solution! Thanks!
Also, an additional question is that, how to render reflected specular high light from delta light sources like directional lights or point lights?
(L) [2014/10/25] [tby papaboo] [How to render soft shadow from directional light] Wayback!

>> how to render reflected specular high light from delta light sources like directional lights or point lights
Please don't go there. [SMILEY :)] A point light has zero radius and cannot be sampled from a specular surface. The probability of a specular ray hitting the exact point at which your pointlight lies is 0.
You can hack it by evaluating the specular surface as a slightly glossy surface when sampling light sources directly, but it will look weird in some cases, fx when the point light is really close to the surface, you'll see a large'ish highlight from a light source that you can't actually see. I've done this before and it works, but it also means that you have to tweak your material to every new lighting scenario, since you're hacking the material to simulate something in the scene that doesn't really exist.
Instead just save yourself the hacks and implement proper area lights from the start. You can look at pbrt and Mitsuba's light sources for inspiration. Then you also have a solution that should produce consistent renderings across integrators. Personally I'm very happy with this property in my current renderer, since we use that property for verifying just about everything that we do. [SMILEY :)]

back