read_bif_particles to openvdb correct workflow?

read_bif_particles to openvdb correct workflow?

a.mayaUser
Enthusiast Enthusiast
2,400 Views
13 Replies
Message 1 of 14

read_bif_particles to openvdb correct workflow?

a.mayaUser
Enthusiast
Enthusiast

Hi guys,

I'm trying to convert a bif sequence to openvdb volume sequence, is there any specific workflow to do that?

 

Because it's not exporting the same as when I export openvdbs directly from a bifrost graph simulation, I tried to convert the read_bif_particles point with different nodes, like points_to_volume, convert_to_volume, points_to_level_set etc and different combinations of file_cache and write nodes.

Everything works in the viewport and with the diagnostic nodes like the scopes, but the resulting exported files works only if I use the read nodes from bifrost, they do not work in Houdini, Blender or other openvdb readers.

 

Any ideas why?

0 Likes
Accepted solutions (1)
2,401 Views
13 Replies
Replies (13)
Message 2 of 14

morten.bojsen-hansen
Autodesk
Autodesk

Can you attach an example of one of the files you have exported? And perhaps a scene file? Then I can have a look.

Message 3 of 14

a.mayaUser
Enthusiast
Enthusiast

Thanks @morten.bojsen-hansen

here's an example I just re-created, since the original scene had hundreds gigs of cache, but it works exactly the same.

 

This scene includes the bifrost graph and the .bif sequence to convert. It only needs a different path in the file_cache according to your system, and to set the node mode to write to generate a new .vdb cache.

Message 4 of 14

morten.bojsen-hansen
Autodesk
Autodesk

@a.mayaUser, It seems like there are some properties on the points that end up filling all of space when they get voxelized, which messes up in other DCCs when you try to load the VDBs there. Can you try to only write out voxel_fog_density by setting the properties input on file_cache to voxel_fog_density? If I do that, the VDBs load fine in other DCCs for me.

0 Likes
Message 5 of 14

a.mayaUser
Enthusiast
Enthusiast

Yes, this is working indeed!

Just another quick question: how can I pass also the voxel_velocity along the voxel_fog_density to get the motion blur working?

 

Thanks @morten.bojsen-hansen 

0 Likes
Message 6 of 14

morten.bojsen-hansen
Autodesk
Autodesk

@a.mayaUser, I would think so. Just set the properties input to "voxel_fog_density voxel_velocity".

0 Likes
Message 7 of 14

a.mayaUser
Enthusiast
Enthusiast

Okay, so I just tested out and I guess there is something strange happening with the velocity here.

 

If I use the voxel_velocity property I can already see from the watchpoint that it's not passing through, it needs to be called point_velocity, but then the other problem comes back again, and the resulting cache looks like the full space is getting voxelized, and the grid is messed up like before.

 

Doesn't look like a correct behavior to me, anything else I can try?

0 Likes
Message 8 of 14

morten.bojsen-hansen
Autodesk
Autodesk

@a.mayaUser Are you using an older version of Bifrost by any chance? We fixed something like this (regarding velocity) in Bifrost 2.3 with BIFROST-5506.

0 Likes
Message 9 of 14

a.mayaUser
Enthusiast
Enthusiast

@morten.bojsen-hansen 

Yes, I'm already on bifrost 2.3.0.0 and Maya 2022.1

 

here's a couple more info:

 

- if you try to read back the vdb cache and feed it to the volume_scopes it shows a MASSIVE difference in the size of display_tile_grid and levels, the size is huge and don't match with the original non cached data.

 

Here's two images showing the volume_scope output with same settings, from the cached files and the direct output from the points_to_volume, the camera is at the same distance: this is how big the grid is at level 4 compared to the original one at same level (yes, the tiny grid cube in the second image is the correct size)

readnode.PNGnoncachednode.PNG

 

- the render engine confirms the problem through the feedback window with this error: The velocity grid is not of the expected float type

 

- also, I tried to use the write_openvdb_volume instead of file_cache but, no matter what, I'm getting this error No promotion exist from a value of type 'Amino::Object' to a value of type 'Array<Amino::Object>' and it's not working.

 

Hope it helps

0 Likes
Message 10 of 14

morten.bojsen-hansen
Autodesk
Autodesk
Accepted solution

Unfortunately, writing to and reading from VDBs is not a lossless operation since Bifrost volumes are adaptive and don't line up exactly with (sparse) OpenVDB grids, so you should expect some differences. In any case, I think what is happening here is that when you splat the velocity from the points onto the Bifrost grid it gets extended to the entire volume which is very very large. We have already been discussing a different approach to this internally, and I'll remember to consider your case when we tackle this issue. In the meantime you'll have to use a workaround. I think what would work is to zero out the velocity where there is no smoke before writing the VDB file in Bifrost. You can do this with the following compound (copy paste into your Bifrost editor):

