Voxel Grid

admin

Voxelgrid provides an implementation of an efficient 3D voxel grid. The occupancy grid can support 3 different representations for the state of a cell: marked, free, or unknown. Due to the underlying implementation relying on bitwise and and or integer operations, the voxel grid only supports 16 different levels per voxel column. A voxel grid is a N x N x N grid of voxels where each voxel stores properties such as density, color, and transmissivity. The voxel class can take any world-space coordinate and transform it into local voxel-space coordinate.

Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.
Description:VoxelGrid filtering
Tutorial Level: BEGINNER

The following launch file starts a nodelet manager together with a VoxelGrid PCL filter nodelet. The input PointCloud2 topic is set to /camera/depth/points.

The default filtering values are set to filter data on the z-axis between 0.01 and 1.5 meters, and downsample the data with a leaf size of 0.01 meters.

In the first terminal,

Open a new shell, and put following command.

Then, launch rviz.

VoxelGrid is enable on the following image.

The VDB Voxel item allows you to render externally created simulations stored in the open-source VDB voxel format, as well as generate volume data from meshes or particles. The OpenVDB format is an efficient method of storing hierarchical data structures.

Simulations can be volumetric in nature, such as smoke and clouds, or represent a surface, such as water or other liquids. Volumetric effects must be connected to a Volume Item for rendering in Modo. Surfaces can be connected to Blobs, or use the internal meshing feature, when the Draw Mesh Surfaces option is enabled.

Note:VDB Voxel uses OpenVDB 3.0. VDB files encoded with Blosc are not supported.

Smoke example:

Fluid example:

The VDB Voxel Item is added to the scene in the Item List under Add Items > Volumes > VDBVoxel. With the item selected, from the Properties panel, use the Load File button and locate the desired OpenVDB file (<filename>.vdb). Once loaded, an octree-like grid appears in the 3D viewport, representing the voxel shape. At this point the item won't yet render. To render using a Volume Item, the VDB Voxel Item and the Volume item must be connected in the Schematic viewport. This is done by selecting both items in the Item List and then, in a Schematic viewport, clicking the Add Selected button (or by dragging and dropping into the viewport). Once there, connect the VDBVoxel relationship connector to the Voxel Source input on the Volume Item. For information on working in the Schematic viewport, refer to Schematic Viewport.

Surfacing is applied by way of an item mask in the Shader Tree. Select the Volume item and right-click to open the contextual menu and select the Create Item Mask command. In the Shader Tree, selecting the resulting Material item within the generated mask and edit the Volumetric Properties under the Material Rays sub-tab.

The VDB Voxel Item is added to the scene in the Item List under Add Items > Other > VDBVoxel. With the Item selected, from the Properties panel, use the Load File button and locate the desired OpenVDB file (<filename>.vdb). Once loaded, an octree-like grid appears in the 3D viewport, representing the voxel shape. At this point the item won't yet render. To create a surface, simply enable the Draw Mesh Surfaces option. When enabled, the polygonized surface is visible in the 3D viewport, as well as in any renders (for large VDB files generating the surface may take some time). Surfacing is applied by way of an item mask in the Shader Tree. Select the VDBVoxel Item and right-click to open the contextual menu and select the Create Item Mask command. In the Shader Tree, select the resulting MaterialItem within the generated mask and edit any of the standard material properties available.

Load the particle simulation into the scene, or generate a particle simulation using any of the provided particle simulation components. Once completed, make sure to cache the simulation. The VDB Voxel Item is added to the scene in the Item List under Add Items > Other > VDBVoxel. With the item selected, from the Properties panel, use the Source Item selector and select the desired Particle Simulation as the source element. Next, enable the Draw Mesh Surfaces option to mesh the particles with a surface. From here the Filtering settings as well as the Voxel's Radius and Resolution settings come into play. They can be used to modify the look of the resulting surface. Surfacing is applied by way of an item mask in the Shader Tree. Select the VDBVoxel Item, right-click to open the contextual menu, and select the Create Item Mask command. In the Shader Tree, select the resulting Material item within the generated mask and edit any of the standard material properties available.

The following options are available for VDBVoxel:

Transform

Transform

Position

Use the X, Y and Z input fields to apply specific offset distance values, calculated from the position the object was in when the tool was activated. When adjusting an object interactively in the viewport, the Position input fields display the current offset distance applied, providing useful feedback.

Rotation

Use the X, Y and Z input fields to apply specific rotation values. When adjusting an object interactively in the viewport, these input fields display the current offset distance applied, providing useful feedback.

Scale

Use the X, Y and Z input fields to apply specific scaling values. When adjusting an object interactively in the viewport, these input fields display the current scale factor applied, providing useful user feedback.

Reset

Resets the selected transform values to (0,0,0) returning the items to their default state.

Zero

Resets the chosen transform property values to 0, leaving the center position and mesh position intact.

Add

Transform items are the channel groups associated with an item that store its transform values, controlling its position, rotation and/or scale. By default, new items do not have any transform items associated with them (even though they are visible here within the Properties panel). This is useful as an optimization as only the necessary transforms are added on an as-needed basis, reducing scene overhead. There are several ways to add them. One is by simply transforming the target item with one of the various transform tools (or by editing the values' input fields). This action causes the particular transform item to be added automatically to the Channels viewport list. The Add function here can also be used to add the selected set of transforms to the Channel list while keeping the default 0,0,0 values (a necessary step for referencing, in order to override the channels, they must first exist).

Source

Source

File Name

Displays the currently-loaded path and file name. To update the current VDB file, use the Load File button.

Load File

Opens an OS-specific dialog, allowing you to locate and select the VDB file to be loaded.

Source Item

Serves two purposes: you can load Mesh Item layers and they are voxelized by the VDB Voxel item, or additionally a particle source can be specified, and with the Draw Mesh Surfaces option enabled, the particles can be 'meshed' (meaning a polygonal surface is applied). When a Particle Source is defined, the Filter settings and the Voxel settings come in to play to control the look of the surfacing.

Particle To Volume

Particle to Volume

Velocity Scale

Controls the scale of particle stretching based on velocity. Values are additive to the base value, so a Stretch Particle value of 100% produces a particle that was stretched twice the length (200% altogether).

Radius Scale

Controls the amount of randomness added to the scale of each individual particle volume. The amount is determined by a scale percentage - a setting of 25% adjusts the scale of the base radius size by an amount of 0%-25% randomly across all particles, a setting of 50% adjusts the size by 0%-50% randomly across all particles and so on.

Tip:When meshing a particle source (loaded through the Source Item control) the Radius value defines the rendered size of the virtual sphere shape formed around each particle position. The Resolution setting and the Filtering values determines how sphere-like the final result end up being.

Voxel Filter

Voxel Filter

Filter Mode

Determines a method of smoothing, applied to the surface generated from particle. The options possible are None, Mean, Gaussian, and Median. The None option disables filtering, while the Mean, Gaussian, and Medial all average the surface values differently, producing slightly different results. Results are also dependent on the Width setting and the Resolution of the Voxels.

Filter Width

Defines the size of the averaging filter applied to the generated surface values when a Filter Mode other than None is selected. Larger sizes produce a smoother surface but reduces detail overall.

Meshing Options

Meshing Options

Generate Voxel Mesh

When enabled, a polygonal surface is applied.

Voxel Resolution

Determines how finely the particles are meshed. Low values can be easily smoothed with filtering, but produce limited detail. Higher values produce more detail, but may also require additional filtering to remove resolution artifacts.

Motion Blur

Defines the value for motion blur of particles for volume creation.

Voxel Grid Filter

Visualization

Visualization

Density

Defines which stored features of the VDB file is used to represent the visualized form in the 3D Viewports.

Draw Grids

Toggles visibility of the representative grid-like display in the 3D Viewports based on the Feature definition.

Draw Mesh Frames

When loading a multi-framed sequence, enabling this option loads all the subsequent frames and draw them in the 3D Viewports.

Misc

Misc

Clear Cache

Used to remove any stored data from RAM. This resets the cache if the Mode is set to Fast or Full, or removes it if the Mode is changed to None.

Note:You can access the additional cache options Cache Mode and Cache Size in the Rendering preferences. In the menu bar for Windows, click System > Preferences... > Rendering > Final Rendering and for Mac OS, click Menu > Preferences... > Rendering > Final Rendering. For more information, see Rendering Preferences.

Freeze To Mesh

Used to convert an item from type VDBVoxel to Mesh.

Modo has the ability to load fluid texture effects Pressure, Temperature, and Fuel from a VDB Voxel file. Voxel grids are converted into fluid gradient effects, allowing you to render externally created simulations and to generate volume data from meshes or particles with the imported texture effects.

Note:These texture effects are read only. You can only set them as input parameter, not a output parameter.

To add fluid gradient effects to your VDB Voxel file:

1. Add a gradient item to your scene. To do this open the Shader Tree by clicking on Shading tab and then click Add Layer and select Processing > Gradient.
2. In the Properties > Texture Layers pane, expand Surface Gradient.
Voxel grid filter
3. Click the Input Parameter drop-down menu, expand Volumetric Effects, and select one of the following options:

Voxel Grids

Fluid Temperature - Import fluid temperature volumetric data from the VDB Voxel source file to convert it to a Modo gradient output.

Fluid Fuel - Import fluid fuel volumetric data from the VDB Voxel source file to convert them to a Modo gradient output.

Fluid Pressure- Import fluid pressure volumetric data from the VDB Voxel source file to convert them to a Modo gradient output.

Voxel Grid Ros

4. In the Mesh Operations list, Item List tab, click Add Item.
5. Select Volumes > VDBVoxel.
6. In the Properties pane, under Source, click Load File.
7. Load a .vdb file which contains Temperature, Fuel, or Pressure effects.
8. Render your scene to see the results.

Voxel Grid Python

For more information about rendering, see Rendering.