Commit 9e80dc73 authored by NiranV's avatar NiranV

Fixed: Sparkling sun light reflection on water glowing through fullbright objects.

Added: Option to toggle specularity on water surface, allowing it to reflect water but exhibit the glow-though-fullbright issue.
parent 3f88c9a6
......@@ -3,6 +3,17 @@
xsi:noNamespaceSchemaLocation="llsd.xsd">
<map>
<!-- Black Dragon Debugs -->
<key>RenderWaterLightReflections</key>
<map>
<key>Comment</key>
<string>Render more accurate light reflections on water. May introduce glow issues.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>ShowStatusButtonContainer</key>
<map>
<key>Comment</key>
......
......@@ -161,8 +161,10 @@ void main()
color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999f);
vec4 pos = vary_position;
#if LIGHT_REFLECT == 1
color.rgb += spec * specular;
#endif
//color.rgb = atmosTransport(color.rgb);
//color.rgb = scaleSoftClip(color.rgb);
......@@ -172,12 +174,15 @@ void main()
vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz);
//frag_data[0] = color;
// TODO: The non-obvious assignment below is copied from the pre-EEP WL shader code
// Unfortunately, fixing it causes a mismatch for EEP, and so it remains... for now
// SL-12975 (unfix pre-EEP broken alpha)
frag_data[0] = vec4(color.rgb, color); // Effectively, color.rgbr
// TODO: The non-obvious assignment below is copied from the pre-EEP WL shader code
// Unfortunately, fixing it causes a mismatch for EEP, and so it remains... for now
// SL-12975 (unfix pre-EEP broken alpha)
frag_data[0] = vec4(color.rgb, color); // Effectively, color.rgbr
frag_data[1] = vec4(1,1,1,specular); // speccolor, spec
#if LIGHT_REFLECT == 0
frag_data[1] = vec4(0.5, 0.5, 0.5, 0.75); // speccolor, spec
#else
frag_data[1] = vec4(0); // speccolor, spec
#endif
frag_data[2] = vec4(encode_normal(screenspacewavef.xyz), 0.05, 0);// normalxy, 0, 0
}
......@@ -1176,6 +1176,7 @@ void settings_setup_listeners()
//BD - Windlight
//gSavedSettings.getControl("UseEnvironmentFromRegion")->getSignal()->connect(boost::bind(&handleUseRegioLight, _2));
//gSavedSettings.getControl("CloudNoiseImageName")->getSignal()->connect(boost::bind(&handleCloudNoiseChanged, _2));
gSavedSettings.getControl("RenderWaterLightReflections")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
//BD - System
gSavedSettings.getControl("SlowMotionTimeFactor")->getSignal()->connect(boost::bind(&handleTimeFactorChanged, _2));
......
......@@ -2243,6 +2243,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredWaterProgram.mShaderFiles.clear();
gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredWaterProgram.addPermutation("LIGHT_REFLECT", (bool)gSavedSettings.getBOOL("RenderWaterLightReflections") ? "1" : "0");
gDeferredWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
success = gDeferredWaterProgram.createShader(NULL, NULL);
......
......@@ -49,7 +49,7 @@ width="510">
width="495">
<layout_stack
follows="top|left|right"
height="3487"
height="3507"
layout="topleft"
border_size="-5"
left="0"
......@@ -581,7 +581,7 @@ width="510">
follows="top|left|right"
visibility_control="PrefsLoDVisible"
layout="topleft"
height="545"
height="565"
visible="false"
auto_resize="false"
name="lod_layout_panel"
......@@ -1771,6 +1771,27 @@ width="510">
name="MipMaps"
top_pad="7"
width="115" />
<check_box
control_name="RenderWaterLightReflections"
enabled_control="RenderDeferred"
height="16"
initial_value="true"
label="Render Accurate Light Reflections"
tool_tip="&lt;b&gt;CPU:&lt;/b&gt; &lt;green&gt;Low&lt;/green&gt;
|&lt;b&gt;GPU:&lt;/b&gt; &lt;green&gt;Low&lt;/green&gt;
|&lt;b&gt;Performance:&lt;/b&gt; &lt;green&gt;Low&lt;/green&gt;
|&lt;b&gt;Graphics:&lt;/b&gt; &lt;green&gt;Low&lt;/green&gt; - Medium
||&lt;icon&gt;Caution_Widget_Mini&lt;/icon&gt; Caution Badge
|This option toggles whether the Viewer should use specularity on water for light reflections, allowing lights to reflect on water and shadows to occlude sunlight reflections. Note that this will however introduce an issue with water sunlight reflections glowing through fullbright objects similar to how the sunglare on shiny objects glow through fullbright objects."
layout="topleft"
left="10"
name="RenderWaterLightReflections"
top_pad="0"
width="115">
<check_box.check_button
image_overlay="Caution_Widget"
image_overlay_alignment="left"/>
</check_box>
<text
type="string"
length="1"
......
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