
Hi,
I want to implement my own version of the D3D function D3DXComputeNormalMap. I am unable to find any good resource so let me tell you what I think is right...
ComputeNormalMap(NormalMap, Height, fAmount) for every pixel in HeightMap (x, y) Vec3 temp temp.z = temp.y = temp.x = (HeightMap[x][y].r * fAmount) Normalize(temp) NormalMal[x][y].r = 128 + (128 * temp.x) NormalMal[x][y].g = 128 + (128 * temp.y) NormalMal[x][y].b = 128 + (128 * temp.z)
While, we are on the same topic, let me also see if my algo for Adding two normal vectors is also correct
AddNormalMaps(NormalMapAplusB, NormalMapA, NormalMapB) for every pixel in NormalMapA(x, y) Vec3 temp, temp2
temp.x,y,z = (NormalMapA[x][y].r,g,b  128.0f) / 128.0f temp2.x,y,z = (NormalMapB[x][y].r,g,b  128.0f) / 128.0f
temp+=temp2 Normalize(temp)
NormalMapAplusB[x][y].r,g,b = 128 + (128 * temp.x,y,z)
