Yes, the box is defined in the shader:
// http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
float udBox( vec3 p, vec3 b )
{
return length(max(abs(p)-b,0.0));
}
Unfortunately, I have no idea of how to do that stuff with arbitrary geometries.
The only way I can imagine is that you can model complex solids by combining the primitives described with the distance functions. But the more complex the model, the more complex shaders you get ![]()
Just have a look at the source code of the raymarching shader, there you can find all the functions for primitives:
Very cool idea! ![]()