MoI discussion forum
MoI discussion forum

Full Version: MoI UV fix - Houdini

From: PaQ
16 Jan 2023   [#1]
CADuvFIX : This HDA will fix the uv's generated by MoI.

UV's are actually inherited from Nurbs surface when exporting a model, and are uniform along 0-1 UV space, no matter the real surface area. The result are uv's that are stretched in U or V direction for any surface that doesn't perfectly fit in a square.

- The tool will try to detect in what direction the uv's are stretched, and fix the distortion accordingly. It doesn't use any kind of unwarping and only uses the existing uv's.
- It will also fix the texel density along all the surfaces.
- It will fix flipped uv that can happen here and there.

The tool is at an early dev stage, there is no optimizing done and the setup is just focused on the result, no smart vex coding here. (the large engine model take around 15sec to process on an heavy multi-core machine).
It does expect the mesh to be exported from MoI with "weld vertices along edges" disabled as it needs to loop on every connected surface. (N and uv are thus on points, there is no data class check for the moment).









Image Attachments:
03_CrTest.JPG  03_CrTest_Fix.JPG  04_Engine.JPG  04_Engine_Fix.JPG 


From: PaQ
16 Jan 2023   [#2] In reply to [#1]
(require Houdini 19.5, .hda in attachement)
From: Frank (FRANK_ART)
25 Jan 2023   [#3]
This is actually super cool, I'm having problems to unwrap and have decent UV on models done in Moi. Unfortunately I dont use Houdini but blender. I kindly ask here to Michael or any other developer: is it possible to have a script or an addon for moi that perform the same concept that PaQ did on Houdini? It will be an awesome feature !!!
Thanks for sharing this process :)
From: Michael Gibson
25 Jan 2023   [#4] In reply to [#3]
Hi Frank,

re:
> I kindly ask here to Michael or any other developer: is it possible to have a script or an
> addon for moi that perform the same concept that PaQ did on Houdini?

I don't think so - there is not currently a way for a script to access and modify the UV coordinates inside of MoI.

- Michael
From: Frank (FRANK_ART)
26 Jan 2023   [#5] In reply to [#4]
Hi Michael,
thanks for the quick reply. Oki, so then I wish you may consider it integrate that concept in potential future release of Moi :) (... I have no idea of what I'm wishing in term of time /developing budget). At your knowledge today whats the best way to get decent unwraps on moi models?
Cheers
Frank
From: Michael Gibson
26 Jan 2023   [#6] In reply to [#5]
Hi Frank,

re:
> (... I have no idea of what I'm wishing in term of time /developing budget).

Hard to say, maybe a year of work or something to design an API that would be so comprehensive to be able to get all the way down to modifying UV coordinates that are only being generated as part of the export process.


> At your knowledge today whats the best way to get decent unwraps on moi models?

I think many people throw out the auto generated ones from MoI and use whatever is in their main poly modeling program.

There's a function in Blender, something like "Average UV islands" that could probably process the MoI-generated UV coordinates too.

- Michael
From: 2byts
31 Jan 2023   [#7]
this is awesome! Thanx a lot for the share.

I was doing something similar for UV layout into UDIMs based on materials
From: pior (PIOR_O)
4 Feb 2023   [#8]
Hello Paq,

Would you mind sharing one of these models (let's say, something of medium complexity), with and without your fix applied ? I'd be very curious to see what it takes to get to the same result in Blender, and would love to try it out.
From: PaQ
13 May 2023   [#9] In reply to [#8]
Hi Prior,

Sure, sorry for the delay, I missed the notification.
In the meantime here's an updated version, using a lame brute force approach to reduce the stretching ... it seems to work better than the one made with my bad trigonometry / vector skills.



Does is works better than tagging / unwarp edge using existing MoI uv's boundaries ?

Short reply : NO

Long reply :

1) I'm facing a lot of Hou crash whit the Flatten method ... as I'm only manipulate existing data here, the 'tool' is quite robust.
2) 90% of the uv's coming from MoI are actually good, except they are stretched in u or v direction. They are also perfectly grid aligned : torus shape or tubes output a 'perfect' aligned rectangle, helping the packing process to maximize uv space.

Ultimately I could add a last check that will re-flatten the island that are still too distorted (easy), but I will only do it once I resolve the uv-flatten crash on some of those surfaces.

Image Attachments:
CaduvFIX2.JPG 


From: PaQ
10 Jan   [#10]
Hello, here's an updated version, using the last feature from Moi5 Beta to generate proper surface ID.
That's about the third time I rebuild this tool, the execution time is almost instant, and there is no more iteration to "find" the best value.
Create the layout / udim however can still take a few second / minutes depending of the number of surfaces (using native Hou UVLayout).

https://www.youtube.com/watch?v=XbGfRWSs-uw

Build on Houdini 20.0.547

Attachments:
sop_qwak.CADuvFIX_MoI5.1.0.hdalc


From: Frenchy Pilou (PILOU)
10 Jan   [#11]
Cool!
From: Grendel
11 Jan   [#12]
PaQ, would this work with Houdini Apprentice?
From: PaQ
11 Jan   [#13] In reply to [#12]
It should yes, however the geo output options are quite limited (ROP operators are disabled IIRC). You can only export geo by right click on a node and select export geo ... and in the case of apprentice only .obj works, and I'm not 100% sure uv's are preserved. But I haven't used apprentice since a while !