Levelset to Fog

In this tutorial, we will present how to create a fog from a VDB Levelset.

import omni.vdb.neuralvdb
import omni.vdb.tool
import numpy as np

# Acquire interfaces
ivdbtool = omni.vdb.tool.get_vdb_tool_interface()

# Read VDB file
volume = ivdbtool.load_volume("/path/to/my_levelset.vdb")

# Levelset To Fog
fog = ivdbtool.levelset_to_fog(volume)

# Save it as mtl requires a file
fog_path = "/path/to/my_fog.vdb"
ivdbtool.save_volume(fog, fog_path)

# Change the renderer to RTX - Interactive, and check Render Settings -> Path Tracing -> Non-uniform Volumes box.

# Get a stage and setup the scene for fog visualization
stage = omni.usd.get_context().get_stage()
mtl_path = omni.vdb.tool.create_volume_material()
omni.vdb.tool.add_volume_cube(stage, mtl_path)
omni.vdb.tool.change_material_asset_path(stage, mtl_path, fog_path)

Please find more operations for manipulating VDB volumes here.