diff options
Diffstat (limited to 'indra/newview/app_settings')
16 files changed, 121 insertions, 497 deletions
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/settings.xml b/indra/newview/app_settings/settings.xml index 82545a5dda..a6b9aa0526 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -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> @@ -9057,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> @@ -12999,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> @@ -15691,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> @@ -15698,7 +15665,7 @@ <key>Type</key> <string>U32</string> <key>Value</key> - <integer>1</integer> + <integer>20</integer> </map> <key>PoolSizeUpload</key> <map> @@ -17482,6 +17449,17 @@ <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> @@ -17515,5 +17493,27 @@ <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/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 a8aa5a36a3..a1da4b1f9a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -45,7 +45,6 @@ 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, diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 3a251af240..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); @@ -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 @@ -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 be66b6feb2..35d752be02 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -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; @@ -232,9 +226,7 @@ void main() 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); @@ -246,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) @@ -261,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/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index 54a887262b..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); @@ -82,10 +80,8 @@ void main() vec4 spec = vec4(0,0,0,0); 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 af49e76984..db0daa9b7e 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); uniform vec4 clipPlane; uniform float clipSign; @@ -329,7 +327,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 @@ -395,7 +392,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/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index d42388ae78..8b7aea24ed 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -86,7 +86,6 @@ 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; @@ -234,8 +233,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); 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 } |