Skip to content

Picking directions on the upper hemisphere #155

@vchizhov

Description

@vchizhov

This is more of a suggestion that should provide a better intuition for people learning ray tracing for the first time. As I see it, currently it is not quite clear why the scattering directions need to be picked on a unit sphere offset along the normal (even though that provides a cosine weighted hemisphere distribution) - the geometric and algebraic derivations are both non-trivial, and possibly non-intuitive (this is clearly illustrated by the fact that picking directions inside the ball yields a cos^3 distribution, while picking points on the sphere yields the desired cos distribution).
My suggestion is to directly generate points in or on the upper hemisphere, which is a lot more intuitive and can be directly related to the rendering equation and light scattering (even informally). This can be done without inverse transform sampling - by generating point in the unit ball (or on the unit sphere) as was already done, and reflecting all vectors in the lower hemisphere to be in the upper hemisphere, with respect to the normal (requires a dot check per vector). Note that this will induce a uniform distribution (so higher variance, and a normalization factor of 2pi and not pi), and will require a cos(theta) multiplication in the recursion (which will be a good point to introduce Lambert's law which will help motivate the name of the material too).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions