Commit 829de13d authored by NiranV's avatar NiranV

Fixed: SSAO Effect not working.

parent b6ce3b36
......@@ -1269,7 +1269,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("ssao_max_radius");
mReservedUniforms.push_back("ssao_factor");
mReservedUniforms.push_back("ssao_factor_inv");
mReservedUniforms.push_back("ssao_effect_mat");
mReservedUniforms.push_back("ssao_effect");
mReservedUniforms.push_back("screen_res");
mReservedUniforms.push_back("near_clip");
mReservedUniforms.push_back("shadow_offset");
......
......@@ -127,7 +127,7 @@ class LLShaderMgr
DEFERRED_SSAO_MAX_RADIUS,
DEFERRED_SSAO_FACTOR,
DEFERRED_SSAO_FACTOR_INV,
DEFERRED_SSAO_EFFECT_MAT,
DEFERRED_SSAO_EFFECT,
DEFERRED_SCREEN_RES,
DEFERRED_NEAR_CLIP,
DEFERRED_SHADOW_OFFSET,
......
......@@ -9102,13 +9102,9 @@
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Vector3</string>
<string>F32</string>
<key>Value</key>
<array>
<real>0.80</real>
<real>1.00</real>
<real>0.00</real>
</array>
<real>-1.0</real>
<key>PresetType</key>
<integer>1</integer>
</map>
......
......@@ -37,7 +37,7 @@ uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
uniform float scene_light_strength;
uniform mat3 ssao_effect_mat;
uniform float ssao_effect;
uniform int no_atmo;
uniform float sun_moon_glow_factor;
......@@ -138,7 +138,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
*/
if (use_ao)
{
tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
tmpAmbient = vec4(mix(ssao_effect * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
}
//haze color
......
......@@ -187,7 +187,6 @@ F32 LLPipeline::RenderShadowBlurSize;
F32 LLPipeline::RenderSSAOScale;
U32 LLPipeline::RenderSSAOMaxScale;
F32 LLPipeline::RenderSSAOFactor;
LLVector3 LLPipeline::RenderSSAOEffect;
F32 LLPipeline::RenderShadowOffsetError;
F32 LLPipeline::RenderShadowBiasError;
F32 LLPipeline::RenderShadowOffset;
......@@ -216,6 +215,7 @@ F32 LLPipeline::RenderAutoHideSurfaceAreaLimit;
LLTrace::EventStatHandle<S64> LLPipeline::sStatBatchSize("renderbatchsize");
//BD - Special Options
F32 LLPipeline::RenderSSAOEffect;
BOOL LLPipeline::CameraFreeDoFFocus;
BOOL LLPipeline::CameraDoFLocked;
//bool LLPipeline::RenderDepthOfFieldInEditMode;
......@@ -225,7 +225,6 @@ BOOL LLPipeline::RenderHighPrecisionNormals;
BOOL LLPipeline::RenderShadowAutomaticDistance;
U32 LLPipeline::RenderSSRResolution;
F32 LLPipeline::RenderSSRBrightness;
//F32 LLPipeline::RenderSSAOEffect;
F32 LLPipeline::RenderSSAOBlurSize;
F32 LLPipeline::RenderChromaStrength;
F32 LLPipeline::RenderSepiaStrength;
......@@ -1310,7 +1309,6 @@ void LLPipeline::refreshCachedSettings()
RenderSSAOScale = gSavedSettings.getF32("RenderSSAOScale");
RenderSSAOMaxScale = gSavedSettings.getU32("RenderSSAOMaxScale");
RenderSSAOFactor = gSavedSettings.getF32("RenderSSAOFactor");
RenderSSAOEffect = gSavedSettings.getVector3("RenderSSAOEffect");
RenderShadowOffsetError = gSavedSettings.getF32("RenderShadowOffsetError");
RenderShadowBiasError = gSavedSettings.getF32("RenderShadowBiasError");
RenderShadowOffset = gSavedSettings.getF32("RenderShadowOffset");
......@@ -1339,6 +1337,7 @@ void LLPipeline::refreshCachedSettings()
// //BD - Special Options
RenderSSAOEffect = gSavedSettings.getF32("RenderSSAOEffect");
RenderLocalLights = sRenderOtherAttachedLights || sRenderOwnAttachedLights || sRenderDeferredLights;
CameraFreeDoFFocus = gSavedSettings.getBOOL("CameraFreeDoFFocus");
CameraDoFLocked = gSavedSettings.getBOOL("CameraDoFLocked");
......@@ -8856,15 +8855,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor);
shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0/ssao_factor);
LLVector3 ssao_effect = RenderSSAOEffect;
F32 matrix_diag = (ssao_effect[0] + 2.0*ssao_effect[1])/3.0;
F32 matrix_nondiag = (ssao_effect[0] - ssao_effect[1])/3.0;
// This matrix scales (proj of color onto <1/rt(3),1/rt(3),1/rt(3)>) by
// value factor, and scales remainder by saturation factor
F32 ssao_effect_mat[] = { matrix_diag, matrix_nondiag, matrix_nondiag,
matrix_nondiag, matrix_diag, matrix_nondiag,
matrix_nondiag, matrix_nondiag, matrix_diag};
shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_SSAO_EFFECT_MAT, 1, GL_FALSE, ssao_effect_mat);
shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_EFFECT, RenderSSAOEffect);
//F32 shadow_offset_error = 1.f + RenderShadowOffsetError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]);
F32 shadow_bias_error = RenderShadowBiasError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2])/3000.f;
......@@ -9258,9 +9249,9 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
{
const LLViewerObject *root_obj = drawablep->getParent() ? drawablep->getParent()->getVObj() : vobj;
if (root_obj && dist_vec(root_obj->getPosition(), LLViewerCamera::getInstance()->getOrigin()) > RenderFarClip)
{
continue;
}
{
continue;
}
}
}
......
......@@ -955,7 +955,6 @@ class LLPipeline
static F32 RenderSSAOScale;
static U32 RenderSSAOMaxScale;
static F32 RenderSSAOFactor;
static LLVector3 RenderSSAOEffect;
static F32 RenderShadowOffsetError;
static F32 RenderShadowBiasError;
static F32 RenderShadowOffset;
......@@ -982,7 +981,8 @@ class LLPipeline
static F32 CameraDoFResScale;
static F32 RenderAutoHideSurfaceAreaLimit;
// //BD - Special Options
// //BD - Special Options
static F32 RenderSSAOEffect;
static BOOL CameraFreeDoFFocus;
static BOOL CameraDoFLocked;
//static bool RenderDepthOfFieldInEditMode;
......@@ -992,7 +992,6 @@ class LLPipeline
static BOOL RenderShadowAutomaticDistance;
static U32 RenderSSRResolution;
static F32 RenderSSRBrightness;
//static F32 RenderSSAOEffect;
static F32 RenderSSAOBlurSize;
static F32 RenderChromaStrength;
static F32 RenderSepiaStrength;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment