Geometry Nodes: Add volume grid creation nodes #118761

Merged
Hans Goudey merged 9 commits from HooglyBoogly/blender:geometry-nodes-grid-create into main 2024-02-28 22:15:20 +01:00
Member

Add three nodes to the currently experimental volume grid nodes:

  • Mesh to Density Grid
  • Mesh to SDF Grid
  • Points to SDF Grid

These nodes are just wrappers over basic openVDB utilities.
The difference from existing volume nodes is that they output
a grid directly instead of a geometry set.

See the design here: https://devtalk.blender.org/t/volumes-in-geometry-nodes-proposal/31917


image

Add three nodes to the currently experimental volume grid nodes: - **Mesh to Density Grid** - **Mesh to SDF Grid** - **Points to SDF Grid** These nodes are just wrappers over basic openVDB utilities. The difference from existing volume nodes is that they output a grid directly instead of a geometry set. See the design here: https://devtalk.blender.org/t/volumes-in-geometry-nodes-proposal/31917 --- ![image](/attachments/6cb0f7fd-db2c-46f7-bde3-581eb971853f)
Hans Goudey added 3 commits 2024-02-26 21:40:26 +01:00
7f6f98597b Geometry Nodes: Add volume grid creation nodes
Add three nodes to the currently experimental volume grid nodes:
- **Mesh to Density Grid**
- **Mesh to SDF Grid**
- **Points to SDF Grid**

These nodes are just wrappers over basic openVDB utilities.
The difference from existing volume nodes is that they output
a grid directly instead of a geometry set.
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
3355a6ae1e
Deduplicate and fix points to volume scaling
Hans Goudey added the
Interest
Geometry Nodes
label 2024-02-26 21:40:37 +01:00
Hans Goudey added this to the Nodes & Physics project 2024-02-26 21:40:43 +01:00
Hans Goudey requested review from Lukas Tönne 2024-02-26 21:40:52 +01:00
Hans Goudey requested review from Jacques Lucke 2024-02-26 21:40:52 +01:00
Author
Member

@blender-bot build

@blender-bot build
Raul Fernandez Hernandez approved these changes 2024-02-27 01:43:33 +01:00
Jacques Lucke reviewed 2024-02-27 20:53:45 +01:00
@ -25,0 +30,4 @@
public:
OpenVDBParticleList(const Span<float3> positions,
const Span<float> radii,
const float voxel_size)
Member

Assert that the voxel size is positive.

Assert that the voxel size is positive.
HooglyBoogly marked this conversation as resolved
@ -0,0 +22,4 @@
.min(0.01f)
.max(FLT_MAX)
.subtype(PROP_DISTANCE);
b.add_input<decl::Float>("Interior Band Width")
Member

Can we call this Gradient Width? or something similar?

Can we call this `Gradient Width`? or something similar?

Grid Scale?

`Grid Scale`?
Author
Member

Gradient Width sounds nice. Much more friendly. "Grid Scale" doesn't really mean the same thing.

`Gradient Width` sounds nice. Much more friendly. "Grid Scale" doesn't really mean the same thing.
HooglyBoogly marked this conversation as resolved
Hans Goudey added 3 commits 2024-02-27 21:37:15 +01:00
Jacques Lucke requested changes 2024-02-28 12:27:17 +01:00
Dismissed
@ -204,0 +211,4 @@
bke::VolumeTreeAccessToken access_token;
return mesh_grid ?
BKE_volume_grid_add_vdb(
*volume, name, mesh_grid.get_for_write().grid_ptr_for_write(access_token)) :
Member

This isn't quite right. The grid passed into BKE_volume_grid_add_vdb must not be shared. There is an assert for that. Here it is shared because it's still owned by mesh_grid. You could either keep returning openvdb::FloatGrid::Ptr from mesh_to_density_grid or use BKE_volume_grid_add to add the grid to the volume.

This isn't quite right. The grid passed into `BKE_volume_grid_add_vdb` must not be shared. There is an assert for that. Here it is shared because it's still owned by `mesh_grid`. You could either keep returning `openvdb::FloatGrid::Ptr` from `mesh_to_density_grid` or use `BKE_volume_grid_add` to add the grid to the volume.
HooglyBoogly marked this conversation as resolved
@ -91,4 +111,0 @@
{
openvdb::FloatGrid::Ptr new_grid = points_to_sdf_grid(positions, radii);
new_grid->transform().postScale(voxel_size);
new_grid->setGridClass(openvdb::GRID_LEVEL_SET);
Member

Looks like the volume does not have the correct grid class set now (see spreadsheet).

Looks like the volume does not have the correct grid class set now (see spreadsheet).
HooglyBoogly marked this conversation as resolved
@ -20,2 +21,3 @@
struct OpenVDBParticleList {
class OpenVDBParticleList {
public:
using PosType = openvdb::Vec3R;
Member

Seems to be unused.

Seems to be unused.
Author
Member

It's used by OpenVDB: openvdb/tools/PointPartitioner.h:540

It's used by OpenVDB: `openvdb/tools/PointPartitioner.h:540`
HooglyBoogly marked this conversation as resolved
Hans Goudey added 3 commits 2024-02-28 15:16:11 +01:00
Hans Goudey requested review from Jacques Lucke 2024-02-28 15:16:37 +01:00
Lukas Tönne approved these changes 2024-02-28 19:27:44 +01:00
Lukas Tönne left a comment
Member

Thanks, looks good to me.

Thanks, looks good to me.
Jacques Lucke approved these changes 2024-02-28 21:57:15 +01:00
Hans Goudey merged commit bea33a6be9 into main 2024-02-28 22:15:20 +01:00
Hans Goudey deleted branch geometry-nodes-grid-create 2024-02-28 22:15:22 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#118761
No description provided.