<sub_root>
    <nodes>
        <compound>
            <vnnCompound name="zero_velocity_outside_fog" type="AminoVnn_Compound" flag="2048">
    <metadatas>
    <metadata name="ViewportRect">
        <value>-2401.88 -1177.36 5731.05 3296.73</value>
    </metadata>
</metadatas>
    <node_metadatas>
        <metadatas>
    <metadata name="LayoutPos">
        <value>1435.3 691.4</value>
    </metadata>
    <metadata name="DisplayMode">
        <value>2</value>
    </metadata>
</metadatas>
    </node_metadatas>
    <ports>
        <port name="volume" type="Amino::Object" flag="0" is_input="yes" default_external_values="">
            <metadatas>
                <metadata name="feedbackPort" value=""/>
            </metadatas>
        </port>
        <port name="out_volume" type="Amino::Object" flag="0" is_input="no">
            <metadatas>
                <metadata name="feedbackPort" value=""/>
            </metadatas>
        </port>
    </ports>
    <child_graph>
        <sub_root>
    <nodes>
        <node>
            <vnnNode name="equal" type="BifrostGraph,Core::Logic,equal" flag="0">
    <metadatas>
    <metadata name="DisplayMode">
        <value>2</value>
    </metadata>
    <metadata name="LayoutPos">
        <value>1393.5 710</value>
    </metadata>
</metadatas>
    <ports>
        <port name="first" type="array&lt;float&gt;" flag="4096" is_input="yes"/>
        <port name="second" type="float" flag="4096" is_input="yes"/>
        <port name="output" type="bool" flag="0" is_input="no"/>
    </ports>
</vnnNode>
        </node>
        <node>
            <vnnNode name="get_geo_property" type="BifrostGraph,Geometry::Properties,get_geo_property" flag="0">
    <metadatas>
    <metadata name="DisplayMode">
        <value>2</value>
    </metadata>
    <metadata name="LayoutPos">
        <value>1085.46 531.864</value>
    </metadata>
</metadatas>
    <ports>
        <port name="geometry" type="Amino::Object" flag="0" is_input="yes"/>
        <port name="property" type="string" flag="0" is_input="yes" default_values="voxel_velocity"/>
        <port name="type" type="array&lt;Math::float3&gt;" flag="4096" is_input="yes" default_values="">
            <metadatas>
                <metadata name="TypeWranglingSuggestedTypes" value="array&lt;float&gt;, array&lt;long&gt;, array&lt;uint&gt;, array&lt;bool&gt;, array&lt;string&gt;, array&lt;Math::float2&gt;, array&lt;Math::float3&gt;, array&lt;Math::float4&gt;, array&lt;Math::float3x3&gt;, array&lt;Math::float4x4&gt;"/>
            </metadatas>
        </port>
        <port name="data" type="array&lt;Math::float3&gt;" flag="4096" is_input="no"/>
        <port name="default" type="Math::float3" flag="4096" is_input="no"/>
        <port name="target" type="string" flag="4096" is_input="no"/>
    </ports>
</vnnNode>
        </node>
        <node>
            <vnnNode name="get_geo_property1" type="BifrostGraph,Geometry::Properties,get_geo_property" flag="0">
    <metadatas>
    <metadata name="DisplayMode">
        <value>2</value>
    </metadata>
    <metadata name="LayoutPos">
        <value>1099.5 878</value>
    </metadata>
</metadatas>
    <ports>
        <port name="geometry" type="Amino::Object" flag="0" is_input="yes"/>
        <port name="property" type="string" flag="0" is_input="yes" default_values="voxel_fog_density"/>
        <port name="type" type="array&lt;float&gt;" flag="4096" is_input="yes" default_values="">
            <metadatas>
                <metadata name="TypeWranglingSuggestedTypes" value="array&lt;float&gt;, array&lt;long&gt;, array&lt;uint&gt;, array&lt;bool&gt;, array&lt;string&gt;, array&lt;Math::float2&gt;, array&lt;Math::float3&gt;, array&lt;Math::float4&gt;, array&lt;Math::float3x3&gt;, array&lt;Math::float4x4&gt;"/>
            </metadatas>
        </port>
        <port name="data" type="array&lt;float&gt;" flag="4096" is_input="no"/>
        <port name="default" type="float" flag="4096" is_input="no"/>
        <port name="target" type="string" flag="4096" is_input="no"/>
    </ports>
</vnnNode>
        </node>
        <node>
            <vnnNode name="if" type="BifrostGraph,Core::Logic,if" flag="0">
    <metadatas>
    <metadata name="DisplayMode">
        <value>2</value>
    </metadata>
    <metadata name="LayoutPos">
        <value>1655.5 547</value>
    </metadata>
</metadatas>
    <ports>
        <port name="condition" type="bool" flag="0" is_input="yes"/>
        <port name="true_case" type="Math::float3" flag="4096" is_input="yes"/>
        <port name="false_case" type="array&lt;Math::float3&gt;" flag="4096" is_input="yes"/>
        <port name="output" type="array&lt;Math::float3&gt;" flag="4096" is_input="no"/>
    </ports>
