|
OBJ file with UVs
About Truespace Archives
These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.
They are retained here for archive purposes only.
OBJ file with UVs // SDK, Plug-in & 3rd Party Area
Post by Jack Edwards // Mar 30, 2009, 11:27am
Jack Edwards
Total Posts: 4062
|
Cool looks like you've got it.
The Constant shader is in the Garage:
http://forums1.caligari.com/truespace/showthread.php?t=4036
You can also use the Texture material from the DX library. And there's a grid bitmap with an arrow on it that would be ok for UV checking that is in the default tS bitmap library. |
Post by frootee // Mar 30, 2009, 11:37am
frootee
Total Posts: 2667
|
Thanks Jack. |
Post by Nez // Mar 30, 2009, 10:02pm
Nez
Total Posts: 1102
|
This is one of the default reference grid images that comes with tS to save you looking... |
Post by frootee // Mar 31, 2009, 12:27am
frootee
Total Posts: 2667
|
Nice thanks Nez. :) |
Post by frootee // Mar 31, 2009, 5:05am
frootee
Total Posts: 2667
|
It looks like the uv map needs to be flipped (not rotated), since WS uses left handed orientation.
If you consider the UV map editor to be a transparent sheet, with the map printed on it, Flip it so you see the other side of the sheet. When you do this, the uv map appears in the correct orientation.
This is just an observation, comparing LUUV uv maps to WS uv maps. I'll need to try this with a few more objects and uv maps to be sure.
The code I reviewed last night appears to check out ok: the uv indices are correctly associated with triangle indices in all cases. Of course, there could be something else in the code, which I'll check. |
Post by frootee // Mar 31, 2009, 6:12am
frootee
Total Posts: 2667
|
using:
1 - V
almost works; I think the WInnie mesh needs to be Reverse-Handed on import and it should be fine.
The UV map Is inverted. Perhaps sometimes this is needed, sometimes not. |
Post by jamesmc // Mar 31, 2009, 6:24am
jamesmc
Total Posts: 2566
|
Looks like my prediction in my post at:
http://forums1.caligari.com/truespace/showpost.php?p=98074&postcount=2
came true. :)
It appears you are making great progress. Will be super to get that importer/exporter on the WS side! :jumpy: |
Post by frootee // Mar 31, 2009, 6:53am
frootee
Total Posts: 2667
|
Thanks James.
Question: Under what circumstances would a texture be flipped AND reversed? Or do you mean:
the texture could be:
a) Reversed
or
b) Flipped
?
I am thinking, this would happen if the axis orientation differs between WS and the other application; i.e., if the other app uses a Right Hand Axis orientation. WS uses a Left Hand Axis orientation (terminology may be wrong).
I'll post a pic in a second.
EDIT:
Here's the pic.
On the left, is Tiles's Winnie mesh, imported using LUUV.
In the Middle, is the Winnie mesh, without using the 'Reverse Handedness' option of the WS OBJ Importer.
Notice the shoe coloring: the green sock is on the Right Foot, whereas the green sock is on the Left foot, of the LUUV imported mesh.
On the right, is the Winnie mesh, using the 'Reverse Handedness' option of the WS OBJ importer. Notice again the sock colors. The Red sock is on the Right foot, and the Green sock is on the Left foot; as they are on the LUUV imported mesh. |
Post by jamesmc // Mar 31, 2009, 6:59am
jamesmc
Total Posts: 2566
|
I guess the flipping and reverse happens quite a bit. Most UV mappers have a facility to flip the texture.
In another program, in just apply a texture map, it has a small graphical interface for handling the flipping and rotating the texture. (Carrara) |
Post by frootee // Mar 31, 2009, 7:03am
frootee
Total Posts: 2667
|
Ah ok cool thanks James.
Does the WS UV editor have such an option? I have not checked yet.
EDIT: Looks like it does, but it requires a selection first.
Cool. So it looks like my code is fine then. Phew. |
Post by RAYMAN // Mar 31, 2009, 7:06am
RAYMAN
Total Posts: 1496
|
Theres another one that constantly has the problem of building uv´s
flipped horizontally thats Zbrush you have to flip first before you go to
Truespace with your freshly made uv´s......;) |
Post by jamesmc // Mar 31, 2009, 7:23am
jamesmc
Total Posts: 2566
|
Just in case, thought of something that is helpful for OBJ imports.
On the LUUV importer, it has a tick box for "Preserve Groups."
This keeps all groups in place and accepts the name of the groups, so one doesn't have to rename them again. Quite handy. |
Post by RAYMAN // Mar 31, 2009, 7:30am
RAYMAN
Total Posts: 1496
|
I would go even further and say it would be good to have group by materials too ! |
Post by frootee // Mar 31, 2009, 7:41am
frootee
Total Posts: 2667
|
Thanks Rayman and Jamesmc.
Maybe it's a good idea then, to add to the importer dialog:
1) checkbox for: flip uv's vertically
2) checkbox for: flip uv's horizontally
that way you don't have to flip uv's from within ZBrush.
You just have to select the checkbox on the importer dialog.
Yes, groups are on the list, and I do intend to try to group by materials and, group by mesh. Some of the objects I've seen have a lot of group names though, so some thought will have to go into this. I may have to limit the grouping options; I need to investigate it.
Since the OBJ importer appears to be reading uv's and attaching them correctly, the next step is to automate the process. Currently, for testing, I load an object using LUUV, then do the same using the WS OBJ importer. Then, manually copy-drag the material from the LUUV'd object into the WS OBJ'd object. This was for testing only; I was determining whether the uv import code works. It does, so on to automation process.
I think the UV process was the most difficult thus far since I've never dealt with uv's before.
I need to fix up the edge flags as well.
So on the list I have:
1) Materials: Automatic creation
2) grouping
3) edge flags
And I think that's about it. And testing of course. :)
Anything else? |
Post by jamesmc // Mar 31, 2009, 8:02am
jamesmc
Total Posts: 2566
|
Here's some interfaces from other programs that might give some input on what could be done. (for OBJ import) |
Post by frootee // Mar 31, 2009, 8:06am
frootee
Total Posts: 2667
|
Cool thanks james. Quite a bit of good stuff there to work with. :) |
Post by jamesmc // Mar 31, 2009, 8:19am
jamesmc
Total Posts: 2566
|
Here's some export option examples from other programs. |
Post by frootee // Mar 31, 2009, 12:41pm
frootee
Total Posts: 2667
|
Ok Sweet.
I got the edge flags working.
Although the mesh is triangulated on import, we see the original mesh (i.e. Not Triangulated).
If we want to see the triangulation we can enable that in the mesh editor. |
Post by Jack Edwards // Mar 31, 2009, 1:27pm
Jack Edwards
Total Posts: 4062
|
I suspect that the edge flags issue was a large part of your geometry problems Froo. Glad to see you got that working! :jumpy: |
Post by frootee // Mar 31, 2009, 2:07pm
frootee
Total Posts: 2667
|
Thanks Jack.
Do you think edge flags have something to do with reversing the order of the vertices for triangulation? |
Post by Jack Edwards // Mar 31, 2009, 2:26pm
Jack Edwards
Total Posts: 4062
|
Not sure, but because of the geometry consistency checking that was added to the internal tS code to prevent crashing on bad geometry it's possible that bad edge flags could cause tS to modify the geometry to something "legal".
I was under the impression that the vertex reversing was necessary because of situations where your code failed to find a projection plane that didn't align all the vertices along a single vector when projected to 2D? It seemed like an odd solution to me, but hey if it works. ;) Also the problem with reversing the vertex order is that it probably inverts the normal for that face... |
Post by frootee // Mar 31, 2009, 3:02pm
frootee
Total Posts: 2667
|
yes that is correct Jack. When I loaded the triangulator with the vertices of a face in counterclockwise order, then triangulated, the triangle count would be wrong.
Then, if I re-loaded the triangulator with those same vertices in reverse (clockwise) order, the triangle count was correct.
I'll have to double check the face normals, to make sure they are correctly oriented. |
|