mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-11 12:51:27 +00:00
Fix precision issue in SSAO shader
This commit is contained in:
parent
55ea4a7729
commit
8a2737a0ce
3 changed files with 10 additions and 6 deletions
|
@ -112,11 +112,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;
|
||||
|
@ -165,8 +165,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;
|
||||
|
|
|
@ -332,8 +332,8 @@ void FGLRenderBuffers::CreateAmbientOcclusion(int width, int height)
|
|||
|
||||
AmbientWidth = width / 2;
|
||||
AmbientHeight = height / 2;
|
||||
AmbientTexture0 = Create2DTexture("AmbientTexture0", GetHdrFormat(), AmbientWidth, AmbientHeight);
|
||||
AmbientTexture1 = Create2DTexture("AmbientTexture1", GetHdrFormat(), AmbientWidth, AmbientHeight);
|
||||
AmbientTexture0 = Create2DTexture("AmbientTexture0", GL_RGBA32F, AmbientWidth, AmbientHeight);
|
||||
AmbientTexture1 = Create2DTexture("AmbientTexture1", GL_RGBA32F, AmbientWidth, AmbientHeight);
|
||||
AmbientFB0 = CreateFrameBuffer("AmbientFB0", AmbientTexture0);
|
||||
AmbientFB1 = CreateFrameBuffer("AmbientFB1", AmbientTexture1);
|
||||
|
||||
|
@ -388,6 +388,7 @@ GLuint FGLRenderBuffers::Create2DTexture(const FString &name, GLuint format, int
|
|||
case GL_RGBA8: dataformat = GL_RGBA; datatype = GL_UNSIGNED_BYTE; break;
|
||||
case GL_RGBA16: dataformat = GL_RGBA; datatype = GL_UNSIGNED_SHORT; break;
|
||||
case GL_RGBA16F: dataformat = GL_RGBA; datatype = GL_FLOAT; break;
|
||||
case GL_RGBA32F: dataformat = GL_RGBA; datatype = GL_FLOAT; break;
|
||||
case GL_DEPTH_COMPONENT24: dataformat = GL_DEPTH_COMPONENT; datatype = GL_FLOAT; break;
|
||||
case GL_STENCIL_INDEX8: dataformat = GL_STENCIL_INDEX; datatype = GL_INT; break;
|
||||
case GL_DEPTH24_STENCIL8: dataformat = GL_DEPTH_STENCIL; datatype = GL_UNSIGNED_INT_24_8; break;
|
||||
|
|
|
@ -50,6 +50,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();
|
||||
|
|
Loading…
Reference in a new issue