Basic texture mapping help

K.I.L.E.R

Retarded moron
Veteran
I feel that I know how the idea works but I'm unsure if I misunderstood what I've been reading.

The idea:
Take a flat 2D image.
Take the row and column of each pixel in the image as (u,v).
Put each (u,v) pair into an equation, for instance of a sphere.
You then get some output, use this output to cast a ray from the sphere onto the object via ray casting.

Is this correct?
 
K.I.L.E.R said:
I feel that I know how the idea works but I'm unsure if I misunderstood what I've been reading.

The idea:
Take a flat 2D image.
Take the row and column of each pixel in the image as (u,v).
Put each (u,v) pair into an equation, for instance of a sphere.
You then get some output, use this output to cast a ray from the sphere onto the object via ray casting.

Is this correct?
Kiler, are you talking about wrapping a 2D texture onto a sphere or working out what texel(s) should be seen at a particular screen pixel?

Assuming you meant the latter, then you've got it "back-the-front" (for standard practices). You put the screen X & Y coordinates into two equations to obtain U & V positions for the texture map.
 
Aren't they one and the same?
Basically I want to map a texture onto an object.

The idea is that if you want the pixels shown on screen you will need to cast a ray and copy the pixels colour.

Kiler, are you talking about wrapping a 2D texture onto a sphere or working out what texel(s) should be seen at a particular screen pixel?
 
K.I.L.E.R said:
Aren't they one and the same?
Basically I want to map a texture onto an object.
Please don't top post. "It winds me up"!

They can be (and probably are best) considered as two distinct steps. The first is mapping a 2D texture onto a 3D object. The second is projecting the 3D regions back into a different 2D space. Since we generally deal with planar regions, the latter step is generally done with hyperbolic texture mapping, i.e.
Code:
u = (A*x + B*y + C) / (P*x + Q*y + R)
v = (D*x + E*y + F) / (P*x + Q*y + R)
ie. for a given triangle there are 9 coefficients that determine how to get the U&V texture coordinate for any pixel on the screen that's in the triangle.

If you want suggestions for the first stage 2D mapping, Watt & Watt's "Advanced Animation and Rendering Techniques" has a good section to get you started.
 
Thanks.
Unfortunately I have only 1 book but it's complex as hell and buying more isn't an option at this moment.

What's wrong with top posting and why would it wind you up?
 
K.I.L.E.R said:
Thanks.
Unfortunately I have only 1 book but it's complex as hell and buying more isn't an option at this moment.
But Kruno, you are going to Uni, are you not? Unis have these things called libraries... :p :p
What's wrong with top posting and why would it wind you up?
I was, partly, facetiously referring to a post in the "repaying" thread but, in all honesty, it does annoy me slightly because it goes against the natural flow of the comments.
 
Back
Top