12-05-2014 08:49 PM
// When does the fade-to-black edge start? Chosen heuristically.
float fadeOutBorderFractionTexture = 0.05f;
float fadeOutBorderFractionTextureInnerEdge = 0.05f;
float fadeOutBorderFractionScreen = 0.05f;
// float fadeOutFloor = 0.6f; // the floor controls how much black is in the fade region
if (hmdRenderInfo.HmdType == HmdType_DK1)
{
fadeOutBorderFractionTexture = 0.3f;
fadeOutBorderFractionTextureInnerEdge = 0.075f;
fadeOutBorderFractionScreen = 0.075f;
// fadeOutFloor = 0.25f;
}
// Fade out at texture edges.
// The furthest out will be the blue channel, because of chromatic aberration (true of any standard lens)
Vector2f sourceTexCoordBlueNDC = TransformTanFovSpaceToRendertargetNDC ( eyeToSourceNDC, tanEyeAnglesB );
if (rightEye)
{
// The inner edge of the eye texture is usually much more magnified, because it's right against the middle of the screen, not the FOV edge.
// So we want a different scaling factor for that. This code flips the texture NDC so that +1.0 is the inner edge
sourceTexCoordBlueNDC.x = -sourceTexCoordBlueNDC.x;
}
float edgeFadeIn = ( 1.0f / fadeOutBorderFractionTextureInnerEdge ) * ( 1.0f - sourceTexCoordBlueNDC.x ) ; // Inner
edgeFadeIn = Alg::Min ( edgeFadeIn, ( 1.0f / fadeOutBorderFractionTexture ) * ( 1.0f + sourceTexCoordBlueNDC.x ) ); // Outer
edgeFadeIn = Alg::Min ( edgeFadeIn, ( 1.0f / fadeOutBorderFractionTexture ) * ( 1.0f - sourceTexCoordBlueNDC.y ) ); // Upper
edgeFadeIn = Alg::Min ( edgeFadeIn, ( 1.0f / fadeOutBorderFractionTexture ) * ( 1.0f + sourceTexCoordBlueNDC.y ) ); // Lower
// Also fade out at screen edges. Since this is in pixel space, no need to do inner specially.
float edgeFadeInScreen = ( 1.0f / fadeOutBorderFractionScreen ) *
( 1.0f - Alg::Max ( Alg::Abs ( screenNDC.x ), Alg::Abs ( screenNDC.y ) ) );
edgeFadeIn = Alg::Min ( edgeFadeInScreen, edgeFadeIn );// + fadeOutFloor;
// Note - this is NOT clamped negatively.
// For rendering methods that interpolate over a coarse grid, we need the values to go negative for correct intersection with zero.
result.Shade = Alg::Min ( edgeFadeIn, 1.0f );
result.ScreenPosNDC.x = 0.5f * screenNDC.x - 0.5f + xOffset;
result.ScreenPosNDC.y = -screenNDC.y;
12-06-2014 03:41 PM
"Carandiru" wrote:
Does this only affect AMD cards ?
12-08-2014 03:23 PM
12-08-2014 03:52 PM
12-08-2014 05:07 PM