Sign in to follow this  
Milkies

Wrapping a texture round the edge of a cylinder

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 :-)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this