Jump to content

Using VEX to modify another geometry (different geohandle)


claudiubp

Recommended Posts

Hi guys!

I use VEX in a AttribWrangle in order to go through all faces of a "base" mesh and on each mesh face create a Lattice like (FreeFormDeformed) version of another geometry. This other geometry (imagine it like a dynamic pattern) I want to populate with, needs to change its parameters before the AttribWrangle creates a Lattice transformed "copy" of it for each face.

Let me give you a simple example. Let's say the pattern is a cube with a round hole inside. The pattern's parameter is the radius of this hole. Now this pattern has to be distributed over the faces of another geometry. Given the distance to a point affector (or curve) or the base geometry's curvature for example, the pattern must change its radius parameter before being distributed on each of the base's faces. So no two faces will have an identical pattern.

The way I do things now:
The AttribWrangle runs over the primitives of the base mesh (input 1 is the geometry of the base mesh).
Input two holds some points and curves that are used as affectors inside the AttribWrangle in order to compute each primitive's distance to these affectors.
Input three contains the geometry of the pattern.
Inside the AttribWrangle, I compute the "deformed to base surface" of the pattern and add it to the current geo as a new group.
It all works fine, except that I cannot change the radius of the pattern proportionally to the distance to the affectors of the base geometry current face.

What I tried to do was to create a DetailAttribute on the pattern geometry that then can be modified from VEX from the AttribWrangle, something like this:

//Distance computations yield a DistanceToAffectors parameter between 0 and 1 that should affect the radius

float OldAttribValue = DistanceToAffectors * MaxRadius;//DistanceToAffectors always normalized (0..1) 
int rez =setdetailattrib(2, "radius_value", DistanceToAffectors, "set");
float NewAttribValue = detail(2,'radius_value');

I use 2 because it is the third input of the AttribWrangle node.

Normally this should change the detail attribute "radius_value" of the geometry on input #3 (2), but nothing happens. The NewAttribValue remains unchanged and the setdetailattrib returns 2 (and has no effect on the attribute whatsoever)

My question is: why? Or how can I change the parameter of another geometry before using it in the same AttribWrangle node? Or in general: how do you change a parameter of another geometry from VEX?

Thank you!

Link to comment
Share on other sites

For me, your logic is a non-sense:

Quote

 

What I tried to do was to create a DetailAttribute on the pattern geometry

 

Quote

Input three contains the geometry of the pattern.

The wrangle node run over input 0 geometry (by points/primitives/etc...).

So if you want to create an attribute on the pattern geometry, connect this geometry in input 0, then iterate the others geometry with other inputs to get values.

You can NOT set attribute on input2 except if you recreate this geometry in the wrangle node and delete geometry of the input 0.

  • Like 1
Link to comment
Share on other sites

2 hours ago, Atom said:

You can do this with Python, however.

Very useful...

The question was:

Quote

My question is: why? Or how can I change the parameter of another geometry before using it in the same AttribWrangle node? Or in general: how do you change a parameter of another geometry from VEX?

And like all SOP nodes in houdini, the idea is to apply something from the first input, python or vex or anything else, you apply from the input.

I think here the problem is the logic and without a file attached is difficult to understand the entire problem. I don't understand the necessity to create a detail attribute on input_3, a simple variable is enough to apply this value in the wrangler node to other geometry.

in this code:

int rez =setdetailattrib(2, "radius_value", DistanceToAffectors, "set");
float NewAttribValue = detail(2,'radius_value');

is equal as :

float NewAttribValue = DistanceToAffectors;

and why recreate a new variable if we have already one ???

 

Edited by fsimerey
Link to comment
Share on other sites

This (see attached image) is more or less what I'm trying to achieve. Just imagine that the Perforated Hexagon is the Pattern (in reality, it will be a more complex object with more than 1 parameter).

Any idea how to get this result using VEX? (I need it to be really fast). How can I first compute the "pattern" parameters for each position and then generate the unique geometry?

 

XwIWu9NrZDg.jpg

Link to comment
Share on other sites

Using VEX to modify non-input geometry is not possible for now. In future maybe, it may became true, at least in form of multiple outputs from VOPnets and Wrangles. You always can do things in opposite way, however. Write unique parameter to copy points, and then just copy input geo on this points using stamp expression or foreach loop. Another way is quad-copying, best and simplest implementation of which @petz provided there:

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...