Sign in to follow this  

Raytracing: Texture mapping of primitives

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

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