I will try to write some brief summary.
In Luxcore first we add some volume definition:
Code: Select all
scene.volumes.fogVolume.type = "homogeneous"
scene.volumes.fogVolume.absorption = "0 0 0"
scene.volumes.fogVolume.scattering = "0.02 0.02 0.02"
scene.volumes.fogVolume.asymmetry = "0 0 0"
scene.volumes.fogVolume.multiscattering = 0
scene.volumes.fogVolume.priority = 0
scene.volumes.fogVolume.ior = "1"
Then we have to assign this volume to some objects in the scene. To find out where we have to assign this volume we have to understand the logic that is behind this. To create the volume effect the light ray that is travelling threw the scene has to be “tagged” with the volume.
Let’s assume that we are using path tracing. At first the ray starts from the camera. If the camera is inside the volume we assign the volume to the camera:
Then the ray hits some surface. In that case we have opportunity to assign or change the volume. If the camera is outside volume this is the first possibility to tag the ray with volume.
If we want to create more complex effect like a foggy day and some space that is filled with smoke we can tag the ray with different volume inside the space.
Code: Select all
scene.materials.smoke_box_material.volume.interior = "smokeVolume"
scene.materials.smoke_box_material.volume.exterior = "fogVolume"
The situation is more complex for BiDir. In this situation the ray may start from camera or light source. If the light ray starts from the light source and arrives to camera without hitting any object, it will not have any information about volume. So in that case we have to add information about volume to light source:
Code: Select all
scene.lights.lightName.volume = "envVolume"
or if we are using geometrical lights:
Code: Select all
scene.materials.emmitter_material.volume.interior = "fogVolume"
scene.materials.emmitter_material.volume.exterior = "fogVolume"
That is the theory.
From practical point of view if we want to create a fog effect in the scene (one type of fog for the entire scene) we have to follow those simple steps.
1. Create a box that will enclose the entire scene because we don’t want to have infinite volume. Then assign volume to that box:
Code: Select all
scene.materials.fogVolume_material.type = "null"
scene.materials.fogVolume_material.volume.interior = "fogVolume"
2. Now we have to understand if we have to assign volume to the camera. We assign volume to the camera ONLY if the camera is inside the volume.
Code: Select all
scene.camera.autovolume.enable = 0
scene.camera.volume = "fogVolume"
3. We assign volume to all light sources that are inside fog. Sun and environment are always outside volume so we do not change it.
Code: Select all
scene.lights.lightName.volume = "fogVolume"
or if we are using geometrical lights:
Code: Select all
scene.materials.emmitter_material.volume.interior = "fogVolume"
scene.materials.emmitter_material.volume.exterior = "fogVolume"
If I made any mistake, please correct.