Wrapping a texture round the edge of a cylinder

Started by
5 comments, last by jollyjeffers 17 years, 6 months ago
Hi all, I wish to wrap a texture around the edge of a cylinder. Here are some pictures to help me explain what im trying to do. http://www.securemilk.com/model.jpg http://www.securemilk.com/texture.jpg http://www.securemilk.com/modelandtext.jpg Please excuse the tackyness of the last pic, it was a quick photoshop job :P I created the cylinder using D3DXCreateCylinder and have found that it is next to impossible to add a texture to it as it doesnt have texture normals (or something like that). So i will need to recreate the cylinder mesh to add the texture to it. But I really have no idea how to go about doing this. So id really appreciate being helped out with this. Thanks
Advertisement
any ideas anybody? I know you may not know exactly how to do it but even if you know the theory that would be appreciated :-)
Use D3DXCreateCylinder(), then use ID3DXMesh::CloneMesh() to add texture coordinates. These will be filled with junk, so you'll have to lock the vertex buffer (ID3DXMesh::LockVertexBuffer()) and manually compute the texture coordinates yourself.

From your images it looks like you'll want to look into "Cylindrical Texture Mapping" (googled) to generate the coordinates.

If you want a generalised form of UV mapping, you might want to look into the "UV Atlas" tools in the D3DX library (they're quite well documented as well).

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Excellent, thankyou very much. As im quite new to directx this may take me some time to do correctly but i'll read as much as i can on the info you provided and hopefully i'll get it done.

Another thing. Is is possible for say a designer to create what im after using a mesh creation program (with the texture already on) to develop a .x file and then i just import it?
If this is possible then once I import the file will I be able to manipulate the modellike scale it?


Thanks for your help mate
Quote:Original post by Milkies
Is is possible for say a designer to create what im after using a mesh creation program (with the texture already on) to develop a .x file and then i just import it?
If this is possible then once I import the file will I be able to manipulate the modellike scale it?
Yes, perfectly possible - and probably quite easy as well [smile]

Every 3D modelling package I've used over the years has had cylindrical texture mapping features. More often that not they have much more complex mapping features - you may well find something better!

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Excellent thankyou very much :-)

I dont suppose you can recommend a 3d modelling package for me to test please? Hopepfully it is quite easy and if not then i have professional modeler I can ask for help.

Thanks again mate :-)
Quote:Original post by Milkies
I dont suppose you can recommend a 3d modelling package for me to test please? Hopepfully it is quite easy and if not then i have professional modeler I can ask for help.
Maya and 3dsmax are the industry standard tools, but you'll need a lot of spare cash burning a hole in your pocket if you want them.

On the opposite end of the spectrum you have Blender and Wings3D, both of which are free. I never managed to get my head around Blender's UI - it wound me up something awful. Wings3D was extremely simple and straight forward and great for making simple models...

hth
aAck

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement