Texture Coordinate Creation Trouble!

Hi there!

I want to write a little tool that makes texturing easier: given a dxf file, the program should “unfold” the model, create a template bitmap and calculate the texture coords.

“Unfold” means that the model’s polygons are placed on a single plane, like unfolding a paper box.

This unfolding thing is also the main problem: I don’t have a clue how to do it! So, please, please help me.

Steffen

Hm, actually I never tried that, but
this should work.

-Find the vertex that has the (for example) smallest z value.
-Make this vertex the object origin
-rotate each other vertex (x/y) to this z plane (if the x or y coord is bigger than positive else negative rotation).

Well, MAY work for convex objects only

Hope that helped (a bit)

LG

Thanks, I’ll have a try…

Steffen,

I did something similar for skinning general polygonal models (I used quake 2 md2 models) for bump mapping. The work is not yet published, but Mark Kilgard included a couple of snapshot in a presentation on the NVIDIA web site. If you download the presentation “How to Bump Map a Skinned Polygonal Model,” pages 15 and 30 are snapshots from my demo.

I’m not sure when I will get this demo out, but contact me offline if you’d like to know more about the triangle re-orientation and packing.
Cass

Upppppppppppsssssss, (I did it again)

Sorry, Steffen, I am afraid that I did not thought that throught.

Forget about my first post, instead try this:

  1. find the vertex with (for example) the lowest z value and make it the origin.
  2. rotate all verticies of all triangles that share that initial vertex to the same z value (using the rotate I describe in my first post)
  3. take another (intial) vertex of an triangle that shared the vertex described in 1.) and perform the same on it. It is an recursion (is this spelled right?)

Anyway you will figure it out

Best regards,

LG

Hi!

Cass, I’m downloading the presentation you mentioned at the moment and will have a close look at it soon. Thank you.

Lgrosshenning, although I haven’t tried your method yet I have the feeling it should work. I’ll try it soon,

thank you all,
Steffen

I haven’t noticed anyone using the “img” ubb feature before, but I figured I’d try it.

This picture was generated
http://www.r3.nu/~cass/model_reskin/model_reskin_bump_1.jpg

using this texture for the normal map.
http://www.r3.nu/~cass/model_reskin/model_reskin_bump_2.jpg

All of the triangles in the model are rotated and translated into the z=0 plane
and translated in x,y to pack them. The packing algorithm I used is obviously not very efficient.

Note: the “img” tag is not enabled…

[This message has been edited by cass (edited 06-09-2000).]

Cass, the polygons in the normal map you mentioned are not connected to each other…

I think it would be hard to design a texture if one has no direct connection between pixels that are next to each other.

So to say, I’d like to create texture maps that look like the standard texture maps of quake 2 models, e.g. polygons that are connected to each other stay connected.

I hope you could follow my weird thoughts… :slight_smile:
Does anyone have an idea how to solve this?

Best regards,
Steffen

Check this out: http://home.pb.net/~stevecox/uvmapper.htm
Dunno if that works for DXF, though.

The basic idea of unfolding geometry is rather difficult and there are books about how to unfold industrial packages and stuff.

For skinning bipeds, the texture will normally applied per parts with a cylindrical projection. That works good enough for arms, legs, and torso. The head gets artifacts on the top, but hair isn’t that regular, so what.

Have fun.

Hi Steffen!

Hm, do you want to use a texture to wrap around one convex object (for example a moon texture around an asteroid)? Then you should
use spherical texture mapping.

I cant recall the formula (and being to lazy to search my books), but you should be able to track it down.

If this is wrong, could be please more specific about what kind of texture (does it contain subtextures) to what kind of object (convex, concave or complex)?

Only then the community can give your better help than only suggestions based on a “best-guess” basis.

Regards,

LG

Hi!

I’m sorry for my unclear questioning. So, here’s a second try:

I want to put a normal 2D texture (no subtextures or anything) on a complex 3D model consisting of triangles.
I want to ‘unfold’ this model so that triangles that were connected stay connected most times.

The final texture bitmap should look (a little) like the textures in Quake2.

I hope this was better to understand… besides, I start to doubt that this ‘unfolding’ thing is possible in an acceptable ammount of time…

Best wishes,
Steffen