Page 1 of 6

OpenVDB support

Posted: Fri Apr 06, 2018 4:58 pm
by Dade
The very first rendering of an OpenVDB volume (http://www.openvdb.org/download/):
bunny.jpg

Re: OpenVDB support

Posted: Fri Apr 06, 2018 5:33 pm
by Sharlybg
:shock: We are going in Very professional area ! be sure that we will abuse of the engine if you continue like that don't complaint anymore after :lol:

Re: OpenVDB support

Posted: Fri Apr 06, 2018 6:27 pm
by neo2068
Really cool! :D

Re: OpenVDB support

Posted: Fri Apr 06, 2018 9:59 pm
by kintuX
Oh, yes... :D
impatiently waiting as was just playing with multiscattered banded Blender Marble inside the Cube (Heterogeneous Volume) on Tiled PT - Works really well. Next, clouds in a Box 8-)
Thank you, thank you very much...
Gaser_004cubePTms.jpg
Do you think that one day will be able to render iridescence in volumes?

Re: OpenVDB support

Posted: Fri Apr 06, 2018 10:20 pm
by Dade
kintuX wrote: Fri Apr 06, 2018 9:59 pm Do you think that one day will be able to render iridescence in volumes?
It is but there are so many aspects to work on that sometime it is just hard to keep track of all of them and prioritize what to work on next.

Re: OpenVDB support

Posted: Sat Apr 07, 2018 1:51 pm
by Dade
I updated the linux procedure to compile with OpenVDB support and it should now work out of the box, just switch to the "openvdb" branch in LuxCore, LinuxCompile and LinuxCompileDeps repositories.

@B.Y.O.B., I tried the .vdb, exported from Blender, you posted some time ago and they seems to work but we need to do some test about the volume transformation. I'm currently ignoring the transformation stored inside .vdb file and remapping the volume in [0, 1] coordinates. This should be what you expect (i.e. it works like densitygrid texture .data field) but we need to try.

This is the new syntax:

Code: Select all

scene.textures.tex.type = densitygrid
scene.textures.tex.nx = 256
scene.textures.tex.ny = 256
scene.textures.tex.nz = 256
scene.textures.tex.wrap = black
scene.textures.tex.openvdb.file = scenes/media/blender-blosc.vdb
scene.textures.tex.openvdb.grid = density
scene.textures.tex.mapping.type = globalmapping3d
scene.textures.tex.mapping.transformation = 1. 0 0 0  0 0 -1. 0  0 .8 0 0  0.5 0.5 0.5 1
where ".data" field can be replaced by ".openvdb.file" and ".openvdb.grid" properties. The ".openvdb.grid" is the name of the grid (i.e. data channel) to read from the file. If you need to check what names are used in a .vdb, just check the log:

Code: Select all

[SDL][0.005] Texture definition: tex
[SDL][0.005] OpenVDB file: scenes/media/blender-blosc.vdb
[SDL][0.012] OpenVDB grid names:
[SDL][0.012]   [density]
[SDL][0.012]   [obstacles]
[SDL][0.012]   [shadow]
[SDL][0.012]   [velocity]
[SDL][0.025] OpenVDB grid bbox: [(26, 13, 27), (184, 119, 171)]
[SDL][0.025] OpenVDB grid size: (158, 106, 144)
[SDL][0.910] Define ImageMap: LUXCORE_DENSITYGRID_tex

Re: OpenVDB support

Posted: Mon Apr 09, 2018 4:54 pm
by Dade
I have now both the Linux and Windows versions working with OpenVDB ... the porting to Windows was the usual horrible pain but it is done. Tomorrow, I will merge all the openvdb branches with the main so it will be in the next beta release.

Re: OpenVDB support

Posted: Mon Apr 09, 2018 5:03 pm
by Sharlybg
Dade wrote: Mon Apr 09, 2018 4:54 pm I have now both the Linux and Windows versions working with OpenVDB ... the porting to Windows was the usual horrible pain but it is done. Tomorrow, I will merge all the openvdb branches with the main so it will be in the next beta release.
Why there is so much difficulties in working with Microsoft software (a company with trillion dollars) ?

Thanks You for This advance !

Re: OpenVDB support

Posted: Mon Apr 09, 2018 5:31 pm
by Dade
Sharlybg wrote: Mon Apr 09, 2018 5:03 pm
Dade wrote: Mon Apr 09, 2018 4:54 pm I have now both the Linux and Windows versions working with OpenVDB ... the porting to Windows was the usual horrible pain but it is done. Tomorrow, I will merge all the openvdb branches with the main so it will be in the next beta release.
Why there is so much difficulties in working with Microsoft software (a company with trillion dollars) ?
Not to defend MS but, this time, we had to use OpenVDB v3.1 (when the latest version is v5.0 !) because is the version used by Blender and the latest to not require C++11 support (MS fault is here).

Re: OpenVDB support

Posted: Mon Apr 09, 2018 9:29 pm
by B.Y.O.B.
I have started to work on support in BlendLuxCore however apparently it is non-trivial to find out the path of the cache files...
I can't find the relevant Python attribute in Blender or in the documentation. Have to look further.

Of course the current code already works with OpenVDB (the grid attributes in Blender hide the underlying caching mechanism), but it kinda defeats the point of having OpenVDB support in LuxCore.

By the way can we accelerate the export of the normal point cache with C++?
Have to investigate. I think we would need a C++ function "DefineDensityGridData()" (like DefineMesh etc.) because the main bottleneck seems to be that we currently pass a HUGE array to a property.