appleseedhq / appleseed

A modern open source rendering engine for animation and visual effects
https://appleseedhq.net/
MIT License
2.21k stars 331 forks source link

Converting normal map values to vectors; numerical errors #2883

Open lorentzo opened 4 years ago

lorentzo commented 4 years ago

Perturbed normals are encoded in normal map pixels as RGB vectors. To obtain a perturbed normal conversion from RGB to unit vector is required. The problem appears when one (or more) of RGB channel has a value of 128 which should exactly be 0 in converted vector. But in this case, converted vector not 0 but close to 0, more specifically: 0.003921 or -0.003921.

Below is the normal map baked in Blender which has this specific cases: simple5_DX_values

For example, pixel value of (128, 128, 255) should be converted to (0,0,1) but it it has values of (0.003921, -0.003921, 0.999985).

imSanko commented 3 years ago

I wanna work on to this project can you assign it to me.