HI I want to project 2d flat image cylindrically on mesh object. E.g., on cat or Dog face. I am using managed directX Can anyone help me on this manner thnx
I have a future 'Ask the Zman' column on spherically projected textures which you can modify, but I can't preempt that by putting the code up here. I don't have the publish date but it may be this Friday.
Here's how to do it though (hard without a diagram). Find the mid point of your mesh. Assume there is a 'vertical' ray that goes through this point (you have to decide what is vertical - that is the acis of the cylinder). Then iterate through each point on the mesh and project a ray from the vertical ray through that point perpendicular to the ray. You will get an angle from 0 to 360 (degrees). This maps the u coordinate from your texture fro 0.0 to 1.0
For the u texture you take how high up the 'vertical' ray and then scale to the 0.0 1.0 range.
If you assume the vertical is one of the major axis it makes the math a lot easier.
Cylindrically project 2d image
Medes
sqlaviolette
The MSDOn folks decide when it goes live not me and they've not given me a publish date yet.
Salva Madrid
v.iyer
Johan N
Here's how to do it though (hard without a diagram). Find the mid point of your mesh. Assume there is a 'vertical' ray that goes through this point (you have to decide what is vertical - that is the acis of the cylinder). Then iterate through each point on the mesh and project a ray from the vertical ray through that point perpendicular to the ray. You will get an angle from 0 to 360 (degrees). This maps the u coordinate from your texture fro 0.0 to 1.0
For the u texture you take how high up the 'vertical' ray and then scale to the 0.0 1.0 range.
If you assume the vertical is one of the major axis it makes the math a lot easier.
Sumit Mehta
What you want to do is addressed in the Sample Browser's "Tutorial 5: Using Texture Maps" (unless I'm misunderstanding your question).
Little_John