OSL Ray Tracer shader

Here I have have for you my OSL ray tracer written just under 60 lines. It is capable of
tracing spheres which themselves can be shaded with osl.

It runs pretty fast as it’s quite simple but I plan on adding more features such as reflective materials and a ground plane.

1 Like

Nice work! Is there any chance of using ray marching on a 3d texture with this method? I have to somehow visualize a 3d dataset inside the blender viewport with a thresholded surface… I haven’t figured out a way to go from world to texspace coords when stepping through the volume though, not sure if it’s possible with OSL? (haven’t found a way to access the object transform and pass it to the shader)