Page 7 of 7

Re: Volumetrics issues

Posted: Fri Oct 15, 2021 7:31 pm
by daros
Thanks dade, Monday we are going to implement your advice. Thanks for your patience.
View 01 1600x800_1.jpg

Re: Volumetrics issues

Posted: Sat Oct 16, 2021 3:58 pm
by B.Y.O.B.
Maybe we could use an in-depth, technical guide to volume setup to help users of the LuxCore API understand the system better? (Of course, the question is who has time to write it)

Re: Volumetrics issues

Posted: Sun Oct 17, 2021 8:55 am
by daros
I think that my programmer, Bartosz, which now knows very well how the volumes work in Luxcore could do it. It should not take him more as 20 minutes to write down the rules. I will ask him monday.

Re: Volumetrics issues

Posted: Thu Oct 21, 2021 5:05 pm
by Taka
daros wrote: Sun Oct 17, 2021 8:55 am I think that my programmer, Bartosz, which now knows very well how the volumes work in Luxcore could do it. It should not take him more as 20 minutes to write down the rules. I will ask him monday.
That'd be really helpful!

Re: Volumetrics issues

Posted: Sat Oct 23, 2021 4:33 pm
by DionXein
daros wrote: Sun Oct 17, 2021 8:55 am I think that my programmer, Bartosz, which now knows very well how the volumes work in Luxcore could do it. It should not take him more as 20 minutes to write down the rules. I will ask him monday.
Cool, can you post link here, then it will be ready?

Re: Volumetrics issues

Posted: Sat Oct 23, 2021 7:20 pm
by daros
we completed the implementation of dade's latest instructions yesterday and yes it seems to work well. This monday bartek will write down a few lines about how the volumes have to be set accordingly to different situations.

Re: Volumetrics issues

Posted: Fri Nov 05, 2021 1:50 pm
by bartek_zgo
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:

Code: Select all

scene.camera.volume = "fogVolume"
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.

Re: Volumetrics issues

Posted: Tue Nov 09, 2021 3:14 pm
by B.Y.O.B.
Thanks for this summary, it will definitely be useful for others.