Fixed tan(phi)

This commit is contained in:
Emmanuel BENOîT 2017-10-05 17:50:33 +02:00
parent 57feeca7b3
commit 883dd9e2a6

View file

@ -102,17 +102,17 @@ float RM_TanPhi(
// ... // ...
// ... // ...
// or we could just pass it as a fucking uniform // or we could just pass it as a fucking uniform
const float fov = PI * .5 - atan( u_NearPlane * .5 ); const float hfov = ( PI * .5 - atan( u_NearPlane * .5 ) ) * .5;
vec2 e = ( abs( uv.x ) > abs( uv.y ) ) vec2 e = ( abs( uv.x ) > abs( uv.y ) )
? vec2( uv.x < 0 ? -1 : 1 , 0 ) ? vec2( uv.x < 0 ? -1 : 1 , 0 )
: vec2( 0 , uv.y < 0 ? -1 : 1 ); : vec2( 0 , uv.y < 0 ? -1 : 1 );
vec3 d = normalize( vec3( uv , -1 / tan( fov ) ) ) , vec3 d = normalize( vec3( uv , -1 / tan( hfov ) ) ) ,
a = vec3( ( e + e.yx ) * pixelRadius + uv , a = vec3( ( e + e.yx ) * pixelRadius + uv ,
-1 / tan( fov ) ) , -1 / tan( hfov ) ) ,
b = vec3( ( e - e.yx ) * pixelRadius + uv , b = vec3( ( e - e.yx ) * pixelRadius + uv ,
-1 / tan( fov ) ) , -1 / tan( hfov ) ) ,
p2ca = a / dot( a , d ) , p2ca = a / dot( a , d ) ,
p2cb = a / dot( b , d ) , p2cb = a / dot( b , d ) ,
diff = p2cb - p2ca , diff = p2cb - p2ca ,
@ -123,13 +123,6 @@ float RM_TanPhi(
return sqrt( sinPhiSquared / ( 1 - sinPhiSquared ) ); return sqrt( sinPhiSquared / ( 1 - sinPhiSquared ) );
} }
float RM_ErrFunc(
in vec3 origin ,
in vec3 pos )
{
return 0; // FIXME
}
vec3 RM_ReduceDiscontinuity( vec3 RM_ReduceDiscontinuity(
in vec3 origin , in vec3 origin ,
in vec3 rayDir , in vec3 rayDir ,