Geometry Nodes: porting the VertexWeightProximity modifier #84842

Closed
opened 2021-01-18 22:14:04 +01:00 by Victor-Louis De Gusseme · 9 comments

This task covers the design of how the functionality of the VertexWeightProximity modifier could be ported to geometry nodes.

I've started implementing an Attribute Proximity node here: https://developer.blender.org/D10154

VertexWeightProximity modifier


The VertexWeightProximity modifier sets the weights of vertex group based on the distance of each vertex to a Target Object. The distances are mapped to values in the 0 to 1 range.
vertex_weight_proximity.png
The main code for this modifier can be found in blender/source/blender/modifiers/intern/MOD_weightvgproximity.c. The distance calculations are done using a BVH.

Use Cases


Among other things, something users will definitely want to do is:

  • Create a scene with some objects
  • Scatter points/objects in the remaining free space

In this video Miro Horvath shows a nice example: scattering trees in a landscape, but not on a road and a river in the landscape. He achieves this by using VertexWeightProximity to create vertex weights that are 0 around the road and river, and then feeding these vertex weights to the Point Distribute Node. Below are screenshots of his vertex weights and his result:
river.png
result.png
What's nice about this workflow is that he can move the river around and the trees will appear/disappear as needed.

Design for Geometry Nodes


In the spirit to keep geometry nodes atomic, it probably makes sense to strip away most of the options in the VertexWeightProximity modifier. All the mapping functionality (falloff, lowest, highest, normalize) and masking functionality (the stuff in 'Influence') could be done by other nodes. The geometry nodes should thus basically calculate and output distances. The node could look something like this:

Attribute Proximity Node

attr_proximity.png

So how it would work is that the node would output for each vertex in the first geometry, the distance to the closest point on the second geometry.
Suggestions for better names for the inputs are welcome, maybe Geometry and Target Geometry?

Miro's workflow could then be simplified to something like this:

  • Add geometry nodes modifier to the landscape
  • Read road geometry with an Object Info node
  • Use proximity node to calculate a vertex proximities between the landscape and the road
  • Map the proximities to a 0->1 range with other nodes

Scatter on landscape with the values from the previous step as density attribute

Notes


  • In general I think a "procedural vertex weights" workflow will be essential for geometry nodes, but we should also think how about the trade offs between a texture driven/vertex weights driven workflow. One thing that comes to mind is that increasing the resolution of vertex weights requires you to add additional vertices that are not needed from a modelling perspective. This might be a problem for controlling scattering on low-poly meshes.
  • I can't figure out how to visualize vertex weights in Object mode. It would be very useful to be able to move a target object around and see the effect on the vertex weights.
