WIP: Volume Grid Nodes #116021
No reviewers
Labels
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 project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Depends on
#115270 Geometry Nodes: initial Volume Grid socket support
blender/blender
Reference: blender/blender#116021
Loading…
Reference in New Issue
No description provided.
Delete Branch "LukasTonne/blender:volume-grid-nodes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Various nodes for volume grids using the new grid sockets (#115270).
This is an experimental branch. The nodes will be reviewed and merged into main as separate PRs.
General Issues
Set Grid Value
Replace a grid values by capturing a field, keeping topology unchanged.
Primitive grids (Cube, Sphere, etc.) can be constructed by capturing a value like this node does, or they could be value-less mask grids which just define topology. The Set Grid Value node can then be used to combine such primitives and give them a new value.
It can also be used to redefine the type of grids, for example taking the topology of a density volume and replacing voxel values with vectors.
Sample Grid
Output interpolated grid values as a field.
This is a re-implementation of the existing grid sampling node that does not require a Volume geometry.
Grid to Points
Convert grid voxel data into point cloud attributes.
This is mostly useful for debugging purposes until viewer nodes and spreadsheet integration are available.
Grid Coordinate
input node. These attributes can be propagated to the points output, similar to other geometry conversion nodes, removing the need for explicit output sockets.Combine Grid Topology
Union/difference/intersection of active voxel states.
Vector<ValueOrField<T>>
which is not yet defined. Not sure if all the possible CPPTypes should be registered or if there is a more elegant solution.Deactivate Voxels
Set voxel state to inactive based on value.
Filter
Blurring-like filters for density grids: Mean, Median, Gaussian (blur), Offset
Level Set Filter
Blurring-like filters for SDF grids: Mean, Mean Curvature, Median, Gaussian (blur), Offset, Laplacian
Dilate/Erode
Extrapolate Grid
Extend the boundary to the interior and/or exterior of a density or SDF grid. Copies the value of the closest boundary voxel.
Poisson Solver
Find a smooth gradient between values on the boundary.
Lukas Tönne referenced this pull request2023-12-11 07:42:28 +01:00
@JacquesLucke I've updated this branch to build against the new
SocketValueVariant
. However, many nodes currently will crash because they don't handle user count correctly yet. I think the steps needed to make this work could be improved.I've made two versions of a typical workflow, using the Dilate node as an example case. Neither of them are nice, maybe there is a better way?
First get the input grid
Then modify it and write to output. But the way copy-on-write, user count, and type casting is handled makes for verbose and complicated code.
You can actually just use
params.set_output("Grid", std::move(grid));
There is no need to create a new
VolumeGrid
, you're just mutating the existing one.Note that the tree access token must be in scope for as long as the tree is used. Generally, you should not pass it directly to the accessor function, but store it in a separate variable instead.
The
reinterpret_cast
to the openvdb grid type, also shouldn't be necessary, because you can useVolumeGrid<T>::grid_for_write(...)
. I am noticing one issue with that right now that I need to look into though. It's that you can't really have access to the tree token yet, because an internal copy might be made internally. Need to think about that.. Maybe the method has to return the grid and the token together for correctness, or it has to modify the token internally.@JacquesLucke I'm hitting an assert in the
VolumeGridData(std::shared_ptr<openvdb::GridBase> grid)
constructor: it expects the input pointer to be unique, but passing the pointer by value it increments user count, even when the caller moves the pointer. I guess the constructor should take an rvalue reference?EDIT: Well that didn't fix it, i'm not entirely sure where the extra user count comes from.
EDIT2: Mystery solved: i was using a const pointer as a local output grid variable:
const GridPtr output_grid = GridType::create(vdb_background);
When moving this to the output
GVolumeGrid
the type does not match and a copy is made.return bke::GVolumeGrid(std::move(output_grid));
Making the
output_grid
non-const solves the issue. This doesn't seem quite obvious enough. Maybe should have a constructor for const pointers that could have a static assert.Checkout
From your project repository, check out a new branch and test the changes.