THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/02/2008 at 10:01, xxxxxxxx wrote:
_"I had a look at the GenerateUVW() function and the way you used it, think it helps me out here. Thank you!
Calculating the UVW's on my own always inverted the texture..."
_
The GenerateUVW() function (used the way I did) can help when other mapping types are set in the Texture Tags on your objects, and/or when those tags have scaling/offset values set in them. As for the inverted part, the UVs may be flipped vertically from what you want, either way... so you may (still) have to invert the v value before you export:
--------------- S N I P --------------
typedef struct _UVCoord {
Real u;
Real v;
Real w;
} UVCoord;
UVCoord a, b, c, d;
uvw = uvTag->Get(i);
a.u = uvw.a.x;
b.u = uvw.b.x;
c.u = uvw.c.x;
d.u = uvw.d.x;
a.v = 1.0-uvw.a.y;
b.v = 1.0-uvw.b.y;
c.v = 1.0-uvw.c.y;
d.v = 1.0-uvw.d.y;
...etc...
--------------- S N I P --------------
"I think i read sth in your Riptide changelog about killing duplicates, and it would be great if you could tell me how you achieved it!"
Yes, most of your UVs and many of your Normals will be duplicates, since most of your polygons share common points/edges and may be on the same plane. My code just does a brute-force scan through the polygon/face list, looking at the uv/normal vertices, keeping track of (and removing) duplicates and adjusting the index values of all the polygons as it goes.
Frankly, that code took some effort to come up with and I'm a bit reluctant to post it here in the forum, but if you get hung up, send me an e-mail (typhoon at jetbroadband dot com).
Keith