UV from Hi to Lo poly ?

   20029   26   9
User Avatar
Member
1104 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 !

Attachments:
Houdini_Hi_to_Lo.hipnc (124.7 KB)

/M

Personal Houdini test videos, http://vimeo.com/magnusl3d/ [vimeo.com]
User Avatar
Member
1104 posts
Joined: Aug. 2008
Offline
I guess this is a very tricky matter.
/M

Personal Houdini test videos, http://vimeo.com/magnusl3d/ [vimeo.com]
User Avatar
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]
User Avatar
Member
1104 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
/M

Personal Houdini test videos, http://vimeo.com/magnusl3d/ [vimeo.com]
User Avatar
Member
1743 posts
Joined: March 2012
Offline
MagnusL3D
That sounds like the AttributeTransfer wont solve this at all then ?
It is *supposed* to solve this; it just often doesn't.

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]
User Avatar
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

Attachments:
houdini_hi_to_lo_better.hipnc (124.8 KB)

User Avatar
Member
1104 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
/M

Personal Houdini test videos, http://vimeo.com/magnusl3d/ [vimeo.com]
User Avatar
Member
1104 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.

Attachments:
Destruct4.jpg (697.0 KB)

/M

Personal Houdini test videos, http://vimeo.com/magnusl3d/ [vimeo.com]
User Avatar
Member
245 posts
Joined: Sept. 2011
Offline
wow thats really nice man
I was looking in the connectivity sop today but could get it to work like that, great job man!
User Avatar
Member
1104 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]
/M

Personal Houdini test videos, http://vimeo.com/magnusl3d/ [vimeo.com]
User Avatar
Member
245 posts
Joined: Sept. 2011
Offline
Looks really great!
I really love VDB
User Avatar
Member
1104 posts
Joined: Aug. 2008
Offline
Hey, Thanks ! yeah I love em to, so fast and ..ehm..useful
/M

Personal Houdini test videos, http://vimeo.com/magnusl3d/ [vimeo.com]
User Avatar
Member
1391 posts
Joined: Dec. 2010
Offline
That's Great Tool
https://www.youtube.com/c/sadjadrabiee [www.youtube.com]
Rabiee.Sadjad@Gmail.Com
User Avatar
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
User Avatar
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.

Attachments:
uv_transfer_example.hipnc (217.5 KB)

Luiz Kruel
Senior Technical Artist
SideFX
User Avatar
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!
-G
User Avatar
Member
453 posts
Joined: Feb. 2013
Online
Thank you grayOlorin, that was very interesting! I tried to recreate the process (and got it to do one UV island), but I seem to have made a mistake somewhere. Could you please have a look:

Attachments:
uv_transfer_example_200_alpha.hipnc.hiplc (241.3 KB)

User Avatar
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

Attachments:
uv_transfer_example_200_alpha_FIX.hiplc (264.5 KB)

-G
User Avatar
Member
453 posts
Joined: Feb. 2013
Online
@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.

you should still use XYZDistance to do so on a prim vop as this is faster and more accurate than attribute transfer
I 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:

Attachments:
uv_transfer_example_201_alpha_FIX.hiplc (331.6 KB)

User Avatar
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