Fix precision issue in SSAO shader

This commit is contained in:
Magnus Norddahl 2016-09-01 07:15:40 +02:00
parent 723eb746f6
commit a6fdaca633
2 changed files with 7 additions and 4 deletions

View File

@ -104,11 +104,11 @@ CVAR(Float, gl_ssao_strength, 0.7, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, gl_ssao_debug, false, 0)
CVAR(Float, gl_ssao_bias, 0.5f, 0)
CVAR(Float, gl_ssao_radius, 100.0f, 0)
CUSTOM_CVAR(Float, gl_ssao_blur_amount, 6.0f, 0)
CUSTOM_CVAR(Float, gl_ssao_blur_amount, 4.0f, 0)
{
if (self < 0.1f) self = 0.1f;
}
CUSTOM_CVAR(Int, gl_ssao_blur_samples, 9, 0)
CUSTOM_CVAR(Int, gl_ssao_blur_samples, 5, 0)
{
if (self < 3 || self > 15 || self % 2 == 0)
self = 9;
@ -158,8 +158,8 @@ void FGLRenderer::AmbientOccludeScene()
float aoStrength = gl_ssao_strength;
//float tanHalfFovy = tan(fovy * (M_PI / 360.0f));
float tanHalfFovy = 1.0f / 1.33333302f; //gl_RenderState.mProjectionMatrix.get()[5];
float invFocalLenX = tanHalfFovy * (mBuffers->AmbientWidth / (float)mBuffers->AmbientHeight);
float tanHalfFovy = 1.0f / 1.33333302f; // 1.0f / gl_RenderState.mProjectionMatrix.get()[5];
float invFocalLenX = tanHalfFovy * (mBuffers->GetSceneWidth() / (float)mBuffers->GetSceneHeight());
float invFocalLenY = tanHalfFovy;
float nDotVBias = clamp(bias, 0.0f, 1.0f);
float r2 = aoRadius * aoRadius;

View File

@ -70,6 +70,9 @@ public:
int GetWidth() const { return mWidth; }
int GetHeight() const { return mHeight; }
int GetSceneWidth() const { return mSceneWidth; }
int GetSceneHeight() const { return mSceneHeight; }
private:
void ClearScene();
void ClearPipeline();