Commit 96e054ae authored by NiranV's avatar NiranV
Browse files

Added: Option to toggle considering roughness in SSR calculations.

parent 0b7fcebc
......@@ -812,6 +812,19 @@
<key>PresetType</key>
<integer>1</integer>
</map>
<key>RenderSSRRoughness</key>
<map>
<key>Comment</key>
<string>Test</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<real>0</real>
<key>PresetType</key>
<integer>1</integer>
</map>
<key>RenderSSRResolution</key>
<map>
<key>Comment</key>
......
......@@ -198,7 +198,12 @@ void main()
rd = guessnumfp / ssr_res;
rdpow2 = rd * rd;
refdist = (-2.5/(-1.0+pos.z))*(1.0-(norm.z*norm.z))*(screen_res.y * (rdpow2));// / (-depth) ;
ref2d = (orig_ref2d + (1.0 - spec.a)*0.25*vec2(0.0)) * refdist;
#if USE_RAND
float rnd2 = rand(vec2(guessnum+rnd, tc.x));
ref2d = (orig_ref2d + spec.a*0.25*vec2(rnd2-0.5)) * refdist;
#else
ref2d = (orig_ref2d + spec.a*vec2(0.0)) * refdist;
#endif
ref2d += tc.xy; // use as offset from destination
if (ref2d.y < 0.0 || ref2d.y > screen_res.y ||
......
......@@ -193,7 +193,12 @@ void main()
rd = guessnumfp / ssr_res;
rdpow2 = rd * rd;
refdist = (-2.5/(-1.0+pos.z))*(1.0-(norm.z*norm.z))*(screen_res.y * (rdpow2));// / (-depth) ;
ref2d = (orig_ref2d + (1.0 - spec.a)*0.25*vec2(0.0)) * refdist;
#if USE_RAND
float rnd2 = rand(vec2(guessnum+rnd, tc.x));
ref2d = (orig_ref2d + spec.a*0.25*vec2(rnd2-0.5)) * refdist;
#else
ref2d = (orig_ref2d + spec.a*vec2(0.0)) * refdist;
#endif
ref2d += tc.xy; // use as offset from destination
if (ref2d.y < 0.0 || ref2d.y > screen_res.y ||
......
......@@ -1189,6 +1189,7 @@ void settings_setup_listeners()
//BD - Rendering (Main Toggles)
gSavedSettings.getControl("RenderScreenSpaceReflections")->getSignal()->connect(boost::bind(&handleSSRChanged, _2));
gSavedSettings.getControl("RenderSSRRoughness")->getSignal()->connect(boost::bind(&handleSSRChanged, _2));
gSavedSettings.getControl("RenderGodrays")->getSignal()->connect(boost::bind(&handleGodraysChanged, _2));
//gSavedSettings.getControl("RenderDeferredBlurLight")->getSignal()->connect(boost::bind(&handleBlurLightChanged, _2));
gSavedSettings.getControl("RenderDeferredBlurLight")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
......
......@@ -2278,6 +2278,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER_ARB));
//BD - Screen Space Reflections
gDeferredSoftenProgram.addPermutation("USE_SSR", (bool)gSavedSettings.getBOOL("RenderScreenSpaceReflections") ? "1" : "0");
gDeferredSoftenProgram.addPermutation("USE_RAND", (bool)gSavedSettings.getBOOL("RenderSSRRoughness") ? "1" : "0");
gDeferredSoftenProgram.addPermutation("USE_ENV_MAP", (bool)gSavedSettings.getBOOL("RenderDeferredEnvironmentMap") ? "1" : "0");
gDeferredSoftenProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
......@@ -2328,6 +2329,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
//BD - Screen Space Reflections
gDeferredSoftenProgram.addPermutation("USE_SSR", (bool)gSavedSettings.getBOOL("RenderScreenSpaceReflections") ? "1" : "0");
gDeferredSoftenProgram.addPermutation("USE_RAND", (bool)gSavedSettings.getBOOL("RenderSSRRoughness") ? "1" : "0");
gDeferredSoftenProgram.addPermutation("USE_ENV_MAP", (bool)gSavedSettings.getBOOL("RenderDeferredEnvironmentMap") ? "1" : "0");
if (ambient_kill)
......@@ -4539,6 +4541,7 @@ BOOL LLViewerShaderMgr::loadShadersSSR(bool success)
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER_ARB));
//BD - Screen Space Reflections
gDeferredSoftenProgram.addPermutation("USE_SSR", (bool)gSavedSettings.getBOOL("RenderScreenSpaceReflections") ? "1" : "0");
gDeferredSoftenProgram.addPermutation("USE_RAND", (bool)gSavedSettings.getBOOL("RenderSSRRoughness") ? "1" : "0");
gDeferredSoftenProgram.addPermutation("USE_ENV_MAP", (bool)gSavedSettings.getBOOL("RenderDeferredEnvironmentMap") ? "1" : "0");
gDeferredSoftenProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
......@@ -4589,6 +4592,7 @@ BOOL LLViewerShaderMgr::loadShadersSSR(bool success)
//BD - Screen Space Reflections
gDeferredSoftenProgram.addPermutation("USE_SSR", (bool)gSavedSettings.getBOOL("RenderScreenSpaceReflections") ? "1" : "0");
gDeferredSoftenProgram.addPermutation("USE_RAND", (bool)gSavedSettings.getBOOL("RenderSSRRoughness") ? "1" : "0");
gDeferredSoftenProgram.addPermutation("USE_ENV_MAP", (bool)gSavedSettings.getBOOL("RenderDeferredEnvironmentMap") ? "1" : "0");
if (ambient_kill)
......
......@@ -3604,7 +3604,7 @@ WARNING! - Does not work with prim param LIGHT script command and emmisive masks
follows="top|left|right"
visibility_control="PrefsDeferredVisible"
layout="topleft"
height="608"
height="625"
auto_resize="false"
visible="false"
name="deferred_layout_panel"
......@@ -4561,6 +4561,22 @@ WARNING! - Does not work with prim param LIGHT script command and emmisive masks
left="10"
name="RenderScreenSpaceReflections"
top_delta="0"
width="115" />
<check_box
control_name="RenderSSRRoughness"
enabled_control="RenderDeferred"
height="16"
initial_value="true"
label="Include Roughness into Reflections"
tool_tip="&lt;b&gt;CPU:&lt;/b&gt; None
|&lt;b&gt;GPU:&lt;/b&gt; Medium - &lt;red&gt;High&lt;/red&gt;
|&lt;b&gt;Performance:&lt;/b&gt; Medium - &lt;red&gt;High&lt;/red&gt;
|&lt;b&gt;Graphics:&lt;/b&gt; &lt;green&gt;Low&lt;/green&gt; - Medium
||This option toggles whether Screen Space Reflections should scatter the reflection randomly based on the material roughness (glossiness) or not. This will drastically affect the performance of SSR even with lower SSR Resolution."
layout="topleft"
left="10"
name="RenderSSRRoughness"
top_pad="1"
width="115" />
<slider
control_name="RenderSSRResolution"
......
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