summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings')
-rw-r--r--indra/newview/app_settings/cmd_line.xml6
-rw-r--r--indra/newview/app_settings/keywords.ini1
-rw-r--r--indra/newview/app_settings/keywords_lsl_default.xml9
-rw-r--r--indra/newview/app_settings/logcontrol.xml1
-rw-r--r--indra/newview/app_settings/settings.xml313
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl52
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/srgbF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl263
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl109
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/waterF.glsl4
23 files changed, 385 insertions, 568 deletions
diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml
index e16a5c7e76..340334aee8 100644
--- a/indra/newview/app_settings/cmd_line.xml
+++ b/indra/newview/app_settings/cmd_line.xml
@@ -209,6 +209,12 @@
<string>NoAudio</string>
</map>
+ <key>nofmod</key>
+ <map>
+ <key>map-to</key>
+ <string>UseMediaPluginsForStreamingAudio</string>
+ </map>
+
<key>noninteractive</key>
<map>
<key>desc</key>
diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini
index 9699eda96b..4e177ab518 100644
--- a/indra/newview/app_settings/keywords.ini
+++ b/indra/newview/app_settings/keywords.ini
@@ -274,6 +274,7 @@ INVENTORY_NOTECARD Passed to task inventory library functions to reference notec
INVENTORY_BODYPART Passed to task inventory library functions to reference body parts
INVENTORY_ANIMATION Passed to task inventory library functions to reference animations
INVENTORY_GESTURE Passed to task inventory library functions to reference gestures
+INVENTORY_MATERIAL Passed to task inventory library functions to reference materials
INVENTORY_ALL Passed to task inventory library functions to reference all inventory items
INVENTORY_NONE Returned by llGetInventoryType when no item is found
diff --git a/indra/newview/app_settings/keywords_lsl_default.xml b/indra/newview/app_settings/keywords_lsl_default.xml
index d641883d5a..893b017367 100644
--- a/indra/newview/app_settings/keywords_lsl_default.xml
+++ b/indra/newview/app_settings/keywords_lsl_default.xml
@@ -1963,6 +1963,15 @@
<key>tooltip</key>
<string/>
</map>
+ <key>INVENTORY_MATERIAL</key>
+ <map>
+ <key>type</key>
+ <string>integer</string>
+ <key>value</key>
+ <integer>57</integer>
+ <key>tooltip</key>
+ <string/>
+ </map>
<key>JSON_APPEND</key>
<map>
<key>type</key>
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index 2a26cb9a43..482012cdd6 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -73,7 +73,6 @@
<string>Avatar</string>
<string>Voice</string>
-->
- <string>Capabilities</string>
</array>
</map>
</array>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 85dfe688a7..9a1da5311c 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -250,7 +250,7 @@
<key>TextureLivePreview</key>
<map>
<key>Comment</key>
- <string>Preview selections in texture picker immediately</string>
+ <string>Preview selections in texture picker or material picker immediately</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@@ -5013,17 +5013,6 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>InventoryInboxToggleState</key>
- <map>
- <key>Comment</key>
- <string>Stores the open/closed state of inventory Received items panel</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Boolean</string>
- <key>Value</key>
- <integer>0</integer>
- </map>
<key>InventoryLinking</key>
<map>
<key>Comment</key>
@@ -5519,6 +5508,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>LastUIFeatureVersion</key>
+ <map>
+ <key>Comment</key>
+ <string>UI Feature Version number for tracking feature notification between viewer builds</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>LLSD</string>
+ <key>Value</key>
+ <string></string>
+ </map>
<key>LastFindPanel</key>
<map>
<key>Comment</key>
@@ -7088,6 +7088,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>UseMediaPluginsForStreamingAudio</key>
+ <map>
+ <key>Comment</key>
+ <string>Use media plugins (VLC) for streaming audio.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>NoHardwareProbe</key>
<map>
<key>Comment</key>
@@ -9035,16 +9046,16 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>RenderLocalLights</key>
+ <key>RenderLocalLightCount</key>
<map>
<key>Comment</key>
- <string>Whether or not to render local lights.</string>
+ <string>Number of local lights to render.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>Boolean</string>
+ <string>S32</string>
<key>Value</key>
- <integer>1</integer>
+ <integer>256</integer>
</map>
<key>RenderShadowSplitExponent</key>
<map>
@@ -9340,6 +9351,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>RenderPostProcessingHDR</key>
+ <map>
+ <key>Comment</key>
+ <string>Enable HDR for post processing buffer</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>RenderMaxOpenGLVersion</key>
<map>
<key>Comment</key>
@@ -9626,7 +9648,7 @@
<key>Type</key>
<string>F32</string>
<key>Value</key>
- <real>-0.001</real>
+ <real>-0.0002</real>
</map>
<key>RenderSpotShadowOffset</key>
<map>
@@ -10155,6 +10177,17 @@
<key>Value</key>
<integer>9</integer>
</map>
+ <key>RenderGlowHDR</key>
+ <map>
+ <key>Comment</key>
+ <string>Enable HDR for glow map</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>RenderGlowStrength</key>
<map>
<key>Comment</key>
@@ -10203,6 +10236,17 @@
<key>Value</key>
<real>1.3</real>
</map>
+ <key>RenderGlowNoise</key>
+ <map>
+ <key>Comment</key>
+ <string>Enables glow noise (dithering). Reduces banding from glow in certain cases.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <real>1</real>
+ </map>
<key>DisableAllRenderTypes</key>
<map>
<key>Comment</key>
@@ -10610,7 +10654,7 @@
<key>Type</key>
<string>F32</string>
<key>Value</key>
- <real>0.5</real>
+ <real>1.0</real>
</map>
<key>RenderSkyAutoAdjustHDRScale</key>
<map>
@@ -10623,6 +10667,73 @@
<key>Value</key>
<real>2.0</real>
</map>
+ <key>RendeSkyAutoAdjustBlueHorizonScale</key>
+ <map>
+ <key>Comment</key>
+ <string>Blue Horizon Scale value to use when auto-adjusting legacy skies</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
+ <key>RendeSkyAutoAdjustBlueDensityScale</key>
+ <map>
+ <key>Comment</key>
+ <string>Blue Horizon Scale value to use when auto-adjusting legacy skies</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
+ <key>RenderSkyAutoAdjustSunColorScale</key>
+ <map>
+ <key>Comment</key>
+ <string>Sun color scalar when auto-adjusting legacy skies</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
+ <key>RenderSkyAutoAdjustProbeAmbiance</key>
+ <map>
+ <key>Comment</key>
+ <string>Probe ambiance value when auto-adjusting legacy skies</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.001</real>
+ </map>
+ <key>RenderSkySunlightScale</key>
+ <map>
+ <key>Comment</key>
+ <string>Sunlight scale fudge factor for matching with pre-PBR viewer</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
+ <key>RenderSkyAmbientScale</key>
+ <map>
+ <key>Comment</key>
+ <string>Ambient scale fudge factor for matching with pre-PBR viewer</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.7</real>
+ </map>
+
<key>RenderReflectionProbeMaxLocalLightAmbiance</key>
<map>
<key>Comment</key>
@@ -11531,6 +11642,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>SelectReflectionProbes</key>
+ <map>
+ <key>Comment</key>
+ <string>Select reflection probes</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>SelectOwnedOnly</key>
<map>
<key>Comment</key>
@@ -11666,11 +11788,11 @@
<key>ShowBanLines</key>
<map>
<key>Comment</key>
- <string>Show in-world ban/access borders</string>
+ <string>Show in-world ban/access borders, 0 - do not show, 1 - show on collision, 2 - show on proximity</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>Boolean</string>
+ <string>S32</string>
<key>Value</key>
<integer>1</integer>
</map>
@@ -12866,39 +12988,6 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>AmbientDisable</key>
- <map>
- <key>Comment</key>
- <string>If TRUE, ambient light has no effect</string>
- <key>Persist</key>
- <integer>0</integer>
- <key>Type</key>
- <string>Boolean</string>
- <key>Value</key>
- <integer>0</integer>
- </map>
- <key>SunlightDisable</key>
- <map>
- <key>Comment</key>
- <string>If TRUE, sunlight has no effect</string>
- <key>Persist</key>
- <integer>0</integer>
- <key>Type</key>
- <string>Boolean</string>
- <key>Value</key>
- <integer>0</integer>
- </map>
- <key>LocalLightDisable</key>
- <map>
- <key>Comment</key>
- <string>If TRUE, local lights have no effect</string>
- <key>Persist</key>
- <integer>0</integer>
- <key>Type</key>
- <string>Boolean</string>
- <key>Value</key>
- <integer>0</integer>
- </map>
<key>TextureDiscardLevel</key>
<map>
<key>Comment</key>
@@ -13171,13 +13260,13 @@
<key>TranslationService</key>
<map>
<key>Comment</key>
- <string>Translation API to use. (google|bing)</string>
+ <string>Translation API to use. (google|azure)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
- <string>bing</string>
+ <string>azure</string>
</map>
<key>GoogleTranslateAPIKey</key>
<map>
@@ -13193,7 +13282,7 @@
<key>BingTranslateAPIKey</key>
<map>
<key>Comment</key>
- <string>Bing AppID to use with the Microsoft Translator API</string>
+ <string>(Deprecated) Bing AppID to use with the Microsoft Translator API</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@@ -13201,6 +13290,28 @@
<key>Value</key>
<string></string>
</map>
+ <key>AzureTranslateAPIKey</key>
+ <map>
+ <key>Comment</key>
+ <string>Azure Translation service data to use with the MS Azure Translator API</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>LLSD</string>
+ <key>Value</key>
+ <string></string>
+ </map>
+ <key>DeepLTranslateAPIKey</key>
+ <map>
+ <key>Comment</key>
+ <string>DeepL Translation service data to use with the DeepL Translator API</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>LLSD</string>
+ <key>Value</key>
+ <string></string>
+ </map>
<key>TutorialURL</key>
<map>
<key>Comment</key>
@@ -15536,6 +15647,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>BatchSizeAIS3</key>
+ <map>
+ <key>Comment</key>
+ <string>Amount of folder ais packs into category subset request</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>20</integer>
+ </map>
<key>PoolSizeAIS</key>
<map>
<key>Comment</key>
@@ -15543,7 +15665,7 @@
<key>Type</key>
<string>U32</string>
<key>Value</key>
- <integer>1</integer>
+ <integer>20</integer>
</map>
<key>PoolSizeUpload</key>
<map>
@@ -17250,17 +17372,6 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>360CaptureUseInterestListCap</key>
- <map>
- <key>Comment</key>
- <string>Flag if set, uses the new InterestList cap to ask the simulator for full content</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Boolean</string>
- <key>Value</key>
- <integer>1</integer>
- </map>
<key>360CaptureJPEGEncodeQuality</key>
<map>
<key>Comment</key>
@@ -17382,5 +17493,71 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>FindOriginalOpenWindow</key>
+ <map>
+ <key>Comment</key>
+ <string>Sets the action for 'Find original' and 'Show in Inventory' (0 - shows item in main Inventory, 1 - opens a new single-folder window)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
+ <key>StatsReportMaxDuration</key>
+ <map>
+ <key>Comment</key>
+ <string>Maximum seconds for viewer stats file data, prevents huge file</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>300</real>
+ </map>
+ <key>StatsReportFileInterval</key>
+ <map>
+ <key>Comment</key>
+ <string>Interval to save viewer stats file data</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.2</real>
+ </map>
+ <key>StatsReportSkipZeroDataSaves</key>
+ <map>
+ <key>Comment</key>
+ <string>In viewer stats data file, skip saving entry if there is no data</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
+<key>MultiModeDoubleClickFolder</key>
+<map>
+ <key>Comment</key>
+ <string>Sets the action for Double-click on folder in multi-folder view (0 - expands and collapses folder, 1 - opens a new window, 2 – stays in current floater but switches to SFV)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>U32</string>
+ <key>Value</key>
+ <integer>0</integer>
+</map>
+<key>SingleModeDoubleClickOpenWindow</key>
+<map>
+ <key>Comment</key>
+ <string>Sets the action for Double-click on folder in single-folder view (0 - stays in current window, 1 - opens a new window)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+</map>
</map>
</llsd>
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index c8eaba6418..f9ebf33b4a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -382,8 +382,7 @@ vec3 pbrIbl(vec3 diffuseColor,
vec3 irradiance, // irradiance map sample
float ao, // ambient occlusion factor
float nv, // normal dot view vector
- float perceptualRough,
- out vec3 specContrib)
+ float perceptualRough)
{
// retrieve a scale and bias to F0. See [1], Figure 3
vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough);
@@ -393,23 +392,9 @@ vec3 pbrIbl(vec3 diffuseColor,
vec3 diffuse = diffuseLight * diffuseColor;
vec3 specular = specularLight * (specularColor * brdf.x + brdf.y);
- specContrib = specular * ao;
-
return (diffuse + specular) * ao;
}
-vec3 pbrIbl(vec3 diffuseColor,
- vec3 specularColor,
- vec3 radiance, // radiance map sample
- vec3 irradiance, // irradiance map sample
- float ao, // ambient occlusion factor
- float nv, // normal dot view vector
- float perceptualRough)
-{
- vec3 specContrib;
- return pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, nv, perceptualRough, specContrib);
-}
-
// Encapsulate the various inputs used by the various functions in the shading equation
// We store values in this struct to simplify the integration of alternative implementations
@@ -475,8 +460,7 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
- vec3 l, //surface point to light
- out vec3 specContrib) //specular contribution (exposed to alpha shaders to calculate "glare")
+ vec3 l) //surface point to light
{
// make sure specular highlights from punctual lights don't fall off of polished surfaces
perceptualRoughness = max(perceptualRoughness, 8.0/255.0);
@@ -524,28 +508,13 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
// Calculation of analytical lighting contribution
vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
- specContrib = F * G * D / (4.0 * NdotL * NdotV);
+ vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
// Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
vec3 color = NdotL * (diffuseContrib + specContrib);
- specContrib *= NdotL;
- specContrib = max(specContrib, vec3(0));
-
return clamp(color, vec3(0), vec3(10));
}
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
- float metallic,
- vec3 n, // normal
- vec3 v, // surface point to camera
- vec3 l) //surface point to light
-{
- vec3 specContrib;
-
- return pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n, v, l, specContrib);
-}
-
void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor, inout vec3 specularColor)
{
vec3 f0 = vec3(0.04);
@@ -554,30 +523,21 @@ void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor
specularColor = mix(f0, baseColor, metallic);
}
-vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v, vec3 norm, float perceptualRoughness, vec3 light_dir, vec3 sunlit, float scol, vec3 radiance, vec3 irradiance, vec3 colorEmissive, float ao, vec3 additive, vec3 atten, out vec3 specContrib)
+vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v, vec3 norm, float perceptualRoughness, vec3 light_dir, vec3 sunlit, float scol, vec3 radiance, vec3 irradiance, vec3 colorEmissive, float ao, vec3 additive, vec3 atten)
{
vec3 color = vec3(0);
float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0);
- vec3 ibl_spec;
- color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness, ibl_spec);
+ color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness);
- color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir), specContrib) * sunlit * 3.0 * scol; //magic number to balance with legacy materials
- specContrib *= sunlit * 2.75 * scol;
- specContrib += ibl_spec;
+ color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir)) * sunlit * 3.0 * scol; //magic number to balance with legacy materials
color += colorEmissive;
return color;
}
-vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v, vec3 norm, float perceptualRoughness, vec3 light_dir, vec3 sunlit, float scol, vec3 radiance, vec3 irradiance, vec3 colorEmissive, float ao, vec3 additive, vec3 atten)
-{
- vec3 specContrib;
- return pbrBaseLight(diffuseColor, specularColor, metallic, v, norm, perceptualRoughness, light_dir, sunlit, scol, radiance, irradiance, colorEmissive, ao, additive, atten, specContrib);
-}
-
uniform vec4 waterPlane;
uniform float waterSign;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index b752307d13..5d58cc91cd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -40,8 +40,6 @@ vec4 applyWaterFogView(vec3 pos, vec4 color);
#endif
vec3 srgb_to_linear(vec3 cs);
-vec3 legacy_adjust_fullbright(vec3 c);
-vec3 legacy_adjust(vec3 c);
vec3 linear_to_srgb(vec3 cl);
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
@@ -98,9 +96,7 @@ void main()
#endif
#ifndef IS_HUD
- color.rgb = legacy_adjust(color.rgb);
color.rgb = srgb_to_linear(color.rgb);
- color.rgb = legacy_adjust_fullbright(color.rgb);
color.rgb = atmosFragLighting(color.rgb, additive, atten);
#endif
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 53e4f02314..64e6bc9da2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -105,7 +105,8 @@ vec3 toneMap(vec3 color)
color *= exposure * exp_scale;
- color = toneMapACES_Hill(color);
+ // mix ACES and Linear here as a compromise to avoid over-darkening legacy content
+ color = mix(toneMapACES_Hill(color), color, 0.333);
#endif
return color;
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
index 7a5e14566b..b5437d43d2 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -28,6 +28,10 @@
out vec4 frag_color;
uniform sampler2D diffuseMap;
+#if HAS_NOISE
+uniform sampler2D glowNoiseMap;
+uniform vec2 screen_res;
+#endif
uniform float minLuminance;
uniform float maxExtractAlpha;
uniform vec3 lumWeights;
@@ -44,7 +48,16 @@ void main()
float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) );
float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) );
- frag_color.rgb = col.rgb;
+#if HAS_NOISE
+ float TRUE_NOISE_RES = 128; // See mTrueNoiseMap
+ // *NOTE: Usually this is vary_fragcoord not vary_texcoord0, but glow extraction is in screen space
+ vec3 glow_noise = texture(glowNoiseMap, vary_texcoord0.xy * (screen_res / TRUE_NOISE_RES)).xyz;
+ // Dithering. Reduces banding effects in the reduced precision glow buffer.
+ float NOISE_DEPTH = 64.0;
+ col.rgb += glow_noise / NOISE_DEPTH;
+ col.rgb = max(col.rgb, vec3(0));
+#endif
+ frag_color.rgb = col.rgb;
frag_color.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha);
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
index 31b02377da..e3fd10447e 100644
--- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
@@ -113,31 +113,3 @@ vec3 inv_toneMapACES_Hill(vec3 color)
return color;
}
-// adjust legacy colors to back out tonemapping and exposure
-// NOTE: obsolete now that setting probe ambiance to zero removes tonemapping and exposure, but keeping for a minute
-// while that change goes through testing - davep 6/1/2023
-#define LEGACY_ADJUST 0
-
-vec3 legacy_adjust(vec3 c)
-{
-#if LEGACY_ADJUST
- vec3 desat = rgb2hsv(c.rgb);
- desat.g *= 1.0-(1.0-desat.b)*0.5;
- desat.b += (1.0-desat.b)*0.1f;
- desat.rgb = hsv2rgb(desat);
- return desat;
-#else
- return c;
-#endif
-}
-
-vec3 legacy_adjust_fullbright(vec3 c)
-{
-#if LEGACY_ADJUST
- float exp_scale = clamp(texture(exposureMap, vec2(0.5, 0.5)).r, 0.01, 10.0);
- return c / exp_scale * 1.34; //magic 1.34 arrived at by binary search for a value that reproduces midpoint grey consistenty
-#else
- return c;
-#endif
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index 437fa0a6d5..a1da4b1f9a 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -39,12 +39,12 @@ uniform float max_y;
uniform vec3 glow;
uniform float scene_light_strength;
uniform float sun_moon_glow_factor;
-uniform float sky_hdr_scale;
+uniform float sky_sunlight_scale;
+uniform float sky_ambient_scale;
float getAmbientClamp() { return 1.0f; }
vec3 srgb_to_linear(vec3 col);
-vec3 legacy_adjust(vec3 col);
// return colors in sRGB space
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
@@ -148,12 +148,9 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou
// multiply to get similar colors as when the "scaleSoftClip" implementation was doubling color values
// (allows for mixing of light sources other than sunlight e.g. reflection probes)
- sunlit *= 1.5;
- amblit *= 0.5;
+ sunlit *= sky_sunlight_scale;
+ amblit *= sky_ambient_scale;
- // override amblit with ambient_color if sky probe ambiance is not zero
- amblit = mix(amblit, ambient_color, clamp(sky_hdr_scale-1.0, 0.0, 1.0));
-
amblit = srgb_to_linear(amblit);
amblit *= ambientLighting(norm, light_dir);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index da5f997429..b63f3b60f9 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -71,7 +71,6 @@ vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
vec3 srgb_to_linear(vec3 c);
vec3 linear_to_srgb(vec3 c);
-vec3 legacy_adjust(vec3 c);
vec2 encode_normal (vec3 n);
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
@@ -85,7 +84,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
float getAmbientClamp();
void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent);
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear);
vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, float ambiance)
{
@@ -234,7 +233,6 @@ void main()
}
diffuse_srgb.rgb *= vertex_color.rgb;
- diffuse_srgb.rgb = legacy_adjust(diffuse_srgb.rgb);
diffuse_linear.rgb = srgb_to_linear(diffuse_srgb.rgb);
#endif // USE_VERTEX_COLOR
@@ -251,7 +249,7 @@ void main()
vec3 irradiance;
vec3 glossenv;
vec3 legacyenv;
- sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0, true);
+ sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0, true, amblit_linear);
float da = dot(norm.xyz, light_dir.xyz);
@@ -266,7 +264,7 @@ void main()
vec3 sun_contrib = min(final_da, shadow) * sunlit_linear;
- color.rgb = max(amblit, irradiance);
+ color.rgb = irradiance;
color.rgb += sun_contrib;
@@ -291,9 +289,7 @@ void main()
LIGHT_LOOP(7)
// sum local light contrib in linear colorspace
-#if !defined(LOCAL_LIGHT_KILL)
color.rgb += light.rgb;
-#endif // !defined(LOCAL_LIGHT_KILL)
#endif // #else // FOR_IMPOSTOR
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index e8db856b1f..35d752be02 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -92,7 +92,7 @@ void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float
float calcLegacyDistanceAttenuation(float distance, float falloff);
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent);
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear);
void waterClip(vec3 pos);
@@ -112,16 +112,14 @@ vec3 pbrBaseLight(vec3 diffuseColor,
vec3 colorEmissive,
float ao,
vec3 additive,
- vec3 atten,
- out vec3 specContrib);
+ vec3 atten);
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
float metallic,
vec3 n, // normal
vec3 v, // surface point to camera
- vec3 l, //surface point to light
- out vec3 specContrib);
+ vec3 l); //surface point to light
vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
float perceptualRoughness,
@@ -132,7 +130,7 @@ vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
vec3 lp, // light position
vec3 ld, // light direction (for spotlights)
vec3 lightColor,
- float lightSize, float falloff, float is_pointlight, inout float glare, float ambiance)
+ float lightSize, float falloff, float is_pointlight, float ambiance)
{
vec3 color = vec3(0,0,0);
@@ -154,10 +152,7 @@ vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
vec3 intensity = spot_atten * dist_atten * lightColor * 3.0; //magic number to balance with legacy materials
- vec3 speccol;
- color = intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv, speccol);
- speccol *= intensity;
- glare += max(max(speccol.r, speccol.g), speccol.b);
+ color = intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
}
return color;
@@ -166,7 +161,6 @@ vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
void main()
{
vec3 color = vec3(0,0,0);
- float glare = 0.0;
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
vec3 pos = vary_position;
@@ -224,20 +218,15 @@ void main()
float gloss = 1.0 - perceptualRoughness;
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
- sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true);
- // Take maximium of legacy ambient vs irradiance sample as irradiance
- // NOTE: ao is applied in pbrIbl (see pbrBaseLight), do not apply here
- irradiance = max(amblit,irradiance);
-
+ sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true, amblit);
+
vec3 diffuseColor;
vec3 specularColor;
calcDiffuseSpecular(col.rgb, metallic, diffuseColor, specularColor);
vec3 v = -normalize(pos.xyz);
- vec3 spec;
- color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten, spec);
- glare += max(max(spec.r, spec.g), spec.b);
+ color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten);
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
@@ -249,7 +238,7 @@ void main()
vec3 light = vec3(0);
// Punctual lights
-#define LIGHT_LOOP(i) light += calcPointLightOrSpotLight(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, pos.xyz, v, light_position[i].xyz, light_direction[i].xyz, light_diffuse[i].rgb, light_deferred_attenuation[i].x, light_deferred_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w);
+#define LIGHT_LOOP(i) light += calcPointLightOrSpotLight(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, pos.xyz, v, light_position[i].xyz, light_direction[i].xyz, light_diffuse[i].rgb, light_deferred_attenuation[i].x, light_deferred_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w);
LIGHT_LOOP(1)
LIGHT_LOOP(2)
@@ -264,9 +253,6 @@ void main()
float a = basecolor.a*vertex_color.a;
- glare = min(glare, 1.0);
- a = max(a, glare);
-
frag_color = max(vec4(color.rgb,a), vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
index aa6f5a3b62..52e71edcac 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
@@ -34,7 +34,7 @@ uniform mat3 env_mat;
vec3 srgb_to_linear(vec3 c);
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent)
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear)
{
ambenv = vec3(reflection_probe_ambiance * 0.25);
@@ -44,9 +44,9 @@ void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
}
void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness)
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, vec3 amblit_linear)
{
- sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness, false);
+ sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness, false, amblit_linear);
}
vec4 sampleReflectionProbesDebug(vec3 pos)
@@ -56,7 +56,7 @@ vec4 sampleReflectionProbesDebug(vec3 pos)
}
void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent)
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear)
{
ambenv = vec3(reflection_probe_ambiance * 0.25);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
index 1537714bb7..5483a4e29c 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
@@ -40,8 +40,6 @@ in vec3 vary_position;
uniform samplerCube environmentMap;
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
-vec3 legacy_adjust_fullbright(vec3 c);
-vec3 legacy_adjust(vec3 c);
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
vec3 linear_to_srgb(vec3 c);
@@ -49,7 +47,7 @@ vec3 srgb_to_linear(vec3 c);
// reflection probe interface
void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent);
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear);
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity);
@@ -80,12 +78,10 @@ void main()
vec3 legacyenv;
vec3 norm = normalize(vary_texcoord1.xyz);
vec4 spec = vec4(0,0,0,0);
- sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity, false);
+ sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity, false, amblit);
- color.rgb = legacy_adjust(color.rgb);
color.rgb = srgb_to_linear(color.rgb);
- color.rgb = legacy_adjust_fullbright(color.rgb);
-
+
applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity);
color.rgb = atmosFragLighting(color.rgb, additive, atten);
#endif
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index 82e2de0c0f..acff03ec4b 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -48,8 +48,6 @@ void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float
vec3 srgb_to_linear(vec3 cs);
vec3 linear_to_srgb(vec3 cs);
-vec3 legacy_adjust(vec3 c);
-vec3 legacy_adjust_fullbright(vec3 c);
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
@@ -60,7 +58,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
#endif
void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent);
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear);
void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm);
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity);
@@ -311,7 +309,6 @@ void main()
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
//forward rendering, output lit linear color
- diffcol.rgb = legacy_adjust(diffcol.rgb);
diffcol.rgb = srgb_to_linear(diffcol.rgb);
spec.rgb = srgb_to_linear(spec.rgb);
spec.a = glossiness; // pack glossiness into spec alpha for lighting functions
@@ -339,10 +336,9 @@ void main()
vec3 ambenv;
vec3 glossenv;
vec3 legacyenv;
- sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true);
+ sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true, amblit_linear);
- // use sky settings ambient or irradiance map sample, whichever is brighter
- color = max(amblit_linear, ambenv);
+ color = ambenv;
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
vec3 sun_contrib = min(da, shadow) * sunlit_linear;
@@ -378,7 +374,7 @@ void main()
applyGlossEnv(color, glossenv, spec, pos.xyz, norm.xyz);
}
- color = mix(color.rgb, legacy_adjust_fullbright(diffcol.rgb), emissive);
+ color = mix(color.rgb, diffcol.rgb, emissive);
if (env > 0.0)
{ // add environmentmap
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
index 2a096a98ec..ec8168465e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
@@ -52,7 +52,6 @@ vec4 getNormalEnvIntensityFlags(vec2 screenpos, out vec3 n, out float envIntensi
vec2 getScreenXY(vec4 clip);
vec2 getScreenCoord(vec4 clip);
vec3 srgb_to_linear(vec3 c);
-vec3 legacy_adjust(vec3 c);
// Util
vec3 hue_to_rgb(float hue);
@@ -67,9 +66,6 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
void main()
{
-#if defined(LOCAL_LIGHT_KILL)
- discard; // Bail immediately
-#else
vec3 final_color = vec3(0, 0, 0);
vec2 tc = getScreenCoord(vary_fragcoord);
vec3 pos = getPosition(tc).xyz;
@@ -118,7 +114,7 @@ void main()
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
- vec3 intensity = dist_atten * lightColor * 3.9;
+ vec3 intensity = dist_atten * lightColor * 3.25;
final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
}
@@ -126,7 +122,6 @@ void main()
}
else
{
- diffuse.rgb = legacy_adjust(diffuse.rgb);
diffuse = srgb_to_linear(diffuse);
spec.rgb = srgb_to_linear(spec.rgb);
@@ -174,7 +169,6 @@ void main()
frag_color.rgb = max(final_color, vec3(0));
frag_color.a = 0.0;
-#endif // LOCAL_LIGHT_KILL
#ifdef IS_AMD_CARD
// If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
deleted file mode 100644
index 23120bbbbe..0000000000
--- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
+++ /dev/null
@@ -1,263 +0,0 @@
-/**
- * @file class3\deferred\multiSpotLightF.glsl
- *
- * $LicenseInfo:firstyear=2022&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2022, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-/*[EXTRA_CODE_HERE]*/
-
-out vec4 frag_color;
-
-uniform sampler2D diffuseRect;
-uniform sampler2D specularRect;
-uniform sampler2D depthMap;
-uniform sampler2D normalMap;
-uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
-uniform samplerCube environmentMap;
-uniform sampler2D lightMap;
-uniform sampler2D projectionMap; // rgba
-uniform sampler2D lightFunc;
-
-uniform mat4 proj_mat; //screen space to light space
-uniform float proj_near; //near clip for projection
-uniform vec3 proj_p; //plane projection is emitting from (in screen space)
-uniform vec3 proj_n;
-uniform float proj_focus; //distance from plane to begin blurring
-uniform float proj_lod; //(number of mips in proj map)
-uniform float proj_range; //range between near clip and far clip plane of projection
-uniform float proj_ambient_lod;
-uniform float proj_ambiance;
-uniform float near_clip;
-uniform float far_clip;
-
-uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
-uniform float sun_wash;
-uniform int proj_shadow_idx;
-uniform float shadow_fade;
-
-// Light params
-uniform vec3 center;
-uniform float size;
-uniform vec3 color;
-uniform float falloff;
-
-in vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform mat4 inv_proj;
-
-void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
-float calcLegacyDistanceAttenuation(float distance, float falloff);
-vec3 colorized_dot(float x);
-bool clipProjectedLightVars(vec3 center, vec3 pos, out float dist, out float l_dist, out vec3 lv, out vec4 proj_tc );
-vec4 getNormalEnvIntensityFlags(vec2 screenpos, out vec3 n, out float envIntensity);
-vec3 getProjectedLightAmbiance(float amb_da, float attenuation, float lit, float nl, float noise, vec2 projected_uv);
-vec3 getProjectedLightDiffuseColor(float light_distance, vec2 projected_uv );
-vec3 getProjectedLightSpecularColor(vec3 pos, vec3 n);
-vec2 getScreenXY(vec4 clip);
-vec2 getScreenCoord(vec4 clip);
-vec3 srgb_to_linear(vec3 cs);
-vec3 legacy_adjust(vec3 c);
-vec4 texture2DLodSpecular(vec2 tc, float lod);
-
-vec4 getPosition(vec2 pos_screen);
-
-const float M_PI = 3.14159265;
-
-vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
- float perceptualRoughness,
- float metallic,
- vec3 n, // normal
- vec3 v, // surface point to camera
- vec3 l); //surface point to light
-
-void main()
-{
-#if defined(LOCAL_LIGHT_KILL)
- discard;
-#else
- vec3 final_color = vec3(0,0,0);
- vec2 tc = getScreenCoord(vary_fragcoord);
- vec3 pos = getPosition(tc).xyz;
-
- vec3 lv;
- vec4 proj_tc;
- float dist, l_dist;
- if (clipProjectedLightVars(center, pos, dist, l_dist, lv, proj_tc))
- {
- discard;
- }
-
- float shadow = 1.0;
-
- if (proj_shadow_idx >= 0)
- {
- vec4 shd = texture(lightMap, tc);
- shadow = (proj_shadow_idx==0)?shd.b:shd.a;
- shadow += shadow_fade;
- shadow = clamp(shadow, 0.0, 1.0);
- }
-
- float envIntensity;
- vec3 n;
- vec4 norm = getNormalEnvIntensityFlags(tc, n, envIntensity);
-
- float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
- if (dist_atten <= 0.0)
- {
- discard;
- }
-
- lv = proj_origin-pos.xyz;
- vec3 h, l, v = -normalize(pos);
- float nh, nl, nv, vh, lightDist;
- calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist);
-
- vec3 diffuse = texture(diffuseRect, tc).rgb;
- vec4 spec = texture(specularRect, tc);
- vec3 dlit = vec3(0, 0, 0);
- vec3 slit = vec3(0, 0, 0);
-
- vec3 amb_rgb = vec3(0);
-
- if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
- {
- vec3 colorEmissive = texture(emissiveRect, tc).rgb;
- vec3 orm = spec.rgb;
- float perceptualRoughness = orm.g;
- float metallic = orm.b;
- vec3 f0 = vec3(0.04);
- vec3 baseColor = diffuse.rgb;
-
- vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);
- diffuseColor *= 1.0 - metallic;
-
- vec3 specularColor = mix(f0, baseColor.rgb, metallic);
-
- // We need this additional test inside a light's frustum since a spotlight's ambiance can be applied
- if (proj_tc.x > 0.0 && proj_tc.x < 1.0
- && proj_tc.y > 0.0 && proj_tc.y < 1.0)
- {
- float lit = 0.0;
- float amb_da = 0.0;
-
- if (nl > 0.0)
- {
- amb_da += (nl*0.5 + 0.5) * proj_ambiance;
-
- dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
-
- vec3 intensity = dist_atten * dlit * 3.9 * shadow; // Legacy attenuation, magic number to balance with legacy materials
- final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv));
- }
-
- amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );
- final_color += diffuse.rgb * amb_rgb;
- }
- }
- else
- {
- diffuse = legacy_adjust(diffuse);
- diffuse = srgb_to_linear(diffuse);
- spec.rgb = srgb_to_linear(spec.rgb);
-
- if (proj_tc.z > 0.0 &&
- proj_tc.x < 1.0 &&
- proj_tc.y < 1.0 &&
- proj_tc.x > 0.0 &&
- proj_tc.y > 0.0)
- {
- float amb_da = 0;
- float lit = 0.0;
-
- if (nl > 0.0)
- {
- lit = nl * dist_atten;
-
- dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
-
- final_color = dlit*lit*diffuse*shadow;
-
- // unshadowed for consistency between forward and deferred?
- amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
- }
-
- amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );
- final_color += diffuse.rgb * amb_rgb;
- }
-
- if (spec.a > 0.0)
- {
- dlit *= min(nl*6.0, 1.0) * dist_atten;
-
- float fres = pow(1 - vh, 5)*0.4+0.5;
-
- float gtdenom = 2 * nh;
- float gt = max(0, min(gtdenom * nv / vh, gtdenom * nl / vh));
-
- if (nh > 0.0)
- {
- float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl);
- vec3 speccol = dlit*scol*spec.rgb*shadow;
- speccol = clamp(speccol, vec3(0), vec3(1));
- final_color += speccol;
- }
- }
-
- if (envIntensity > 0.0)
- {
- vec3 ref = reflect(normalize(pos), n);
-
- //project from point pos in direction ref to plane proj_p, proj_n
- vec3 pdelta = proj_p-pos;
- float ds = dot(ref, proj_n);
-
- if (ds < 0.0)
- {
- vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-
- vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
-
- if (stc.z > 0.0)
- {
- stc /= stc.w;
-
- if (stc.x < 1.0 &&
- stc.y < 1.0 &&
- stc.x > 0.0 &&
- stc.y > 0.0)
- {
- final_color += color.rgb * texture2DLodSpecular(stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * shadow * envIntensity;
- }
- }
- }
- }
- }
-
- //not sure why, but this line prevents MATBUG-194
- final_color = max(final_color, vec3(0.0));
-
- //output linear
- frag_color.rgb = final_color;
- frag_color.a = 0.0;
-#endif // LOCAL_LIGHT_KILL
-}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
index 42ba96148c..31af1208bd 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
@@ -57,7 +57,6 @@ vec4 getPosition(vec2 pos_screen);
vec2 getScreenXY(vec4 clip);
vec2 getScreenCoord(vec4 clip);
vec3 srgb_to_linear(vec3 c);
-vec3 legacy_adjust(vec3 c);
float getDepth(vec2 tc);
vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
@@ -107,7 +106,7 @@ void main()
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
- vec3 intensity = dist_atten * color * 3.9; // Legacy attenuation, magic number to balance with legacy materials
+ vec3 intensity = dist_atten * color * 3.25; // Legacy attenuation, magic number to balance with legacy materials
final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv));
}
else
@@ -116,7 +115,6 @@ void main()
{
discard;
}
- diffuse = legacy_adjust(diffuse);
diffuse = srgb_to_linear(diffuse);
spec.rgb = srgb_to_linear(spec.rgb);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index 41821def8e..906e66ecc8 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -530,7 +530,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,
// w - weight of sample (distance and angular attenuation)
// dw - weight of sample (distance only)
// i - index of probe
-vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i)
+vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i, vec3 amblit)
{
// parallax adjustment
vec3 v;
@@ -556,9 +556,12 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int
v -= c;
v = env_mat * v;
- {
- return textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x;
- }
+
+ vec3 col = textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x;
+
+ col = mix(amblit, col, min(refParams[i].x, 1.0));
+
+ return col;
}
vec3 sampleProbes(vec3 pos, vec3 dir, float lod)
@@ -619,7 +622,7 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod)
return col[1]+col[0];
}
-vec3 sampleProbeAmbient(vec3 pos, vec3 dir)
+vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit)
{
// modified copy/paste of sampleProbes follows, will likely diverge from sampleProbes further
// as irradiance map mixing is tuned independently of radiance map mixing
@@ -649,7 +652,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir)
float w = 0;
float dw = 0;
- vec3 refcol = tapIrradianceMap(pos, dir, w, dw, refSphere[i].xyz, i);
+ vec3 refcol = tapIrradianceMap(pos, dir, w, dw, refSphere[i].xyz, i, amblit);
col[p] += refcol*w;
wsum[p] += w;
@@ -679,14 +682,14 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir)
}
void doProbeSample(inout vec3 ambenv, inout vec3 glossenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent)
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit)
{
// TODO - don't hard code lods
float reflection_lods = max_probe_lod;
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
- ambenv = sampleProbeAmbient(pos, norm);
+ ambenv = sampleProbeAmbient(pos, norm, amblit);
float lod = (1.0-glossiness)*reflection_lods;
glossenv = sampleProbes(pos, normalize(refnormpersp), lod);
@@ -712,14 +715,14 @@ void doProbeSample(inout vec3 ambenv, inout vec3 glossenv,
}
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent)
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit)
{
preProbeSample(pos);
- doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, transparent);
+ doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, transparent, amblit);
}
void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness)
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, vec3 amblit)
{
// don't sample automatic probes for water
sample_automatic = false;
@@ -728,7 +731,7 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,
// always include void probe on water
probeIndex[probeInfluences++] = 0;
- doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, false);
+ doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, false, amblit);
// fudge factor to get PBR water at a similar luminance ot legacy water
glossenv *= 0.4;
@@ -783,14 +786,14 @@ vec4 sampleReflectionProbesDebug(vec3 pos)
}
void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent)
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit)
{
float reflection_lods = max_probe_lod;
preProbeSample(pos);
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
- ambenv = sampleProbeAmbient(pos, norm);
+ ambenv = sampleProbeAmbient(pos, norm, amblit);
if (glossiness > 0.0)
{
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 4ef003e0cb..35e99c5bd2 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -69,16 +69,15 @@ vec3 scaleSoftClipFragLinear(vec3 l);
// reflection probe interface
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent);
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear);
void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent);
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear);
void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm);
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity);
float getDepth(vec2 pos_screen);
vec3 linear_to_srgb(vec3 c);
vec3 srgb_to_linear(vec3 c);
-vec3 legacy_adjust(vec3 c);
uniform vec4 waterPlane;
@@ -117,10 +116,10 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
vec3 l); //surface point to light
-void adjustIrradiance(inout vec3 irradiance, vec3 amblit_linear, float ambocc)
+void adjustIrradiance(inout vec3 irradiance, float ambocc)
{
// use sky settings ambient or irradiance map sample, whichever is brighter
- irradiance = max(amblit_linear, irradiance);
+ //irradiance = max(amblit_linear, irradiance);
#if defined(HAS_SSAO)
irradiance = mix(ssao_effect_mat * min(irradiance.rgb*ssao_irradiance_scale, vec3(ssao_irradiance_max)), irradiance.rgb, ambocc);
@@ -194,9 +193,9 @@ void main()
// PBR IBL
float gloss = 1.0 - perceptualRoughness;
- sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false);
+ sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear);
- adjustIrradiance(irradiance, amblit_linear, ambocc);
+ adjustIrradiance(irradiance, ambocc);
vec3 diffuseColor;
vec3 specularColor;
@@ -220,8 +219,6 @@ void main()
else
{
// legacy shaders are still writng sRGB to gbuffer
- baseColor.rgb = legacy_adjust(baseColor.rgb);
-
baseColor.rgb = srgb_to_linear(baseColor.rgb);
spec.rgb = srgb_to_linear(spec.rgb);
@@ -232,9 +229,9 @@ void main()
vec3 glossenv = vec3(0);
vec3 legacyenv = vec3(0);
- sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false);
+ sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false, amblit_linear);
- adjustIrradiance(irradiance, amblit_linear, ambocc);
+ adjustIrradiance(irradiance, ambocc);
// apply lambertian IBL only (see pbrIbl)
color.rgb = irradiance;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
index 1ea801d7d7..d31b37fb60 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
@@ -25,16 +25,6 @@
/*[EXTRA_CODE_HERE]*/
-#define DEBUG_ANY_LIGHT_TYPE 0 // Output green light cone
-#define DEBUG_LEG_LIGHT_TYPE 0 // Show Legacy objects in green
-#define DEBUG_PBR_LIGHT_TYPE 0 // Show PBR objects in green
-#define DEBUG_PBR_SPOT 0
-#define DEBUG_PBR_SPOT_DIFFUSE 0
-#define DEBUG_PBR_SPOT_SPECULAR 0
-
-#define DEBUG_SPOT_NL 0 // monochome area effected by light
-#define DEBUG_SPOT_ZERO 0 // Output zero for spotlight
-
out vec4 frag_color;
uniform sampler2D diffuseRect;
@@ -64,11 +54,16 @@ uniform float sun_wash;
uniform int proj_shadow_idx;
uniform float shadow_fade;
+// Light params
+#if defined(MULTI_SPOTLIGHT)
+uniform vec3 center;
+#else
+in vec3 trans_center;
+#endif
uniform float size;
uniform vec3 color;
uniform float falloff;
-in vec3 trans_center;
in vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -80,11 +75,8 @@ bool clipProjectedLightVars(vec3 center, vec3 pos, out float dist, out float l_d
vec4 getNormalEnvIntensityFlags(vec2 screenpos, out vec3 n, out float envIntensity);
vec3 getProjectedLightAmbiance(float amb_da, float attenuation, float lit, float nl, float noise, vec2 projected_uv);
vec3 getProjectedLightDiffuseColor(float light_distance, vec2 projected_uv );
-vec3 getProjectedLightSpecularColor(vec3 pos, vec3 n);
-vec2 getScreenXY(vec4 clip_point);
-vec2 getScreenCoord(vec4 clip_point);
-vec3 srgb_to_linear(vec3 c);
-vec3 legacy_adjust(vec3 c);
+vec2 getScreenCoord(vec4 clip);
+vec3 srgb_to_linear(vec3 cs);
vec4 texture2DLodSpecular(vec2 tc, float lod);
vec4 getPosition(vec2 pos_screen);
@@ -100,9 +92,6 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
void main()
{
-#if defined(LOCAL_LIGHT_KILL)
- discard;
-#else
vec3 final_color = vec3(0,0,0);
vec2 tc = getScreenCoord(vary_fragcoord);
vec3 pos = getPosition(tc).xyz;
@@ -110,24 +99,31 @@ void main()
vec3 lv;
vec4 proj_tc;
float dist, l_dist;
- if (clipProjectedLightVars(trans_center, pos, dist, l_dist, lv, proj_tc))
+ vec3 c;
+#if defined(MULTI_SPOTLIGHT)
+ c = center;
+#else
+ c = trans_center;
+#endif
+
+ if (clipProjectedLightVars(c, pos, dist, l_dist, lv, proj_tc))
{
discard;
}
float shadow = 1.0;
-
+
if (proj_shadow_idx >= 0)
{
vec4 shd = texture(lightMap, tc);
- shadow = (proj_shadow_idx == 0) ? shd.b : shd.a;
+ shadow = (proj_shadow_idx==0)?shd.b:shd.a;
shadow += shadow_fade;
- shadow = clamp(shadow, 0.0, 1.0);
+ shadow = clamp(shadow, 0.0, 1.0);
}
float envIntensity;
vec3 n;
- vec4 norm = getNormalEnvIntensityFlags(tc, n, envIntensity); // need `norm.w` for GET_GBUFFER_FLAG()
+ vec4 norm = getNormalEnvIntensityFlags(tc, n, envIntensity);
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
if (dist_atten <= 0.0)
@@ -135,7 +131,7 @@ void main()
discard;
}
- lv = proj_origin-pos.xyz; // NOTE: Re-using lv
+ lv = proj_origin-pos.xyz;
vec3 h, l, v = -normalize(pos);
float nh, nl, nv, vh, lightDist;
calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist);
@@ -146,10 +142,11 @@ void main()
vec3 slit = vec3(0, 0, 0);
vec3 amb_rgb = vec3(0);
+
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
{
- vec3 colorEmissive = texture(emissiveRect, tc).rgb;
- vec3 orm = spec.rgb;
+ vec3 colorEmissive = texture(emissiveRect, tc).rgb;
+ vec3 orm = spec.rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
vec3 f0 = vec3(0.04);
@@ -167,33 +164,34 @@ void main()
float lit = 0.0;
float amb_da = 0.0;
+ lv = normalize(lv);
+
if (nl > 0.0)
{
amb_da += (nl*0.5 + 0.5) * proj_ambiance;
dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
- vec3 intensity = dist_atten * dlit * 3.9 * shadow; // Legacy attenuation
- final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv));
+ vec3 intensity = dist_atten * dlit * 3.25 * shadow; // Legacy attenuation, magic number to balance with legacy materials
+ final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
}
- amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );
- final_color += diffuse.rgb * amb_rgb;
+ amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy ) * 3.25; //magic number to balance with legacy ambiance
+ final_color += amb_rgb * pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, -lv);
}
}
else
{
- diffuse = legacy_adjust(diffuse);
diffuse = srgb_to_linear(diffuse);
spec.rgb = srgb_to_linear(spec.rgb);
-
+
if (proj_tc.z > 0.0 &&
proj_tc.x < 1.0 &&
proj_tc.y < 1.0 &&
proj_tc.x > 0.0 &&
proj_tc.y > 0.0)
{
- float amb_da = proj_ambiance;
+ float amb_da = 0;
float lit = 0.0;
if (nl > 0.0)
@@ -204,24 +202,23 @@ void main()
final_color = dlit*lit*diffuse*shadow;
+ // unshadowed for consistency between forward and deferred?
amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;
}
-
- vec3 amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );
- final_color += diffuse.rgb*amb_rgb;
- #if DEBUG_LEG_LIGHT_TYPE
- final_color = vec3(0,0.5,0);
- #endif
+
+ amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );
+ final_color += diffuse.rgb * amb_rgb * max(dot(-normalize(lv), n), 0.0);
}
-
+
if (spec.a > 0.0)
{
dlit *= min(nl*6.0, 1.0) * dist_atten;
- float fres = pow(1 - dot(h, v), 5)*0.4+0.5;
+
+ float fres = pow(1 - vh, 5)*0.4+0.5;
float gtdenom = 2 * nh;
float gt = max(0, min(gtdenom * nv / vh, gtdenom * nl / vh));
-
+
if (nh > 0.0)
{
float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl);
@@ -229,26 +226,26 @@ void main()
speccol = clamp(speccol, vec3(0), vec3(1));
final_color += speccol;
}
- }
+ }
if (envIntensity > 0.0)
{
vec3 ref = reflect(normalize(pos), n);
-
+
//project from point pos in direction ref to plane proj_p, proj_n
vec3 pdelta = proj_p-pos;
float ds = dot(ref, proj_n);
-
+
if (ds < 0.0)
{
vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-
+
vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
if (stc.z > 0.0)
{
stc /= stc.w;
-
+
if (stc.x < 1.0 &&
stc.y < 1.0 &&
stc.x > 0.0 &&
@@ -261,24 +258,10 @@ void main()
}
}
-#if DEBUG_PBR_SPOT_DIFFUSE
- final_color = vec3(nl * dist_atten);
-#endif
-#if DEBUG_SPOT_NL
- final_color = vec3(nl);
-#endif
-#if DEBUG_SPOT_ZERO
- final_color = vec3(0,0,0);
-#endif
-#if DEBUG_ANY_LIGHT_TYPE
- final_color = vec3(0,0.3333,0);
-#endif
-
//not sure why, but this line prevents MATBUG-194
final_color = max(final_color, vec3(0.0));
- //output linear colors as gamma correction happens down stream
+ //output linear
frag_color.rgb = final_color;
frag_color.a = 0.0;
-#endif // LOCAL_LIGHT_KILL
}
diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
index 8fee259933..4f79dd1ac5 100644
--- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
@@ -124,7 +124,7 @@ vec3 transform_normal(vec3 vNt)
}
void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,
- vec2 tc, vec3 pos, vec3 norm, float glossiness);
+ vec2 tc, vec3 pos, vec3 norm, float glossiness, vec3 amblit_linear);
vec3 getPositionWithNDC(vec3 ndc);
@@ -237,7 +237,7 @@ void main()
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
- sampleReflectionProbesWater(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss);
+ sampleReflectionProbesWater(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss, amblit);
irradiance = vec3(0);