Singularity Sphere Mapping and tangent space
Hi i have a big problem.
My rendering engine use the deferred light system. To beginning i started with a sphere mesh mapped using sphere mapping
public static Vector2 SphereMap(Vector3 vec)
{
float len;
Vector2 retV1 = Vector2.Empty;
len = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y + vec.Z * vec.Z);
if (len > 0.0f)
{
if (vec.X == 0.0f && vec.Y == 0.0f) retV1.X = 0.0f;
else retV1.X = (float)((1.0f - (float)Math.Atan2(vec.X, vec.Y)/Math.PI)/ 2.0f);
vec.Z /= len;
retV1.Y = 1.0f - (float)saacos(vec.Z) / (float)Math.PI;
}
else
{
retV1.X = retV1.Y = 0.0f;
}
return retV1;
}
But when i use the phong light system the specular component creates a lot of
noise in the singularity point. Any suggestion? something wrong?
[Edited by - Powerino73 on November 10, 2009 2:08:30 PM]
I haven't looked at your code, but I'll point out that you can avoid singularities by using a cubemap.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement