PDA

View Full Version : Attn: Masters of Max. UVW Unwrap question


Cynical_Saint
08-18-2003, 10:47 PM
Hey guys. I am having some difficulties with a third party program in Beta, that exports files for a game.

The problem we are having has to do with UV mapping.

Apparently the way I understand it, for the final game export, each Vertex needs to have only one texture coordinate.

However, when doing a UVW unwrap, the same vertex can be located on two parts of a map based upon different original mappings.

I have real trouble explaining so here is a Cube, that has been UVW unwrapped. The red dots are vertices. I am using the blue vertices for the example. On a welded cube, the three blue points are actually 1 vertex. The UVW just shows it in 3 diff places for the purpose of the unwrap. NOW, the file format we are exporting to requires each vertice to only have one Texture coordinate. In the below example, 1 vertex obviously has three coordinates. As a work around we were exporting to 3ds and re-importing. All this does is basically break this vertex into 3 seperate vertices. Which DOES work for our purposes, however it of course breaks the smoothing across those edges.

So the question is, does anyone know of a way to have the vertices broken, but still get smoothing across the edge?

Thanks in advance.

Cynical_Saint
08-18-2003, 10:49 PM
Stupid image didnt upload. HEre it is.

NickDW
08-18-2003, 11:13 PM
Those dots on the corners aren't actually Vertices but rather UV coordinates. That's fine like that because you could never get all the UV's together and not have the texture stretched and distorted on the model.

I suggest posting the UV map for the model or maybe the Max file so someone could tell you for sure though if anything is messed up and how to fix it.

Cynical_Saint
08-18-2003, 11:55 PM
The same concept goes for the above pic. Regardless of texture map if you uvw unwrap a cube like the above you will see what I mean.

Those dots are representations of the vertices of the model. The problem is that for our purposes each vertice can only have ONE set of UV coords. but when you unwrap a cube like in the above, some of the vertices have up to 3 sets of UV coordinates. The reason exporting to 3ds and back into max fixes the problem is that any vertex that has more than one UV coord, gets broken up into several vertices, each with only one UV coord. As an adverse side-effect, since the vertices get broken apart in export, it also seperates the mesh and therefor smoothing will not work over that vertex/edge.

Does that make a little more sense as to what the problem is? As a test, you could create a cube, it should be 8 vertices. Then uv map it and unwrap just like the above. If you then export to 3ds and import it back, you will see that your vertex count will be higher because it seperated some of the vertices due to the UVW mapping.

Stroker
08-19-2003, 12:39 AM
Sounds like you are misconceptioning or something.
Verts maybe on top of each other and appear to be one vert, but they are still separate verts.
For example, a cube actually has 36 verts total.
1 tri = 3 verts
1 quad = 2 tris
1 cube = 8 quads
total verts = 2 * 3 * 8 = 36

So, one vert does not have 3 different uv coords. What you are seeing is a bunch of overlapping verts that have been separated. They might occupy the same space in the mesh and appear to be one vert, but they are actually several verts.

Umm...

When I import a 3DS file, I'm usually select all verts and weld selected. Once the verts are welded, all is good with smoothing groups and junk. Might be a long way to fix what should be a non-existant problem, but it has to be done until that foible gets fixed.

EricChadwick
08-19-2003, 12:56 AM
Sounds to me like the game exporter is not designed well. Many support multiple UVs per vertex. If the exporter is built on the .3ds format however, then it's a design flaw... .3ds only supports one per vert.

Some exporters will auto-weld coincident verts for you. Maybe they can add this feature.

Cynical_Saint
08-19-2003, 12:59 AM
That doesn't sound completely accurate. If you weld all the verts that occupy the same space, then the mesh only has 8 verts. If you check any of the file properties, this is still holds true.

So our problem is that on Export, our mesh needs to have 1 UV for each vert in the list. The cube as mapped in the example pic has a total of 14 verts and 14 corresponding UV coords. However that leaves 6 verts un-welded that occupy an exact same position as 6 others. The result is no smoothing over those edges. If you weld those verts and keep the mapping, you then have 8 verts like you should, however there are 14 uv coords. 6 of those verts now have 2 seperate UV coords.

Cynical_Saint
08-19-2003, 01:00 AM
I am obviously not the coder, but apparently it is the game file format that requires 1 UV per Vert.

I will confirm this but I think that is the crux of the issue.

NickDW
08-19-2003, 01:06 AM
Ok try thinking of each of those blue dots as being the same UV since they occupy the same space on the model.

Cynical_Saint
08-19-2003, 05:01 AM
Ok, let me simplify this.

http://home.carolina.rr.com/cynical/example.jpg

In the above pic a car mesh has been flattened using UVW unwrap for texturing. The blue dots are actually welded to each other. However, because of the file format limitations of the game engine, those vertices cannot be welded. So, when the model is exported to 3ds and back into max, it breaks those vertices apart.

Ok, so far we are fine. Now the problem is, since it is seperating each vertex into two vertices, it is recalculating the vertex normals and thus, the edge between the hood and fender is not smoothing.

What we need to figure out how to do, is to seperate those vertices, but lock the normals in place before doing so. This way, we can have two vertices occupying the same point, but also keeping the smooth group on top of the fender.

So, I guess my real question should be, how can I lock a vertex normal, break into two vertices, and still have a smooth edge. I have tried Edit Normals, but it limits how I can edit the normal of the vertex, plus when I collapse it, it collapses to and editable poly. I need it to be a mesh, if I collapse again to editable mesh, it automatically repositions the normals.

Does this make a little more sense than all of the above?

Like I said I am not that good at explaining. :)

EricChadwick
08-19-2003, 02:39 PM
3ds max doesn't have good native support for adjusting normals. You need to make your own normals adjustment plugin, or run it outside max (most people do this in my experience).

You might be able to create normal maps to hide the seam. If you make these right, then the non-welded edges of the car hood would have the same normals. Do you support normal mapping?

However, as far as I see it he .3ds format is really the problem here. We used to use it, but found it way too limiting. It seemed like a good choice at the start, lots of software exports/imports it, format has been around awhile, etc. But it proved too much trouble in the end... the UV problem, the 8.3 texture filename problem, too limiting in other ways, bones weren't great, vertex animation not good either. We created our own 3d format in the end, now we're much better off.

Sorry this isn't much help. Maybe you can lobby for the use of another intermediate 3D format?

Cynical_Saint
08-19-2003, 04:59 PM
Actually the conversion to 3ds was a temp solution before we really knew what the problem was.

Our plan of attack now is to create a script that will allow us to select a vertex along the seam, copy its normal, then break it and paste the normal to the two/three new vertices created.

Support of Normal mapping would be an obvious advantage, but the file format is pretty simplistic so we have to work with what we've got.

Thanks for the help, I will update if/when the script does what it is supposed to.

:)

CGTalk Moderation
01-15-2006, 10:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.