Volumetric Gradient index rendering

Discussion related to the LuxCore functionality, implementations and API.
Post Reply
Pau1
Posts: 2
Joined: Fri Mar 11, 2022 6:27 pm

Volumetric Gradient index rendering

Post 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.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Volumetric Gradient index rendering

Post 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.
Support LuxCoreRender project with salts and bounties
Pau1
Posts: 2
Joined: Fri Mar 11, 2022 6:27 pm

Re: Volumetric Gradient index rendering

Post 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?
Post Reply