26. September 2023

Weight controlled Poke Modifier

Even though the vertex maps that can be controlled by fields only offer per vertex information, we can still make use of it on a per polygon base.

One solution for this is to generate an Average, or similar, of the weights of all vertexes that contribute to a polygon. This is not the same as if we were to sample a field at the center of a polygon, but it’s close enough for many practical purposes.

In this setup the selected polygons are iterated over. The Polygons Info node provides easy access to an array per polygon that holds all vertex indexes that define the polygon array<array<int>>

A second iterator then reads all vertex weights for the vertexes of one polygon and averages them. Like in the example in the posting before, an empty input field for the Vertex Map will make Points Info deliver the data from the first Vertex Map encountered. If you have several you should provide and use the input to specify which one you want to use.

The average is the multiplied by the user specified Offset and delivered to the Loop Carried Value node that does the actual modeling operation.

Within the LCV there is a check to see if the Offset is actually larger than zero, if not the Poke is skipped. Since modeling operations are always costly this can speed things up depending on how many polygons are actually modified.

Example-Weight-controlled-deformer-2.c4d