Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Beautiful!

Fwiw, you can optimize your height map / grid traversal [1] quite a bit. There don’t need to be any ceil/floor calls within the inner loop if you do a “3D DDA” iteration (like Bresenham’s for lines but in 3D).

We used to have good slides on this from Steve Parker’s CS 6620 at Utah, but modern versions of the class seem to use OptiX instead. Some folks put their code up online, so if you search for CS 6620 and height map or terrain you might find it. Useful for volume rendering too!

[1] https://github.com/tylermorganwall/rayshader/blob/master/src...



Great idea! The mesh it iterates over is inherently 2D (the surface intersection test just performs a bilinear interpolation between the grid points to compare to the ray height) so Bresenham's algorithm would work here. I'll implement it and see if it offers any significant speed improvements.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: