4 ms·
I agree it's a great exercise. Years ago I added a very simple stack-based VM to my raytracer to allow procedural textures & normal maps. The scene script would
by gattr 8y ago
I agree it's a great exercise. Years ago I added a very simple stack-based VM to my raytracer to allow procedural textures & normal maps. The scene script would e.g. contain a material description like this:
material {
diffuse rgb = [0, 0, 1] * (1-(0.5+0.5*noise(x*0.000002, y*0.000002, z*0.000002, 0.66, 2))) + [1, 1, 1] * (0.5+0.5*noise(x*0.000002, y*0.000002, z*0.000002, 0.66, 2));
}
i.e. an expression with 3-vectors and scalars and a few basic functions (noise, sin/cos, etc.). This can be easily "compiled" (during script parsing) for execution on the VM. Then the overhead during actual raytracing was quite small.
- all2 8y agoI don't suppose you have code or examples lying around? I'd love to see what you were trying to achieve, the results you had, and the code. If you're comfortable sharing, that is.
- gattr 8y agoI still have the code (old and ugly, so not on GitHub; but it still builds and works) and examples. Let me know where I should send it.
- delinka 8y agoCould I trouble you to share the code with me as well? Email in profile about box. Thanks!