File under: javascript, raymarcher, 3d, development, online

Javascript Ray Marcher v0.10

This version features diagnostic output. Throughout the project, I've been doing minor optimisations to keep the speed of a render below 20mins on my machine. In general, if the render took longer than that, I would get bored waiting and improve the code a little bit. But it has been increasingly hard to optimise the program, as I have removed all the obvious inefficiencies. Now I have added a diagnostic window to show me which parts of the render are taking the longest.

The left window is the render output, the middle window is the time taken to render each pixel. Red is too long, green is good. The third window is the "normal shading" window. We haven't seen normal shading since version 2. It's a very handy view to have, because it shows us the scene without lighting or shading. So if our lights are wrong and the render window output is too difficult to see, we can still check that our models are in the right place and working correctly.

Under the hood, there have been some large refactorings. The biggest being that all the config options and scene objects have been pulled into onto data structure. This provides a central point for debugging, and will soon allow us to save and reload scenes. It also provides a central point for debugging, as I don't have to hunt through the code for the place where I set a certain option.

I've added Javascript objects to hold the scene objects. Now all the properties for the objects are in the same place, and adding new ones is much easier. It also supports uses object polymorphism, so the render routine now simply calls object.in(x,y,z). If the answer is true, we have a hit and the renderer can then call object.colour().

It's actually much more complicated than that, we still have to handle reflections and transparencies, but that's the basic concept now.