OpenVDB instancing

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Post Reply
bartek_zgo
Posts: 117
Joined: Mon Oct 26, 2020 11:42 am

OpenVDB instancing

Post by bartek_zgo »

Hi Guys,
I want to ask if there is some way to create more instances of the same VDB volume in an efficient way.
I have following volume definition:

Code: Select all

scene.textures.VDB_density_texture.type = "densitygrid"
scene.textures.VDB_density_texture.nx = 295
scene.textures.VDB_density_texture.ny = 519
scene.textures.VDB_density_texture.nz = 159
scene.textures.VDB_density_texture.wrap = "black"
scene.textures.VDB_density_texture.openvdb.file = "cloud_10_variant_0000.vdb"
scene.textures.VDB_density_texture.openvdb.grid = "density"
scene.textures.VDB_density_texture.storage = "float"
scene.textures.VDB_density_texture.mapping.type = "globalmapping3d"
scene.textures.VDB_density_texture.mapping.transformation = 0.3389831 -0 0 -0 -0 0.1926782 -0 0 0 -0 0.6289309 -0 0.7030222 0.61531 0.7009416 1
scene.textures.VDB_density_texture_scale.type = "scale"
scene.textures.VDB_density_texture_scale.texture1 = "10000"
scene.textures.VDB_density_texture_scale.texture2 = "VDB_density_texture"
scene.volumes.VDB_volume.type = "heterogeneous"
scene.volumes.VDB_volume.absorption = "0 0 0"
scene.volumes.VDB_volume.scattering = "VDB_density_texture_scale"
scene.volumes.VDB_volume.asymmetry = "0 0 0"
scene.volumes.VDB_volume.multiscattering = 0
scene.volumes.VDB_volume.steps.size = 0.1
scene.volumes.VDB_volume.steps.maxcount = 1024
scene.volumes.VDB_volume.priority = 0
scene.volumes.VDB_volume.ior = "1"
scene.volumes.VDB_volume.id = 1,945,206
scene.volumes.VDB_volume.photongi.enable = 0
scene.materials.VDB_volume_material.type = "null"
scene.materials.VDB_volume_material.transparency.shadow = 0 0 0
scene.materials.VDB_volume_material.id = 5,251,573
scene.materials.VDB_volume_material.bumpsamplingdistance = 0.001
scene.materials.VDB_volume_material.volume.interior = "VDB_volume"
scene.materials.VDB_volume_material.visibility.indirect.diffuse.enable = 1
scene.materials.VDB_volume_material.visibility.indirect.glossy.enable = 1
scene.materials.VDB_volume_material.visibility.indirect.specular.enable = 1
scene.materials.VDB_volume_material.shadowcatcher.enable = 0
scene.materials.VDB_volume_material.shadowcatcher.onlyinfinitelights = 0
scene.materials.VDB_volume_material.photongi.enable = 1
scene.materials.VDB_volume_material.holdout.enable = 0
scene.objects.VDB_box.material = "VDB_volume_material"
scene.objects.VDB_box.ply = "mesh-00000.ply"
scene.objects.VDB_box.camerainvisible = 0
scene.objects.VDB_box.id = 1,326,487,202
scene.objects.VDB_box.appliedtransformation = 1 0 0 0 0 1 0 0 0 0 1 0 -0.4625384 -0.6505328 -1.751076 1
When I want to move or scale my volume I have to modify 2 transformations. One is
scene.textures.VDB_density_texture.mapping.transformation
and the second is
scene.objects.VDB_box.appliedtransformation

The scene.objects.VDB_box.appliedtransformation is a box that will contain the VDB volume. If it is smaller it will crop the volume. If it is bigger it may have some side effects, but actually the size and location of this box does not change where the volume is located in the render.

The scene.textures.VDB_density_texture.mapping.transformation is the matrix where the volume is translated scaled etc.

So if I create new scene.object that will reference the same material I have no way to move or scale the volume, because the real move/scale transformation is applied to VDB_density_texture. So the only option I see hear is to create another material and another VDB_density_texture.

Is it correct approach?
If it is correct I'm afraid about performance. If I'm correct, luxcore will read vdb file twice. It will take a lot of time and memory.

And second question. I have seen that if I redefine VDB_density_texture during live session, because I want to move the volume, Luxcore reads VDB file again, so simple translation is time consuming task.
Post Reply