This task covers the design of how the functionality of the VertexWeightProximity modifier could be ported to geometry nodes. I've started implementing an Attribute Proximity node here: https://developer.blender.org/D10154 VertexWeightProximity modifier **** The VertexWeightProximity modifier sets the weights of vertex group based on the distance of each vertex to a Target Object. The distances are mapped to values in the 0 to 1 range. ![vertex_weight_proximity.png](https://archive.blender.org/developer/F9585964/vertex_weight_proximity.png) The main code for this modifier can be found in `blender/source/blender/modifiers/intern/MOD_weightvgproximity.c`. The distance calculations are done using a BVH. Use Cases **** Among other things, something users will definitely want to do is: - Create a scene with some objects - Scatter points/objects in the remaining free space In this [video ](https://www.youtube.com/watch?v=rd5joo1aKmk) Miro Horvath shows a nice example: scattering trees in a landscape, but not on a road and a river in the landscape. He achieves this by using VertexWeightProximity to create vertex weights that are 0 around the road and river, and then feeding these vertex weights to the Point Distribute Node. Below are screenshots of his vertex weights and his result: ![river.png](https://archive.blender.org/developer/F9586117/river.png) ![result.png](https://archive.blender.org/developer/F9586119/result.png) What's nice about this workflow is that he can move the river around and the trees will appear/disappear as needed. Design for Geometry Nodes **** In the spirit to keep geometry nodes atomic, it probably makes sense to strip away most of the options in the VertexWeightProximity modifier. All the mapping functionality (falloff, lowest, highest, normalize) and masking functionality (the stuff in 'Influence') could be done by other nodes. The geometry nodes should thus basically calculate and output distances. The node could look something like this: Attribute Proximity Node -------------------------------- ![attr_proximity.png](https://archive.blender.org/developer/F9588156/attr_proximity.png) So how it would work is that the node would output for each vertex in the first geometry, the distance to the closest point on the second geometry. Suggestions for better names for the inputs are welcome, maybe `Geometry` and `Target Geometry`? Miro's workflow could then be simplified to something like this: - Add geometry nodes modifier to the landscape - Read road geometry with an Object Info node - Use proximity node to calculate a vertex proximities between the landscape and the road - Map the proximities to a 0->1 range with other nodes # Scatter on landscape with the values from the previous step as density attribute Notes **** - In general I think a "procedural vertex weights" workflow will be essential for geometry nodes, but we should also think how about the trade offs between a texture driven/vertex weights driven workflow. One thing that comes to mind is that increasing the resolution of vertex weights requires you to add additional vertices that are not needed from a modelling perspective. This might be a problem for controlling scattering on low-poly meshes. - I can't figure out how to visualize vertex weights in Object mode. It would be very useful to be able to move a target object around and see the effect on the vertex weights.
Author
Member

Added subscriber: @victorlouis

Added subscriber: @victorlouis

Added subscriber: @DimitriBastos

Added subscriber: @DimitriBastos

Is it possible to not be totally vertex dependent on those effects?

EDIT for clarity:

For instance, we can create weights by using an empty or another mesh, but it would be nice to create weights using a parametric workflow not mesh dependent like using a curve, or like using some sort of linear object (similar to the weight gradient tool). For what I know, the Weight Proximity Modifier is based on object origin, so even if you use a curve it will only read the curve origin, not the curve points or the curve geometry.

Is it possible to not be totally vertex dependent on those effects? EDIT for clarity: For instance, we can create weights by using an empty or another mesh, but it would be nice to create weights using a parametric workflow not mesh dependent like using a curve, or like using some sort of linear object (similar to the weight gradient tool). For what I know, the Weight Proximity Modifier is based on object origin, so even if you use a curve it will only read the curve origin, not the curve points or the curve geometry.
Author
Member

You mean working texture based? I'm not sure what the current plan is for integration of textures and geometry nodes. I think there's some complexities with integrating textures that aren't there for vertex weights, so using vertex weights is just a start.

You mean working texture based? I'm not sure what the current plan is for integration of textures and geometry nodes. I think there's some complexities with integrating textures that aren't there for vertex weights, so using vertex weights is just a start.

Added subscriber: @MiroHorvath

Added subscriber: @MiroHorvath

In #84842#1096268, @victorlouis wrote:
You mean working texture based? I'm not sure what the current plan is for integration of textures and geometry nodes. I think there's some complexities with integrating textures that aren't there for vertex weights, so using vertex weights is just a start.

Not exactly using textures. I think I'm not making myself clear, sorry. What probably I want to say is if there is a way to add more shapes for creating weights.

For instance, we can create weights by using an empty or another mesh, but it would be nice to create weights using a parametric workflow not mesh dependent like using a curve, or like using some sort of linear object (similar to the weight gradient tool). . For what I know, the Weight Proximity Modifier is based on object origin, so even if you use a curve it will only read the curve origin, not the curve points or the curve geometry.

> In #84842#1096268, @victorlouis wrote: > You mean working texture based? I'm not sure what the current plan is for integration of textures and geometry nodes. I think there's some complexities with integrating textures that aren't there for vertex weights, so using vertex weights is just a start. Not exactly using textures. I think I'm not making myself clear, sorry. What probably I want to say is if there is a way to add more shapes for creating weights. For instance, we can create weights by using an empty or another mesh, but it would be nice to create weights using a parametric workflow not mesh dependent like using a curve, or like using some sort of linear object (similar to the weight gradient tool). . For what I know, the Weight Proximity Modifier is based on object origin, so even if you use a curve it will only read the curve origin, not the curve points or the curve geometry.
Author
Member

I think current modifier can already do a few things you describe by choosing Proximity Mode Geometry. But indeed, the goal is that distances are calculated to all sorts of geometry, meshes, point clouds, curves etc. I'm not sure how hard supporting curves would be, maybe as a first version curves could be converted to a set of edges.

I think current modifier can already do a few things you describe by choosing Proximity Mode `Geometry`. But indeed, the goal is that distances are calculated to all sorts of geometry, meshes, point clouds, curves etc. I'm not sure how hard supporting curves would be, maybe as a first version curves could be converted to a set of edges.

This issue was referenced by 4d39a0f8eb

This issue was referenced by 4d39a0f8eb1103aa58611fff7219f4bf3d70f70f

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Dalai Felinto self-assigned this 2021-02-05 16:30:46 +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 project
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#84842
No description provided.