Attribute transfer problem. Not very precise?

   5015   12   0
User Avatar
Member
118 posts
Joined: Feb. 2016
Offline


My ultimate goal is to group or name the different prims of the right column, based on how they match the position of the prims of the left column. (Note: you see the columns aside to each other just for debugging purposes. They actually occupy the very same positions, and the points match perfectly)
So I tried to transfer the colors of the prims of the left column to the right one.
I played with the different parameters and different models of the Attribute Transfer node, but I can't manage to perfectly transfer the colors.

Alternatively I could offset one column a bit along its normal, then scatter 1 point for every prim in the right column and throw some rays and get color information of the hit prim… but but… that sounds like too much effort for such simple task.


I've attached my attempt with attribute transfer node, in case you wanna have a look?
cheers and thanks for any help
Edited by Andr1 - Jan. 31, 2018 13:13:15

Attachments:
attrTransfer.hiplc (113.4 KB)

User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
Maybe not what you wanted, since there could be many different ways to do this, but it works.

Attachments:
attrTransfer.hiplc (119.6 KB)

User Avatar
Member
118 posts
Joined: Feb. 2016
Offline
Hello BabaJ, unfortunately I need something more procedural, so that it can suits different scenarios (a change of seed, for example).

Thanks a lot anyway, very much appreciated!



ps. I'm really curious to understand what's wrong (or more likely what I'm doing wrong) with the attribute transfer
Edited by Andr1 - Jan. 31, 2018 15:19:59
User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
What I showed you is procedural…just copy and paste the code for new/different sets of prims.

It would be the same as if using a bunch of group and attribute nodes.

It could also ( the vex code ) be wrapped up into a function for different scenarios and in turn put into a digital asset.

However, since I don't know what you eventually would like - I kept it limited to as is for the specific case.
Edited by BabaJ - Jan. 31, 2018 15:35:49
User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
Here's what I did with vex plus you can switch over to using group nodes and the attribute nodes.

As you can see, doing it with attribute transfer requires alot of nodes, which is why I did it with vex.

Either way, Houdini needs to know what prims get what - hence the grouping.

Another way is to go by point or prim positions to get matching, but that requires a bit more code and would it fit for what else you want to do?

By re-thinking your end result and how to get there, it's possible you could do a set-up that doesn't require as many nodes or vex code; or maybe it does - just depends on what you eventually want your setup to do.

Hang in there though on this thread - someone may come along and show a much more ‘elegant’ solution to what you currently have.

Edit: I'm pretty sure the group by range node could replace all those individual group nodes - so long as a sort node is used first. And then maybe something similar ( one node only ) with the attribute transfer.
Edited by BabaJ - Jan. 31, 2018 16:27:32

Attachments:
attrTransfer v1.hiplc (161.3 KB)

User Avatar
Member
555 posts
Joined: Feb. 2017
Offline
holy guacamole….don't mean to offend anyone here but sometimes…don't get too technical, use your common sense.

The reason the color demarcation is not clearcut is for a large prim, it doesn't take the ‘boundary’ into consideration but it uses the prim centers…so for a very long prim, you might think the color transfer should take place at the boundary but it's comparing the distance to the centroid of the prim and hence the longer prim would have the centroid further away from its target.

So knowing that, without any incredibly complicated technical procedures, I can do with ONE node.

Yeah you heard right, ONE.

All you have to do is after the randColor, add a subdiv>OpenSubdiv Bilinear. Even though Depth of 1 is enough, you might want to make it 2 or 3 to ensure accuracy.

The effect is that your prims are now not very ‘elongated’ and therefore your results are not ‘skewed’.

(also, your Distance Threshold in the attribtransfer seems too high for my liking…i usually go for 0.1 or even less for accuracy…especially now that the geo is subdivved)
Edited by vusta - Feb. 1, 2018 16:28:43

Attachments:
attrTransfer_fixed.hipnc (115.0 KB)

User Avatar
Member
402 posts
Joined: June 2014
Offline
Another option is to promote you're colour attribute to ‘Vertex’, and then transfer those. This method should work fine with the Attribute Transfer sops default settings too.
Henry Dean
User Avatar
Member
2535 posts
Joined: June 2008
Offline
Yet another option is to subdivide the source you are transferring from. AttributeTransfer is more accurate when it has more data to sample from.
Edited by Enivob - Feb. 1, 2018 16:28:30
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
555 posts
Joined: Feb. 2017
Offline
Enivob
Yet another option is to subdivide the source you are transferring from. AttributeTransfer is more accurate when it has more data to sample from.
haha, didn't i say to use subdiv Atom ?
User Avatar
Member
555 posts
Joined: Feb. 2017
Offline
here's a better fix…in case you scatter alot of poins (ie. very thin strips)

The fix is, it creates a very thin prim right at the edges,eliminating the ‘elongated’ effect.

This way, you don't have to up the subdiv when you get very thin strips

Attachments:
attrTransfer_fix2.hipnc (118.3 KB)

User Avatar
Member
11 posts
Joined: Dec. 2013
Offline
Found this thread from some rant about common sense.

In your case this solution will work just fine, but it can do more complex tasks with some adjustments.

the code is:
//set this in a primitive wrangle and connect your geo to transfer from to input 2
int primid;
vector uv;
xyzdist(1,@P,primid,uv);
@Cd = prim(1,“Cd”,primid);

Attachments:
attrTransfer_xyzdist.hiplc (118.8 KB)
attrTransfer_xyzdist.hiplc.png (34.0 KB)

User Avatar
Member
2535 posts
Joined: June 2008
Offline
Yup, you got me.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
118 posts
Joined: Feb. 2016
Offline
Thanks everyone for providing so many different approaches and explaining the technical bit about the Attribute Transfer. This is a very good way to learn.

friedasparagus
Another option is to promote you're colour attribute to ‘Vertex’, and then transfer those. This method should work fine with the Attribute Transfer sops default settings too.

Along with the very nice Vex method posted by Thomas, this would be the preferred solution I guess, because it seems more efficient.
However in some cases it's not as precise (probably for the same reasons Vusta explained?), but I might be doing something wrong. I've attached a file so that you might have a look if you will.
Cheers
Edited by Andr1 - Feb. 5, 2018 05:24:30

Attachments:
attrTransfer Vertex approach.hiplc (115.7 KB)

  • Quick Links