Page 1 of 1

Volumetric Gradient index rendering

Posted: Sat Mar 12, 2022 3:20 pm
by Pau1
Hello everybody,

I would like to trace rays through gradient index media, which rather bend the rays then refract them. I already wrote a small program which is fast enough and is embedded in a ray-tracer which works on basis of meshes. The general principle is, that the volume is connected to a surface and as soon as a ray hits this surface the subsequent calculation is performed step-wise through the volume, with fixed intervals, until the end of it is reached where it switches back again to surface based ray-tracing. With a sufficiently small step-size this approach turned out to be still reasonably fast.

Now I was wondering if it would be somehow possible to define such a functionality into LuxCore. I don't know if such a functionality would ever be useful for a broad range of people. Not being able to detect collisions inside the volume limits adds some complexity on how to define the scene. I would be very happy if somebody could give me either some help or show me where i would have to implement such functionality.

Re: Volumetric Gradient index rendering

Posted: Sat Mar 12, 2022 4:26 pm
by Dade
Pau1 wrote: Sat Mar 12, 2022 3:20 pm I would like to trace rays through gradient index media, which rather bend the rays then refract them. I already wrote a small program which is fast enough and is embedded in a ray-tracer which works on basis of meshes. The general principle is, that the volume is connected to a surface and as soon as a ray hits this surface the subsequent calculation is performed step-wise through the volume, with fixed intervals, until the end of it is reached where it switches back again to surface based ray-tracing. With a sufficiently small step-size this approach turned out to be still reasonably fast.
This is the exact definition of heterogeneous volume in LuxCore (aka ray marching). It is exactly how it works. You may have to define a new scattering function but it is all you are likely to have to do.

Re: Volumetric Gradient index rendering

Posted: Mon Mar 14, 2022 8:57 am
by Pau1
Now I feel a bit bad for not knowing, but yes it totally makes sense that this works the same way. That are really great news for me.

I have to say, I never worked with the source of LuxCore until now. Could you point me to some files at the repository which I can read as a start to understand how heterogeneous volumes are implement and how to define a new scattering function?