r/VolumeRendering • u/draemmli • Nov 22 '17
Project I wrote a single-threaded CPU volume ray casting engine in vanilla JavaScript. It runs at 60fps on my five year old notebook. (x-post /r/GraphicsProgramming)
https://draemm.li/various/volumeRendering/cpu/
2
Upvotes
1
u/draemmli Nov 22 '17
Original thread
Source code on GitHub
Some of the various optimisations I used to speed things up:
squared[]array, which, for everyi, containsMath.pow(i/256, 2).~~floatis a lot faster thanMath.floor(float)for some reason.requestAnimationFrameinstead ofsetTimeoutorsetInterval. Not only is it smoother and smarter, it's also a lot more performant.