[Bf-committers] Bump mapping computation issue
Jonathan Merritt
j.merritt at pgrad.unimelb.edu.au
Mon Dec 6 01:27:10 CET 2004
Hi Stephane,
I have a couple of quick questions. You seem to be quite familiar with
this, so I thought I'd ask first before digging into the code... :-)
Stephane SOPPERA wrote:
> So if I'm not wrong, textures in blender already returns a vector that
> contains the coordinates in texture space of the vector to add to the
> normal:
>
> tex->nor[0]= (val1-val2);
> tex->nor[1]= (val1-val3);
Do you know where these come from? How are they calculated?
I'm asking because a common approach for bump mapping in REYES based
renderers is to perturb the micropolygon coordinates and calculate the
effective surface normals numerically. The function "calculatenormal()"
is provided specifically for this purpose:
Pshad = P + displacement * N;
N = calculatenormal(Pshad);
where:
Pshad - the "effective" location of the point used for shading
calculations
displacement - scalar displacement (eg: from a single channel texture)
N - surface normal vector
calculatenormal(Pshad) = dPshad/du (cross product with) dPshad/dv
In practice this can be done because entire grids of micropolygons are
shaded at once, so the Pshad values are all set (stored in the
micropolygon data shading structures) before calculatenormal() is called.
So, maybe nor[0] and nor[1] already incorporate dP/du and dP/dv?
Jonathan Merritt.
More information about the Bf-committers
mailing list