</vnnNode>
        </node>
        <node>
            <vnnNode name="set_geo_property" type="BifrostGraph,Geometry::Properties,set_geo_property" flag="0">
    <metadatas>
    <metadata name="DisplayMode">
        <value>2</value>
    </metadata>
    <metadata name="LayoutPos">
        <value>1911.5 784</value>
    </metadata>
</metadatas>
    <ports>
        <port name="geometry" type="Amino::Object" flag="0" is_input="yes"/>
        <port name="property" type="string" flag="0" is_input="yes" default_values="voxel_velocity"/>
        <port name="default" type="Math::float3" flag="4096" is_input="yes" default_values="0;0;0">
            <metadatas>
                <metadata name="TypeWranglingSuggestedTypes" value="float, long, uint, bool, string, Math::float2, Math::float3, Math::float4, Math::float3x3, Math::float4x4"/>
            </metadatas>
        </port>
        <port name="data" type="array&lt;Math::float3&gt;" flag="4096" is_input="yes" default_values="">
            <metadatas>
                <metadata name="TypeWranglingSuggestedTypes" value="float, long, uint, bool, string, Math::float2, Math::float3, Math::float4, Math::float3x3, Math::float4x4, array&lt;float&gt;, array&lt;long&gt;, array&lt;uint&gt;, array&lt;bool&gt;, array&lt;string&gt;, array&lt;Math::float2&gt;, array&lt;Math::float3&gt;, array&lt;Math::float4&gt;, array&lt;Math::float3x3&gt;, array&lt;Math::float4x4&gt;"/>
            </metadatas>
        </port>
        <port name="target" type="string" flag="0" is_input="yes" default_values="voxel_tile_tree"/>
        <port name="out_geometry" type="Amino::Object" flag="0" is_input="no"/>
    </ports>
</vnnNode>
        </node>
        <node>
            <vnnNode name="input" type="" flag="8">
    <metadatas>
    <metadata name="DisplayMode">
        <value>2</value>
    </metadata>
    <metadata name="LayoutPos">
        <value>276.001 637.679</value>
    </metadata>
</metadatas>
    <ports>
        <port name="volume" type="Amino::Object" flag="0" is_input="yes" default_external_values="">
            <metadatas>
                <metadata name="feedbackPort" value=""/>
            </metadatas>
        </port>
    </ports>
</vnnNode>
        </node>
        <node>
            <vnnNode name="output" type="" flag="16">
    <metadatas>
    <metadata name="DisplayMode">
        <value>2</value>
    </metadata>
    <metadata name="LayoutPos">
        <value>2328 795</value>
    </metadata>
</metadatas>
    <ports>
        <port name="out_volume" type="Amino::Object" flag="0" is_input="no">
            <metadatas>
                <metadata name="feedbackPort" value=""/>
            </metadatas>
        </port>
    </ports>
</vnnNode>
        </node>
    </nodes>
    <connections>
        <connection output_port="equal.output" input_port="if.condition"/>
        <connection output_port="get_geo_property.data" input_port="if.false_case"/>
        <connection output_port="get_geo_property1.data" input_port="equal.first"/>
        <connection output_port="if.output" input_port="set_geo_property.data"/>
        <connection output_port="set_geo_property.out_geometry" inner_output_port="out_volume"/>
        <connection inner_input_port="volume" input_port="get_geo_property.geometry"/>
        <connection inner_input_port="volume" input_port="get_geo_property1.geometry"/>
        <connection inner_input_port="volume" input_port="set_geo_property.geometry"/>
    </connections>
</sub_root>
    </child_graph>
</vnnCompound>
        </compound>
    </nodes>
    <connections/>
</sub_root>

Let me know how it goes.

 

Message 11 of 14

a.mayaUser
Enthusiast
Enthusiast

Thanks @morten.bojsen-hansen sorry for the late, I'm in a middle of a project but I'm going to try it in the next one or two days and report here asap.

Message 12 of 14

a.mayaUser
Enthusiast
Enthusiast

@morten.bojsen-hansen 

 

Quick follow-up: I had the time to test this new compound and it's working perfectly!

 

Thanks again for the help provided with the workaround.

0 Likes
Message 13 of 14

morten.bojsen-hansen
Autodesk
Autodesk

Glad I could help. I'll see that we log something to address the problem with convert_to_volume (and points_to_volume).

 

By the way, for your problem with write_OpenVDB_volume, it's because the input is an array (list of volumes) and you are trying to connect a single volume so the two types don't agree. You can fix this either by using an intermediate build_array node, or simply right-clicking on the 'volumes' input and checking fan-in. That will automatically insert an (invisible) build_array node as needed.

0 Likes
Message 14 of 14

a.mayaUser
Enthusiast
Enthusiast

Changing the port did the trick. In the end it was just to try another node to solve the initial problem, since the resulting output is exactly the same as the file_cache.

 

Thanks again

 

edit: just saw the new 2.3.0.1 release, I'm going to try it out.

0 Likes