1

What is the general algorithm of the texture mapping ?

I have searched the google, but I have not seen any pseudocode algorithm of the texture mapping. Can you give it, by showing step by step ?

Ivaylo Strandjev
  • 69,226
  • 18
  • 123
  • 176
john diagor
  • 11
  • 1
  • 2
  • what exactly is your usecase. What is the input you get and what is the expected output? – Ivaylo Strandjev Dec 29 '12 at 12:13
  • That's a huge topic - and nowadays usually implemented by libraries and GPUs. Some keywords: bilinear and bicubic filtering, mipmapping, bump maps – Lucero Dec 29 '12 at 12:16
  • @Lucero I will use opengl. – john diagor Dec 29 '12 at 12:19
  • Okay, so you're not going to implement it yourself, are you? What's the issue then? Have you looked through the OpenGL FAQ? http://www.opengl.org/archives/resources/faq/technical/texture.htm – Lucero Dec 29 '12 at 12:26

1 Answers1

0

The general idea of texture mapping is:

  1. You have a texture represented as a function f(u,v) - or also a function f(u,v,w) - giving a color or shade of gray at a requested 2D or 3D location.
  2. You have a mapping from object coordinates (x,y[,z]) to texture coordinates (u,v[,w]).

How the texture function and the coordinate mapping is implemented depends on the actual needs and can be very different. If your texture is defined by a bitmap then you will need bilinear or becubic filtering to interpolate for non integer values of u or v. There are also different possibilities to map points (x,y,z) on the surface of a 3D object to texture coordinates (u,v).

coproc
  • 6,027
  • 2
  • 20
  • 31