Page MenuHome

Geometry Nodes: Fields Version of Points to Volume
ClosedPublic

Authored by Johnny Matthews (guitargeek) on Sep 16 2021, 11:56 PM.

Details

Summary

Create a field-aware version of points to volume for the radius input.

Diff Detail

Repository
rB Blender

Event Timeline

Johnny Matthews (guitargeek) requested review of this revision.Sep 16 2021, 11:56 PM
Johnny Matthews (guitargeek) created this revision.
source/blender/makesdna/DNA_node_types.h
1318

Don't change DNA names!

Johnny Matthews (guitargeek) edited the summary of this revision. (Show Details)

DON'T CHANGE DNA NAMES!

Hans Goudey (HooglyBoogly) requested changes to this revision.Sep 30 2021, 9:40 PM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/nodes/geometry/nodes/legacy/node_geo_points_to_volume.cc
250–256

The logic here should be wrapped in a modify_geometry_sets call, and the same geometry set should be used for inputs and outputs. An example of that is in node_geo_mesh_to_points.cc.

This revision now requires changes to proceed.Sep 30 2021, 9:40 PM

Modify for modify_geometry_sets. It may not be the most optimal way, please review.

Hans Goudey (HooglyBoogly) requested changes to this revision.Oct 2 2021, 6:51 AM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
39

Not sure if this was a problem before or not, but the new node can use PROP_DISTANCE for the radius too.

173–179

Here you could evaluated directly into the vector, after expanding it so that it's large enough, like

r_positions.reserve(r_positions.size() + domain_size);
...
evaluator.add_with_destination(r_positions.as_mutable_span().take_back(domain_size));

Also, seems this evaluator is named "selection_evaluator" when there is no selection.

195–200

Using the same vectors for all geometry sets (there might even be multiple threads working on different instances at the same time) likely won't work.

They should be declared in the modify_geometry_sets function.

Actually, I would recommend moving the modify_geometry_sets loop to the caller, so this function only needs to worry about a single geometry set, that also makes sense since the caller is quite simple currently, it can handle doing a bit more.

234

Since this geometry set might be part of a "tree" of nested instances, it might have an instance component that contains more points that could be converted to volumes, so keeping GEO_COMPONENT_TYPE_INSTANCES is necessary here too.

This revision now requires changes to proceed.Oct 2 2021, 6:51 AM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 3 2021, 3:05 AM
This revision was automatically updated to reflect the committed changes.

Oops! I copied the wrong URL!

Reverting a minor mishap

Hans Goudey (HooglyBoogly) requested changes to this revision.Oct 3 2021, 3:55 AM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
176–178

This should work a bit more efficiently, since it won't call the virtual array get method separately for every point:

positions->materialize(r_positions.as_mutable_span().take_back(domain_size));
238

volume is just a raw pointer, so moving it doesn't have any benefit.

This revision now requires changes to proceed.Oct 3 2021, 3:55 AM

A couple of small updates from @Hans Goudey (HooglyBoogly)

Don't use std::move on a raw pointer
A more efficient way to move some data

This revision is now accepted and ready to land.Oct 3 2021, 7:18 AM