0
\$\begingroup\$

Other questione releated to my ray tracer implementation for iPad.

If I have a polygon that has a texture and a material, how do I calculate the color using Phong lighting model? Is the texture used in substitution of some of the component (diffuse?)? Or if there's a texture I need to just ignore the material and get only the texture color?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

I don't exactly understand how would ray-tracing change anything, here is how it usually goes:

You can have a texture for any parameter you like, but the most common is a diffuse(color) map, so you just sample this based on the texture coordinates and use the texture in place of the single-color diffuse. You could also combine the texture with an arbitrary color, tinting the given element.

Other common textures include normal maps, reflection maps, which replace their respective counterparts. Normal maps can be a bit tricky, because they specify the rotation relative to the surface, so you need to construct a Tangent Bitangent Normal matrix, which will do the transformation for you.

\$\endgroup\$
1
  • \$\begingroup\$ I finally manage it following your advice and reading other material. I used the texture to change the diffuse color of the object. Can you also help me with this question? gamedev.stackexchange.com/questions/105807/… \$\endgroup\$ Commented Aug 18, 2015 at 16:31

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.