Jump to content

Attribute transfer in one axis?


Recommended Posts

Does anyone know a way of doing an attribute transfer but limiting it to only say the Y axis?  Could be a point cloud lookup, either way. However PC lookup doesn't give you the blend width controls which I need as well.  But basically I only want to transfer a color from a point cloud to another point cloud but only in the Y direction, so nothing would be transferred to the X and Z surrounding points.  I vaguely know how to do this with a pcopen function but I can't recreate the blend width type functionality as the attribute transfer.  Any ideas? Thanks

Link to comment
Share on other sites

It is hard to tell without seeing the data. But can't you achieve the same by

  • Storing the point positions as an attrib
  • flattening the shapes in the Y direction before the attrib transfer
  • And then restoring the point positions?
Link to comment
Share on other sites

Or maybe this sort of thing; get the dot product between the vector from the src->target and {0,1,0}, clamp it. If its directly above the dot will be 1, if its at 90 degrees it'll be 0. Also get the distance between the source and target, and use that to drive a fade to give you controllable falloff.

attribtransfer_filter_by_vector.hipnc

attribtransfer_filter_by_vector.gif

Edited by mestela
Link to comment
Share on other sites

Heh, you were gonna do a pclookup, but can't follow this? Cmon now... ;)

 

dot(v1,v2) indicates the orientation of 2 vectors relative to each other. If they're facing each other the result is 1, if they're perpendicular the result is 0, if they're parallel the result is -1.

Distance(p1, p2) just returns the distance between 2 points.

nearpoints() returns an array (a list) of points near a point, with controls for the maximum distance to search, and the maximum number of points to return.

foreach is a nice way to loop through the results of an array.

 

Thus armed, that wrangle does the following:

 

setup a bunch of variables we can use, so we have sliders to control maxdist, number of points, vector to test against etc

get a list of the closest 20 points within 1.2 units of the current point

for each returned point:

   get its position

   get the vector between the current point on the grid and that returned point

   get the dot product between that vector, and a vector pointing directly up (ie, {0,1,0})

    clamp it so it just goes between 0 and 1 (points underneat the grid will have a dot product between 0 and -1, we want to ignore those)

   get the colour of that returned point

   get the distance between the current point on the grid and the returned point

   invert that distance, so its greatest when the points are close, and fades off when far away. this gives the soft falloff

   multiply the colour by the dot product and the distance

   add that colour to the total @Cd. adding this up across all the returned points gives the blended colour result.

 

 

you could do all that in less lines by writing big nested statements, but i find breaking it out like this easier to read, and for me, easier to read this than to dissect a vop network. not always mind you, but here, i think it is.

 

Edited by mestela
  • Like 2
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...