jeremyBanks / ray-tracer

I am learning how to make a simple ray tracer.
https://rays.jeremy.ca/
MIT License
0 stars 0 forks source link

Some ray hit optimization #11

Closed jeremyBanks closed 7 years ago

jeremyBanks commented 7 years ago

Now that I've added a couple dozen objects to the scene, things are getting pretty slow.

I need to do a first-pass that at least sorts candidate objects by distance and uses their bounding radii to know when to stop checking.

jeremyBanks commented 7 years ago

The approach I was thinking off doesn't actually work in most of these scenes because the rays often do go off into infinity, and I need to check every object in those cases.

I think another common easy check is whether the objects are in front of the ray. Could probably combine this with the T expanding outwards to search the light cone effectively. Might need to do some micro-optimization around that to keep it affordable.

jeremyBanks commented 7 years ago

we should be able to get at least 25x here