cycles-fisheye: fixed formula for dir to equisolid

second time I need a scond commit to get the equisolid formula right, shame on me ;)
the formula is:
r = 2 x focallength x sin (theta / 2)
This commit is contained in:
Dalai Felinto 2012-05-07 17:22:13 +00:00
parent 9a731205e9
commit e11b9df3f1

@ -112,7 +112,7 @@ __device float3 fisheye_to_direction(float u, float v, float fov)
__device float2 direction_to_fisheye_equisolid(float3 dir, float lens, float width, float height) __device float2 direction_to_fisheye_equisolid(float3 dir, float lens, float width, float height)
{ {
float theta = acosf(dir.x); float theta = acosf(dir.x);
float r = 2.0f * lens * sinf(theta * 0.25f); float r = 2.0f * lens * sinf(theta * 0.5f);
float phi = atan2f(dir.z, dir.y); float phi = atan2f(dir.z, dir.y);
float u = r * cosf(phi) / width + 0.5f; float u = r * cosf(phi) / width + 0.5f;