Jump to content
  • Advertisement
Sign in to follow this  

Raytracing: Texture mapping of primitives

This topic is 4930 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

this is something you could find in 2 seconds using google you know...

disclaimer, this could be wrong, but I hope this helps

for the sphere:
you'll leave ro as a constant (it's the radius), and theta and phi can correspond to texture coordinates

for the cylinder:
0<=z<= whatever height you want
r is constant.. it's the radius
And z and theta will correspond to texture coordinates.

I'm guessing the cone is the same as the cylinder except:

and a cube.. I have no clue how to parameterize.

Share this post

Link to post
Share on other sites
again, there's no such single thing as correct texture coordinates on primitive.

You can use any texture coordinates you like, and that's all. For texturing with 2D tecture map, you should make function that takes 3D position on surface of object and output 2D texture coordinate that makes sense. For sphere, you can use cubemap for texturing, or you
can use polar coords, etc. For cube you can use cubemap, but also you can use polar coords. For cone you can use "unfolded" cone, like paper shape that can be folded into cone. For torus you can use parametric equation of torus. And you can use cubemap. Or instead of point you can use surface normal together with cubemap. Possibilities is endless.

Share this post

Link to post
Share on other sites
Check out the book 'Introduction to Raytracing" - Andrew Glassner

It has a detailed explanation and mathematics behind texture mapping sphere, quad, triangle, cone, cylinder and even quadrics. I am sure you will find it very help full.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!