Attribute transfer problem. Not very precise?
5520 12 0- Andr1
- 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
- BabaJ
- Member
- 2123 posts
- Joined: Sept. 2015
- Offline
- Andr1
- 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
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
- BabaJ
- Member
- 2123 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.
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
- BabaJ
- Member
- 2123 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.
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
- vusta
- 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)
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
- friedasparagus
- Member
- 402 posts
- Joined: June 2014
- Offline
- Enivob
- Member
- 2625 posts
- Joined: June 2008
- Offline
- vusta
- Member
- 555 posts
- Joined: Feb. 2017
- Offline
- vusta
- Member
- 555 posts
- Joined: Feb. 2017
- Offline
- ThomasRunning
- 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:
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);
- Enivob
- Member
- 2625 posts
- Joined: June 2008
- Offline
- Andr1
- 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.
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
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
-
- Quick Links