Home

Advertisement

Customize

More on spaces - Understanding Texture Space, Normals Maps, Transformations

Oct. 30th, 2005 | 04:48 pm

A given triangle - lives in "world-space". Its vertices are specified in world space.
Texture coordinates at each vertex constitue the "texture-space".

Normal Map - a multi-channel image where the RGB components hold the x,y,z components of the normal at each vertex (or pixel?) of the object.
Normal mapping is of two varieties (this is from http://en.wikipedia.org/wiki/Normal_map) -

Object Space Normal Mapping and Tangent Space Normal Mapping
They differ in the coordinate systems in which the normals are measured and stored.

(again...straight off the Wikipedia)
By using an RGB bitmap textured across the model, more detailed normal vector information can be encoded. Each color channel in the bitmap (red, green and blue) corresponds to a spatial dimension (X, Y and Z). These spatial dimensions are relative to a constant coordinate system for object-space normal maps, or to a smoothly varying coordinate system (based on the derivatives of position with respect to texture coordinates) in the case of tangent-space normal maps.

Displacement Maps (good definition from
Displacement maps are a special type
of offset surface, and are usually assumed to perturb surface positions a small distance
using some function.


...

went to the mosque to break-fast. Walked with John who suggested all of software engineering is bunk. No but seriously ... he had a point. Instead of getting into "design-considerations" , "userf-friendliness" and all that jazz we acads should just KIS.

Link | Leave a comment | Add to Memories | Tell a Friend

Some Code - GLUT Application, Simple Texture Mapping

Oct. 30th, 2005 | 10:55 pm
mood: geeky

Coding - Finally

Trying to code a small glut application which will load two small shaders to perform displacement mapping. Finally got a small glut program working. pitiful result for a couple of hours work. But there was some funny issue with the texture setup.

This is the code I had for texture setup :

glGenTextures(1,&texName);
glBindTexture(GL_TEXTURE_2D,texName);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);

glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,8,8,0,GL_RGBA,GL_INT,NMap);

NMap was a 4x4x3 arrays of ints which held the texture ( just plane blue square where I had used 1 as the blue component). No matter what I did, I ended up with a blank screen. The problem was this. OpenGL maps ints to color values in such a way that only the maximum value stored by an int to 1 and the minimum value stored by it is mapped to -1 (or 0 if its an unsigned int) ... for example, for a 4 byte signed int, the value 2147483647 is mapped to 1.0 and the negative of that is mapped to -1. So, the value 1 which I was using is so teeny that it was just being mapped to 0 and I was getting the blank screen ! ... one hour to figure that out ... and I had help from John.

GLUT API Version 3
http://www.opengl.org/resources/libraries/glut/spec3/spec3.html

Parallax Mapping - ATI
http://www.ati.com/developer/gdc/Tatarchuk-ParallaxOcclusionMapping-FINAL_Print.pdf

Another one on Parallax Mapping from ATI
http://www.ati.com/developer/SIGGRAPH05/Tatarchuk-ParallaxOcclusionMapping-Sketch-print.pdf

Overview of Bump Mapping from Delphi3D
http://www.delphi3d.net/articles/viewarticle.php?article=bumpmapping.htm

Link | Leave a comment | Add to Memories | Tell a Friend