UV from Hi to Lo poly ?
21768 26 9- MagnusL3D
- Member
- 1110 posts
- Joined: Aug. 2008
- Offline
I want to transfer the UV values from either a “high res” or a “correctly” uv-mapped mesh onto a “lo poly” mesh which i've generated from the incomming mesh, and put through volumes and then converted back to mesh.
I've searched alot on this subject and the little I find always refer to using the attribute transfer node in vertices mode. But it always creates this unwanted seam in the uv, which I do not know how to fix. I also tried using the Ray SOP for this and both it and the Attribute SOP can create ok results besides the seam thing.
A very simplified scene is attached to illustrate the “problem”, suggestions welcome !
I've searched alot on this subject and the little I find always refer to using the attribute transfer node in vertices mode. But it always creates this unwanted seam in the uv, which I do not know how to fix. I also tried using the Ray SOP for this and both it and the Attribute SOP can create ok results besides the seam thing.
A very simplified scene is attached to illustrate the “problem”, suggestions welcome !
- MagnusL3D
- Member
- 1110 posts
- Joined: Aug. 2008
- Offline
- neil_math_comp
- Member
- 1743 posts
- Joined: March 2012
- Offline
Alas, the AttributeTransfer code for vertices is a huge, complicated mess. It tries to maintain any seams from the source, (and only seams from the source), but in many cases, it doesn't seem to do very well, even if the edges in the source almost perfectly line up with the edges in the destination.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
- MagnusL3D
- Member
- 1110 posts
- Joined: Aug. 2008
- Offline
ndickson
Alas, the AttributeTransfer code for vertices is a huge, complicated mess. It tries to maintain any seams from the source, (and only seams from the source), but in many cases, it doesn't seem to do very well, even if the edges in the source almost perfectly line up with the edges in the destination.
That sounds like the AttributeTransfer wont solve this at all then ? So whats the alternative solution because, there is always a alternative solution in Houdini
- neil_math_comp
- Member
- 1743 posts
- Joined: March 2012
- Offline
MagnusL3DIt is *supposed* to solve this; it just often doesn't.
That sounds like the AttributeTransfer wont solve this at all then ?
So whats the alternative solution because, there is always a alternative solution in Houdini
Well… I suppose that you could always try to write a VEXpression in AttribWrangle that would either do the transfer itself or make it easier to fix cases where AttribTransfer got it wrong. If you can, that would be freaking awesome, and I bet that a lot of people would be eager to have it solved, even if it's only for a limited range of cases.
That said, it'd probably be extremely difficult to do it that way, and someone else probably knows of a much better workaround.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
- vleermeneer
- Member
- 245 posts
- Joined: Sept. 2011
- Offline
I used different mapping for UV's for this kind of geometry I usually do plastic wrap mapping which does what you might think it does. But usually I do UV's in (manually) with other software.. ops:
I also removed the attribute transfer since VDB retains the UV's if you connect the original mesh to the second input of your VDB Convert
I also removed the attribute transfer since VDB retains the UV's if you connect the original mesh to the second input of your VDB Convert
- MagnusL3D
- Member
- 1110 posts
- Joined: Aug. 2008
- Offline
@ndickson, Not sure if I am the right person to writes awesome AttribWrangle code But I agree it would be awesome to have it solved, specially if Houdini is looking to be more game contenty.
@Johnnycore, I had missed that you could do that with the VDB Convert, however it also creates stretched seams, so if you have a more realistic good UV-mapped object as input you get the exact same issues as with the Attribute Transfer solution
@Johnnycore, I had missed that you could do that with the VDB Convert, however it also creates stretched seams, so if you have a more realistic good UV-mapped object as input you get the exact same issues as with the Attribute Transfer solution
- MagnusL3D
- Member
- 1110 posts
- Joined: Aug. 2008
- Offline
I came up with a solution where i use the Connectivity SOP, using the “Use UV Connectivity” on the lo-poly mesh, then using a attribute transfer SOP to transfer that attribute to the hi-res mesh. and then with a foreach set to “each attribute value” running through and doing a attribute UV transfer between the hi and lo res. Seems rather stable sofar.
- vleermeneer
- Member
- 245 posts
- Joined: Sept. 2011
- Offline
- MagnusL3D
- Member
- 1110 posts
- Joined: Aug. 2008
- Offline
And if you where wondering what I was going to use this for, here is a small “demo” video of my spare time project:
http://vimeo.com/79575816 [vimeo.com]
http://vimeo.com/79575816 [vimeo.com]
- vleermeneer
- Member
- 245 posts
- Joined: Sept. 2011
- Offline
- MagnusL3D
- Member
- 1110 posts
- Joined: Aug. 2008
- Offline
- Sadjad Rabiee
- Member
- 1391 posts
- Joined: Dec. 2010
- Offline
- benco
- Member
- 35 posts
- Joined: July 2005
- Offline
Hi there,
I'm wondering if anyone can provide me a small file that illustrate the process explain here
“I came up with a solution where i use the Connectivity SOP, using the ”Use UV Connectivity“ on the lo-poly mesh, then using a attribute transfer SOP to transfer that attribute to the hi-res mesh. and then with a foreach set to ”each attribute value“ running through and doing a attribute UV transfer between the hi and lo res. Seems rather stable sofar.”
I tried to to do the same type of connection but still have the seams problem.
Cheers
I'm wondering if anyone can provide me a small file that illustrate the process explain here
“I came up with a solution where i use the Connectivity SOP, using the ”Use UV Connectivity“ on the lo-poly mesh, then using a attribute transfer SOP to transfer that attribute to the hi-res mesh. and then with a foreach set to ”each attribute value“ running through and doing a attribute UV transfer between the hi and lo res. Seems rather stable sofar.”
I tried to to do the same type of connection but still have the seams problem.
Cheers
- lkruel
- Member
- 240 posts
- Joined: Nov. 2012
- Offline
Just ran into this so I wanted to share the solution for future reference. The trick for me was to generate the UV connectivity attribute, and then do a transfer attribute with that attribute.
That way in the foreach I can isolate the chunks of the 2 meshes that match based on the UV shell, and transfer the UVs only to those areas of the mesh.
I'm sure there are different ways of doing it using groups, but this brute force approach worked for me. I've attached a file with an example solution.
That way in the foreach I can isolate the chunks of the 2 meshes that match based on the UV shell, and transfer the UVs only to those areas of the mesh.
I'm sure there are different ways of doing it using groups, but this brute force approach worked for me. I've attached a file with an example solution.
Luiz Kruel
Senior Technical Artist
SideFX
Senior Technical Artist
SideFX
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
Another approach which has worked quite a bit for me (which may be a bit faster than the forloop method) is (inside of a point or vertex vop) to use XYZDistance VOP, and use the original UV island ID as a group filter in the group input plug. This will filter the XYZ distance query with only faces which contain that attribute (use a bind VOP to bring the original uv island attribute, then feed it to the first input of a print VOP with the following string: @someIslandAttrib==%, and feed the string output of the print VOP into the group input of the XYZDistance)
After that, feed the primitive number and UV intersection location (not to be confused with your UV attribute) into a Primitive Attribute VOP, and have it return the UV attribute at the intersection point.
This method also has the advantage that it returns the UVs at fragment locations of polygons (at a primitive's U and V position) and its very fast
Since group inputs have been added to several vops, this has removed many reasons to have to forloop things!
After that, feed the primitive number and UV intersection location (not to be confused with your UV attribute) into a Primitive Attribute VOP, and have it return the UV attribute at the intersection point.
This method also has the advantage that it returns the UVs at fragment locations of polygons (at a primitive's U and V position) and its very fast
Since group inputs have been added to several vops, this has removed many reasons to have to forloop things!
-G
- DASD
- Member
- 453 posts
- Joined: Feb. 2013
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
Hey DASD, I did notice in my message I said to use bind to import class into the vop, but in reality you have to use get attribute with the prim num been feed into it as class (or island) is a primitive attribute sorry about that!
I added a few extra comments:
- you still need to transfer class to the VDB mesh in this method
- you should still use XYZDistance to do so on a prim vop as this is faster and more accurate than attribute transfer
- your point vop should be a vertex vop since your uvs are on vertices and not points
Included the file with the new method! let me know if you have any questions
I added a few extra comments:
- you still need to transfer class to the VDB mesh in this method
- you should still use XYZDistance to do so on a prim vop as this is faster and more accurate than attribute transfer
- your point vop should be a vertex vop since your uvs are on vertices and not points
Included the file with the new method! let me know if you have any questions
-G
- DASD
- Member
- 453 posts
- Joined: Feb. 2013
- Offline
@grayOlorin
Thank you! Works great!
I tried to promote the class attribute to vertices so that I could potentially do all operations in one vopsop. - Primarily for learning purposes. The task of combining the two vopsops seemed rather trivial, but I couldn't get it to work. It works in two steps, but not in one. (See attached file.)
I suppose I misunderstand the way the vopsop processes the data, or I just failed to adjust something. I guess the problem lies in the empty group parameter on the XYZDistance node.
It seems that the vertex-based approach gives worse results anyways. I guess the primitive based sampling checks distance from primitive (polygon) center to primitive (polygon) center and gets a smoother selection because of it.
Anyways very interesting stuff.
Maybe SideFX should update the attribute transfer SOP? :wink:
Thank you! Works great!
I tried to promote the class attribute to vertices so that I could potentially do all operations in one vopsop. - Primarily for learning purposes. The task of combining the two vopsops seemed rather trivial, but I couldn't get it to work. It works in two steps, but not in one. (See attached file.)
I suppose I misunderstand the way the vopsop processes the data, or I just failed to adjust something. I guess the problem lies in the empty group parameter on the XYZDistance node.
It seems that the vertex-based approach gives worse results anyways. I guess the primitive based sampling checks distance from primitive (polygon) center to primitive (polygon) center and gets a smoother selection because of it.
Anyways very interesting stuff.
you should still use XYZDistance to do so on a prim vop as this is faster and more accurate than attribute transferI guess your approach is more accurate than a simple attribute transfer precisely because of the way the XYZDistance node samples the primitives?
Maybe SideFX should update the attribute transfer SOP? :wink:
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
I guess your approach is more accurate than a simple attribute transfer precisely because of the way the XYZDistance node samples the primitives?
yup! XYZDistance gets any attribute (point/prim/vertex) at the interpolated value of a fragment of the primitive which is really nice!
Maybe SideFX should update the attribute transfer SOP? Wink
I believe if you want a SOP close equivalent, that would be the Ray SOP for each of the geo sampling VOPs, I have found these to be close SOP equivalents (albeit some slight differences such as the specific kernel methods of attribute transfer, and the ability of Point Cloud Open to filter the query by normals) :
- Attribute Transfer SOP ~= Point Cloud Open VOP (with PC Filter) or Point Cloud Find
- Ray SOP (in Project Rays Method and a single sample) ~= Intersect VOP
- Ray SOP (in Minimun Distance Method) ~= XYZDistance VOP
I tend to favor the VOP ones just because of their multithreading and more atomical controls, but sometimes I do still use Ray and Attribute Transfer depending on what I am doing
-G
-
- Quick Links