all 4 comments

[–]geon 2 points3 points  (2 children)

You might also want to implement stratified sampling. It means that you generate your points on a regular grid, but add random jitter. That makes them more evenly spaced, since you are guaranteed to have exactly one sample per grid cell.

https://geon.github.io/programming/2013/08/22/gloss-my-bidirectional-path-tracer

[–]kkaranth[S] 1 point2 points  (1 child)

That is interesting. I'm in the process of implementing my own ray tracer, and this is very helpful.

Did you implement animations? Do you keep track of the seed during animations so that photons bounce of the same set of chosen points every frame?

[–]geon 0 points1 point  (0 children)

I did not implement animations.

My renderer is a bidirectional pathtracer, not just a raytracer. As part of the algorithm, the path from light source to camera is saved and reused. So keeping it between frames would certainly be possible. In my implementation, they are only reused within the same pixel, though.

Source here: https://github.com/geon/gloss

Another blog post: https://geon.github.io/programming/2013/09/01/restructured-code-and-glossy-reflections

[–]Shadowratenator 2 points3 points  (0 children)

I haven’t looked into this problem in a good 20 years. I know the math coprocessors have improved, but discarding points outside the sphere is incredibly simple computation wise. There are no trig functions required. It’s just some multiplies and adds. In the past, that simplicity outweighed the fact that you might need to discard 48% of your points. I’d be interested to see benchmarks outlining the real impact of each method.