PDA

View Full Version : Texture problem (u,v)



Elixer
12-09-2000, 01:00 AM
My program works fine if I make the models myself, but when I tried a few models I got off the net, they don't appear to have any texture coordinates (u,v), or a very low # (like 5 or less). Is there a easy way to fix this? Because as it is now, if I go to change the texture of the model, instead of the texture showing, it usually is a solid color, and the only reason I can think of it is doing this is because of the low (u,v).

Just to make sure it wasn't my program, I tried 3D Exploration, and tried to modify the textures using that program, and it does the same thing.

I really like the models, but they are useless if I can't figure out a way to add textures to them!!

Ideas?

12-09-2000, 07:20 AM
What kind of models? .md2? .3ds? .wrl?

Elixer
12-09-2000, 10:12 AM
They are .3ds files, but I can convert them to whatever else 3D exploration supports.

zedus
12-10-2000, 03:07 AM
you should remember to convert the numbers to numbers that opengl accepts. For example I use opengl float texture mapping so the values are 0 - 1 float. if the your model's u,v coordinates are 0 - 256 I must convert them to to 0 - 1 and some format the y direction is the opposite so if the number I got was N then I must use it as 1-N.
first of all convert the u,v values to values that opengl will understand correctly and then check the y,x directions (probably you wouldn't need to do that - but sometimes it solves a huge headache...)
I hope this helps, if I wasn't clear anough please ask again and I'll try to be more clear.

Spark
12-10-2000, 05:41 AM
I'm using .3ds files in my engine and the uv coordinates works fine. The problem is if the creator didn't create mapping coordinates for the model. If this happens you must either use the "UVW map" tool in 3ds max or calculate the coordinates yourself.

zedus
12-10-2000, 08:14 AM
I'm using md2 format and There are plenty of texturing programs to that format - you might want to consider using such format, or any game model format that programs like milkshape supports.

Elixer
12-10-2000, 02:24 PM
Yeah, that is the problem, they didn't create texture coordinates in the file in the first place. I don't got 3dmax, so I can't use that tool.

I will look into using the .md2 format, but that would involve major changes to my code.

I guess I will have to hunt for a UV mapper that is generic, and doesn't require 3dsmax.

12-10-2000, 04:45 PM
One problem with 3DSMax is that, unless you
have some custom plug-in that does it, it
does not have any handling for per-vertex
texture coordinates. Instead, you assign U/V
to the object using spheric, cylindrical,
cubic, planar, or some other such geometric
mapping, and then fix/stretch it up in the
texture (and usually end up with very large
textures)

I guess this is OK when you use 3DSMax for
its original purpose, rendering animation,
but it gets in the way of doing game stuff.
You pretty much NEED some other solution for
texture mapping.

It also doesn't show the texture in the
preview window; you have to render to see it.

One thing you could do is to simply wrap your
texture space around your mesh (depending on
how complex it is) with cylindrical or
spherical mapping.