diff options
Diffstat (limited to 'indra')
46 files changed, 390 insertions, 301 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 102d916530..b489e2eb77 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9852,7 +9852,7 @@ <key>Type</key> <string>Boolean</string> <key>Value</key> - <integer>0</integer> + <integer>1</integer> </map> <key>RenderFlexTimeFactor</key> <map> @@ -10021,7 +10021,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <real>0.35</real> + <real>0.325</real> </map> <key>RenderGlowWarmthAmount</key> <map> @@ -10208,7 +10208,7 @@ <key>Comment</key> <string>Render influence volumes of Reflection Probes</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> <string>Boolean</string> <key>Value</key> @@ -10403,16 +10403,27 @@ <key>Value</key> <real>0</real> </map> - <key>RenderAutomaticReflectionProbes</key> + <key>RenderDefaultProbeUpdatePeriod</key> + <map> + <key>Comment</key> + <string>When RenderReflectionProbeLevel is 0, amount of time in seconds to wait between updates to reflection map.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>20.0</real> + </map> + <key>RenderReflectionProbeLevel</key> <map> <key>Comment</key> - <string>Automatic reflection probes control. 0 - disable, 1 - Terrain/water only, 2- Terrain/water + objects. Requires restart.</string> + <string>Reflection probes control. 0 - disable (one probe to rule them all), 1 - manual probes only, 2 - manual + terrain/water, 3 - Manual + Terrain/water + objects.</string> <key>Persist</key> <integer>1</integer> <key>Type</key> <string>S32</string> <key>Value</key> - <integer>2</integer> + <integer>3</integer> </map> <key>RenderReflectionRes</key> <map> diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index aa61e10c7f..8797f89e4c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -387,7 +387,7 @@ vec3 pbrIbl(vec3 diffuseColor, { // retrieve a scale and bias to F0. See [1], Figure 3 vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough); - vec3 diffuseLight = irradiance; + vec3 diffuseLight = irradiance*1.25; //magic 1.25 to balance with legacy materials vec3 specularLight = radiance; vec3 diffuse = diffuseLight * diffuseColor; @@ -563,7 +563,7 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v, vec3 ibl_spec; color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness, ibl_spec); - color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir), specContrib) * sunlit * 2.75 * scol; + color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir), specContrib) * sunlit * 3.9 * scol; //magic number to balance with legacy materials specContrib *= sunlit * 2.75 * scol; specContrib += ibl_spec; diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl index 17e24a2bf2..3c51a8e44c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -36,11 +36,8 @@ VARYING vec2 vary_texcoord0; void main() { - float shadow = 1.0; - - vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; - color.rgb = fullbrightAtmosTransport(color.rgb); - - frag_color = max(color, vec4(0)); + // NOTE: when this shader is used, only alpha is being written to + float a = diffuseLookup(vary_texcoord0.xy).a*vertex_color.a; + frag_color = vec4(0, 0, 0, a); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 11532135dd..5515d8e2a3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -42,6 +42,7 @@ 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 fullbrightAtmosTransport(vec3 light); @@ -90,8 +91,8 @@ void main() #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 = fullbrightAtmosTransport(color.rgb); - #endif frag_color = max(color, vec4(0)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index fabc61eb5e..573b522068 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -30,7 +30,6 @@ out vec4 frag_data[4]; uniform vec4 color; -uniform vec3 moonlight_color; uniform vec3 moon_dir; uniform float moon_brightness; uniform sampler2D diffuseMap; @@ -53,11 +52,7 @@ void main() discard; } - - c.rgb *= moonlight_color.rgb; c.rgb *= moon_brightness; - - c.rgb *= fade; c.a *= fade; frag_data[0] = vec4(0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskSkinnedV.glsl deleted file mode 100644 index 61c9e60744..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskSkinnedV.glsl +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file shadowAlphaMaskSkinnedV.glsl - * - * $LicenseInfo:firstyear=2021&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; -uniform mat4 projection_matrix; -uniform float shadow_target_width; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec2 texcoord0; - -VARYING vec4 post_pos; -VARYING float target_pos_x; -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void passTextureIndex(); - -mat4 getObjectSkinnedTransform(); - -void main() -{ - //transform vertex - vec4 pre_pos = vec4(position.xyz, 1.0); - - mat4 mat = getObjectSkinnedTransform(); - - mat = modelview_matrix * mat; - - vec4 pos = mat * pre_pos; - pos = projection_matrix * pos; - - target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; - - post_pos = pos; - - gl_Position = pos; - - passTextureIndex(); - - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - vertex_color = diffuse_color; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl index 40f8fc9894..2249a7f239 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl @@ -24,7 +24,12 @@ */ uniform mat4 texture_matrix0; +#if defined(HAS_SKIN) +uniform mat4 modelview_matrix; +uniform mat4 projection_matrix; +#else uniform mat4 modelview_projection_matrix; +#endif uniform float shadow_target_width; ATTRIBUTE vec3 position; @@ -38,11 +43,24 @@ VARYING vec2 vary_texcoord0; void passTextureIndex(); +#if defined(HAS_SKIN) +mat4 getObjectSkinnedTransform(); +#endif + void main() { //transform vertex +#if defined(HAS_SKIN) + vec4 pre_pos = vec4(position.xyz, 1.0); + mat4 mat = getObjectSkinnedTransform(); + mat = modelview_matrix * mat; + vec4 pos = mat * pre_pos; + pos = projection_matrix * pos; +#else vec4 pre_pos = vec4(position.xyz, 1.0); vec4 pos = modelview_projection_matrix * pre_pos; +#endif + target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; post_pos = pos; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index 62d134188c..4fa9ae3633 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -91,7 +91,7 @@ void main() vary_LightNormPosDot = rel_pos_lightnorm_dot; // Initialize temp variables - vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color; + vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color * 0.7; //magic 0.7 to match legacy color // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl index 3cca84ca14..35f2395ef1 100644 --- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl @@ -23,6 +23,8 @@ * $/LicenseInfo$ */ + uniform sampler2D exposureMap; + vec3 srgb_to_linear(vec3 cs) { vec3 low_range = cs / vec3(12.92); @@ -83,12 +85,32 @@ vec3 hsv2rgb(vec3 c) return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } -vec3 legacy_adjust_no_brighten(vec3 c) +const mat3 inv_ACESOutputMat = mat3(0.643038, 0.0592687, 0.0059619, 0.311187, 0.931436, 0.063929, 0.0457755, 0.00929492, 0.930118 ); + +const mat3 inv_ACESInputMat = mat3( 1.76474, -0.147028, -0.0363368, -0.675778, 1.16025, -0.162436, -0.0889633, -0.0132237, 1.19877 ); + +vec3 inv_RRTAndODTFit(vec3 x) { - vec3 desat = rgb2hsv(c.rgb); - desat.g *= 0.75; - desat.rgb = hsv2rgb(desat); - return desat; + float A = 0.0245786; + float B = 0.000090537; + float C = 0.983729; + float D = 0.4329510; + float E = 0.238081; + + return (A - D * x)/(2.0 * (C * x - 1.0)) - sqrt(pow(D * x - A, vec3(2.0)) - 4.0 * (C * x - 1.0) * (B + E * x))/(2.0 * (C * x - 1.0)); +} + +// experimental inverse of ACES Hill tonemapping +vec3 inv_toneMapACES_Hill(vec3 color) +{ + color = inv_ACESOutputMat * color; + + // Apply RRT and ODT + color = inv_RRTAndODTFit(color); + + color = inv_ACESInputMat * color; + + return color; } vec3 legacy_adjust(vec3 c) @@ -100,6 +122,13 @@ vec3 legacy_adjust(vec3 c) return desat; } +vec3 legacy_adjust_fullbright(vec3 c) +{ + float exp_scale = texture(exposureMap, vec2(0.5, 0.5)).r; + return c / exp_scale * 1.34; +} + + vec3 legacy_adjust_post(vec3 c) { return c; diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl index d3fa03b02a..cd7c005162 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -148,7 +148,7 @@ vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor, // spot*spot => GL_SPOT_EXPONENT=2 float spot_atten = spot*spot; - vec3 intensity = spot_atten * dist_atten * lightColor * 3.0; + vec3 intensity = spot_atten * dist_atten * lightColor * 3.9; //magic number to balance with legacy materials vec3 speccol; color = intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv, speccol); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 8abdeae5ae..e1cbfcce1a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -53,8 +53,11 @@ void main() vec4 pos = getPosition(pos_screen); vec3 norm = getNorm(pos_screen); - frag_color.r = sampleDirectionalShadow(pos.xyz, norm, pos_screen); - frag_color.g = 1.0f; - frag_color.b = sampleSpotShadow(pos.xyz, norm, 0, pos_screen); - frag_color.a = sampleSpotShadow(pos.xyz, norm, 1, pos_screen); + vec4 col; + col.r = sampleDirectionalShadow(pos.xyz, norm, pos_screen); + col.g = 1.0f; + col.b = sampleSpotShadow(pos.xyz, norm, 0, pos_screen); + col.a = sampleSpotShadow(pos.xyz, norm, 1, pos_screen); + + frag_color = clamp(col, vec4(0), vec4(1)); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 64d99bae2c..99a26a050d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -50,8 +50,11 @@ void main() vec4 pos = getPosition(pos_screen); vec3 norm = getNorm(pos_screen); - frag_color.r = sampleDirectionalShadow(pos.xyz, norm, pos_screen); - frag_color.g = calcAmbientOcclusion(pos, norm, pos_screen); - frag_color.b = sampleSpotShadow(pos.xyz, norm, 0, pos_screen); - frag_color.a = sampleSpotShadow(pos.xyz, norm, 1, pos_screen); + vec4 col; + col.r = sampleDirectionalShadow(pos.xyz, norm, pos_screen); + col.g = calcAmbientOcclusion(pos, norm, pos_screen); + col.b = sampleSpotShadow(pos.xyz, norm, 0, pos_screen); + col.a = sampleSpotShadow(pos.xyz, norm, 1, pos_screen); + + frag_color = clamp(col, vec4(0), vec4(1)); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl index 22db9dce03..4e0933f922 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl @@ -50,6 +50,7 @@ uniform float sun_moon_glow_factor; 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, @@ -63,8 +64,8 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 rel_pos_norm = normalize(rel_pos); float rel_pos_len = length(rel_pos); - vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color; - + vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color * 0.7; // magic 0.7 to match legacy color + // sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index 5a2924afe5..2da177ea7e 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -124,7 +124,7 @@ void main() float dist_atten = calcLegacyDistanceAttenuation(dist, falloff); - vec3 intensity = dist_atten * lightColor * 3.0; + vec3 intensity = dist_atten * lightColor * 3.9; final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv); } diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl index 33e5b2346c..33715d4d87 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl @@ -173,7 +173,7 @@ void main() dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy ); - vec3 intensity = dist_atten * dlit * 3.0 * shadow; // Legacy attenuation + 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)); } diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 471e5e7fd3..7724a6cac9 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -113,7 +113,7 @@ void main() vec3 specularColor = mix(f0, baseColor.rgb, metallic); - vec3 intensity = dist_atten * color * 3.0; // Legacy attenuation + vec3 intensity = dist_atten * color * 3.9; // Legacy attenuation, magic number to balance with legacy materials final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv)); } else diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 55a43f76d0..36b5262104 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -122,6 +122,7 @@ bool shouldSampleProbe(int i, vec3 pos) // populate "probeIndex" with N probe indices that influence pos where N is REF_SAMPLE_COUNT void preProbeSample(vec3 pos) { +#if REFMAP_LEVEL > 0 // TODO: make some sort of structure that reduces the number of distance checks for (int i = 1; i < refmapCount; ++i) { @@ -213,6 +214,9 @@ void preProbeSample(vec3 pos) { // probe at index 0 is a special probe for smoothing out automatic probes probeIndex[probeInfluences++] = 0; } +#else + probeIndex[probeInfluences++] = 0; +#endif } // from https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index ab83708c7b..a8d61afeca 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -246,20 +246,6 @@ void main() vec3 refnormpersp = reflect(pos.xyz, norm.xyz); -#if 0 // wrong implementation - if (spec.a > 0.0) // specular reflection - { - float sa = dot(normalize(refnormpersp), light_dir.xyz); - vec3 dumbshiny = sunlit * scol * (texture2D(lightFunc, vec2(sa, spec.a)).r); - - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - color.rgb += spec_contrib; - - // add radiance map - applyGlossEnv(color, glossenv, spec, pos.xyz, norm.xyz); - } -#else //right implementation (ported from pointLightF.glsl) if (spec.a > 0.0) { vec3 lv = light_dir.xyz; @@ -284,7 +270,6 @@ void main() // add radiance map applyGlossEnv(color, glossenv, spec, pos.xyz, norm.xyz); } -#endif color.rgb = mix(color.rgb, baseColor.rgb, baseColor.a); diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index 3d06bb27a5..f2ab585716 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -180,7 +180,7 @@ void main() dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy ); - vec3 intensity = dist_atten * dlit * 3.0 * shadow; // Legacy attenuation + vec3 intensity = dist_atten * dlit * 3.9 * shadow; // Legacy attenuation final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv)); } diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 99007d52c2..78c2578cec 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 54 +version 55 // The version number above should be incremented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -62,6 +62,7 @@ Disregard96DefaultDrawDistance 1 1 RenderCompressTextures 1 1 RenderShaderLightingMaxLevel 1 3 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 RenderDeferred 1 1 RenderDeferredSSAO 1 1 RenderUseAdvancedAtmospherics 1 0 @@ -104,6 +105,7 @@ WLSkyDetail 1 96 RenderFSAASamples 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 8 +RenderReflectionProbeLevel 1 0 // // Medium Low Graphics Settings @@ -133,6 +135,7 @@ WLSkyDetail 1 96 RenderFSAASamples 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 16 +RenderReflectionProbeLevel 1 1 // // Medium Graphics Settings (standard) @@ -162,6 +165,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 32 +RenderReflectionProbeLevel 1 2 // // Medium High Graphics Settings (deferred enabled) @@ -191,6 +195,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 64 +RenderReflectionProbeLevel 1 2 // // High Graphics Settings (deferred + SSAO) @@ -220,6 +225,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 128 +RenderReflectionProbeLevel 1 3 // // High Ultra Graphics Settings (deferred + SSAO + shadows) @@ -249,6 +255,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Ultra graphics (REALLY PURTY!) @@ -278,6 +285,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 1 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Class Unknown Hardware (unknown) diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 24023901d9..1d407b52d8 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 49 +version 50 // The version number above should be incremented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -73,6 +73,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 2 RenderScreenSpaceReflections 1 1 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Low Graphics Settings @@ -102,6 +103,7 @@ RenderReflectionsEnabled 1 0 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 8 +RenderReflectionProbeLevel 1 0 // // Medium Low Graphics Settings @@ -131,6 +133,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 16 +RenderReflectionProbeLevel 1 1 // // Medium Graphics Settings (standard) @@ -160,6 +163,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 32 +RenderReflectionProbeLevel 1 2 // // Medium High Graphics Settings (deferred enabled) @@ -189,6 +193,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 64 +RenderReflectionProbeLevel 1 2 // // High Graphics Settings (deferred + SSAO) @@ -218,6 +223,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 128 +RenderReflectionProbeLevel 1 3 // // High Ultra Graphics Settings (deferred + SSAO + shadows) @@ -247,6 +253,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Ultra graphics (REALLY PURTY!) @@ -276,6 +283,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 1 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Class Unknown Hardware (unknown) diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index c61618c056..2eb277fc4e 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -452,21 +452,26 @@ void LLRenderPass::pushGLTFBatches(U32 type) LLDrawInfo& params = **i; LLCullResult::increment_iterator(i, end); - auto& mat = params.mGLTFMaterial; + pushGLTFBatch(params); + } +} - mat->bind(params.mTexture); +void LLRenderPass::pushGLTFBatch(LLDrawInfo& params) +{ + auto& mat = params.mGLTFMaterial; - LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0); + mat->bind(params.mTexture); - setup_texture_matrix(params); - - applyModelMatrix(params); + LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0); - params.mVertexBuffer->setBuffer(); - params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + setup_texture_matrix(params); + + applyModelMatrix(params); - teardown_texture_matrix(params); - } + params.mVertexBuffer->setBuffer(); + params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + + teardown_texture_matrix(params); } void LLRenderPass::pushRiggedGLTFBatches(U32 type) @@ -483,28 +488,20 @@ void LLRenderPass::pushRiggedGLTFBatches(U32 type) LLDrawInfo& params = **i; LLCullResult::increment_iterator(i, end); - auto& mat = params.mGLTFMaterial; - - mat->bind(params.mTexture); - - LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0); - - setup_texture_matrix(params); - - applyModelMatrix(params); - - if (params.mAvatar.notNull() && (lastAvatar != params.mAvatar || lastMeshId != params.mSkinInfo->mHash)) - { - uploadMatrixPalette(params); - lastAvatar = params.mAvatar; - lastMeshId = params.mSkinInfo->mHash; - } - - params.mVertexBuffer->setBuffer(); - params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); + pushRiggedGLTFBatch(params, lastAvatar, lastMeshId); + } +} - teardown_texture_matrix(params); +void LLRenderPass::pushRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId) +{ + if (params.mAvatar.notNull() && (lastAvatar != params.mAvatar || lastMeshId != params.mSkinInfo->mHash)) + { + uploadMatrixPalette(params); + lastAvatar = params.mAvatar; + lastMeshId = params.mSkinInfo->mHash; } + + pushGLTFBatch(params); } void LLRenderPass::pushBatches(U32 type, bool texture, bool batch_textures) diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 5e741b2b95..09c95a1705 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -329,6 +329,10 @@ public: return "PASS_GLTF_PBR"; case PASS_GLTF_PBR_RIGGED: return "PASS_GLTF_PBR_RIGGED"; + case PASS_GLTF_PBR_ALPHA_MASK: + return "PASS_GLTF_PBR_ALPHA_MASK"; + case PASS_GLTF_PBR_ALPHA_MASK_RIGGED: + return "PASS_GLTF_PBR_ALPHA_MASK_RIGGED"; default: return "Unknown pass"; } @@ -348,7 +352,9 @@ public: virtual void pushBatches(U32 type, bool texture = true, bool batch_textures = false); virtual void pushRiggedBatches(U32 type, bool texture = true, bool batch_textures = false); void pushGLTFBatches(U32 type); + void pushGLTFBatch(LLDrawInfo& params); void pushRiggedGLTFBatches(U32 type); + void pushRiggedGLTFBatch(LLDrawInfo& params, LLVOAvatar*& lastAvatar, U64& lastMeshId); virtual void pushMaskBatches(U32 type, bool texture = true, bool batch_textures = false); virtual void pushRiggedMaskBatches(U32 type, bool texture = true, bool batch_textures = false); virtual void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index f4b426c5ab..280be162bc 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -140,6 +140,12 @@ static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma, bool d shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); } + S32 channel = shader->enableTexture(LLShaderMgr::EXPOSURE_MAP); + if (channel > -1) + { + gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap); + } + //also prepare rigged variant if (shader->mRiggedVariant && shader->mRiggedVariant != shader) { diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index c956af97a5..3cc101b325 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -62,6 +62,13 @@ static void setup_glow_shader(LLGLSLShader* shader) static void setup_fullbright_shader(LLGLSLShader* shader) { setup_glow_shader(shader); + + S32 channel = shader->enableTexture(LLShaderMgr::EXPOSURE_MAP); + if (channel > -1) + { + gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap); + } + shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index d7e4632ab0..5554112043 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1081,21 +1081,27 @@ void LLFace::updateRebuildFlags() bool LLFace::canRenderAsMask() { - if (LLPipeline::sNoAlpha) + const LLTextureEntry* te = getTextureEntry(); + if( !te || !getViewerObject() || !getTexture() ) { - return true; + return false; } + if (te->getGLTFRenderMaterial()) + { + return false; + } + + if (LLPipeline::sNoAlpha) + { + return true; + } + if (isState(LLFace::RIGGED)) { // never auto alpha-mask rigged faces return false; } - const LLTextureEntry* te = getTextureEntry(); - if( !te || !getViewerObject() || !getTexture() ) - { - return false; - } LLMaterial* mat = te->getMaterialParams(); if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index 4efe1ad189..1f7d672062 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -70,13 +70,16 @@ void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex) LLViewerTexture* baseColorTex = media_tex ? media_tex : mBaseColorTexture; LLViewerTexture* emissiveTex = media_tex ? media_tex : mEmissiveTexture; - if (mAlphaMode == LLGLTFMaterial::ALPHA_MODE_MASK) + if (!LLPipeline::sShadowRender || (mAlphaMode == LLGLTFMaterial::ALPHA_MODE_MASK)) { - // dividing the alpha cutoff by transparency here allows the shader to compare against - // the alpha value of the texture without needing the transparency value - min_alpha = mAlphaCutoff/mBaseColor.mV[3]; + if (mAlphaMode == LLGLTFMaterial::ALPHA_MODE_MASK) + { + // dividing the alpha cutoff by transparency here allows the shader to compare against + // the alpha value of the texture without needing the transparency value + min_alpha = mAlphaCutoff/mBaseColor.mV[3]; + } + shader->uniform1f(LLShaderMgr::MINIMUM_ALPHA, min_alpha); } - shader->uniform1f(LLShaderMgr::MINIMUM_ALPHA, min_alpha); if (baseColorTex != nullptr) { diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 08ce43434f..151d7fa969 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -162,49 +162,43 @@ public: LLSD message; - - sparam_t::const_iterator it = strings.begin(); - if (it != strings.end()) + bool success = true; + for(const std::string& llsdRaw : strings) { - const std::string& llsdRaw = *it++; std::istringstream llsdData(llsdRaw); if (!LLSDSerialize::deserialize(message, llsdData, llsdRaw.length())) { LL_WARNS() << "LLGLTFMaterialOverrideDispatchHandler: Attempted to read parameter data into LLSD but failed:" << llsdRaw << LL_ENDL; + success = false; + continue; } - } - else - { - // malformed message, nothing we can do to handle it - LL_DEBUGS("GLTF") << "Empty message" << LL_ENDL; - return false; - } - - LLGLTFOverrideCacheEntry object_override; - if (!object_override.fromLLSD(message)) - { - // malformed message, nothing we can do to handle it - LL_DEBUGS("GLTF") << "Message without id:" << message << LL_ENDL; - return false; - } - - // Cache the data - { - LL_DEBUGS("GLTF") << "material overrides cache" << LL_ENDL; - - LLViewerRegion * region = LLWorld::instance().getRegionFromHandle(object_override.mRegionHandle); - if (region) + LLGLTFOverrideCacheEntry object_override; + if (!object_override.fromLLSD(message)) { - region->cacheFullUpdateGLTFOverride(object_override); + // malformed message, nothing we can do to handle it + LL_DEBUGS("GLTF") << "Message without id:" << message << LL_ENDL; + success = false; + continue; } - else + + // Cache the data { - LL_WARNS("GLTF") << "could not access region for material overrides message cache, region_handle: " << LL_ENDL; + LLViewerRegion * region = LLWorld::instance().getRegionFromHandle(object_override.mRegionHandle); + + if (region) + { + region->cacheFullUpdateGLTFOverride(object_override); + } + else + { + LL_WARNS("GLTF") << "could not access region for material overrides message cache, region_handle: " << LL_ENDL; + } } + applyData(object_override); } - applyData(object_override); - return true; + + return success; } void doSelectionCallbacks(const LLUUID& object_id, S32 side) diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index d464ea0571..b7fdead3f9 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -179,6 +179,7 @@ bool LLLocalGLTFMaterial::updateSelf() LLFetchedGLTFMaterial* render_mat = (LLFetchedGLTFMaterial*)entry->getGLTFRenderMaterial(); if (render_mat) { + llassert(dynamic_cast<LLFetchedGLTFMaterial*>(entry->getGLTFRenderMaterial()) != nullptr); *render_mat = *this; render_mat->applyOverride(*override_mat); } diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 624fbd1758..72dab0cba8 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -263,6 +263,30 @@ bool LLReflectionMap::isActive() return mCubeIndex != -1; } +bool LLReflectionMap::isRelevant() +{ + static LLCachedControl<S32> RenderReflectionProbeLevel(gSavedSettings, "RenderReflectionProbeLevel", 3); + + if (mViewerObject && RenderReflectionProbeLevel > 0) + { // not an automatic probe + return true; + } + + if (RenderReflectionProbeLevel == 3) + { // all automatics are relevant + return true; + } + + if (RenderReflectionProbeLevel == 2) + { // terrain and water only, ignore probes that have a group + return !mGroup; + } + + // no automatic probes, yes manual probes + return mViewerObject != nullptr; +} + + void LLReflectionMap::doOcclusion(const LLVector4a& eye) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; diff --git a/indra/newview/llreflectionmap.h b/indra/newview/llreflectionmap.h index d639f6a54c..803f7bdc97 100644 --- a/indra/newview/llreflectionmap.h +++ b/indra/newview/llreflectionmap.h @@ -72,6 +72,9 @@ public: // perform occlusion query/readback void doOcclusion(const LLVector4a& eye); + // return false if this probe isn't currently relevant (for example, disabled due to graphics preferences) + bool isRelevant(); + // point at which environment map was last generated from (in agent space) LLVector4a mOrigin; diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index ea2db63560..88edbc9224 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -173,6 +173,8 @@ void LLReflectionMapManager::update() bool did_update = false; static LLCachedControl<S32> sDetail(gSavedSettings, "RenderReflectionProbeDetail", -1); + static LLCachedControl<S32> sLevel(gSavedSettings, "RenderReflectionProbeLevel", 3); + bool realtime = sDetail >= (S32)LLReflectionMapManager::DetailLevel::REALTIME; LLReflectionMap* closestDynamic = nullptr; @@ -198,6 +200,11 @@ void LLReflectionMapManager::update() continue; } + if (probe != mDefaultProbe && !probe->isRelevant()) + { + continue; + } + probe->mProbeIndex = i; LLVector4a d; @@ -270,6 +277,13 @@ void LLReflectionMapManager::update() mRadiancePass = radiance_pass; } + static LLCachedControl<F32> sUpdatePeriod(gSavedSettings, "RenderDefaultProbeUpdatePeriod", 20.f); + if (sLevel == 0 && + gFrameTimeSeconds - mDefaultProbe->mLastUpdateTime < sUpdatePeriod) + { // when probes are disabled don't update the default probe more often than once every 20 seconds + oldestProbe = nullptr; + } + // switch to updating the next oldest probe if (!did_update && oldestProbe != nullptr) { @@ -360,17 +374,13 @@ void LLReflectionMapManager::getReflectionMaps(std::vector<LLReflectionMap*>& ma LLReflectionMap* LLReflectionMapManager::registerSpatialGroup(LLSpatialGroup* group) { - static LLCachedControl<S32> automatic_probes(gSavedSettings, "RenderAutomaticReflectionProbes", 2); - if (automatic_probes > 1) + if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) { - if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) + OctreeNode* node = group->getOctreeNode(); + F32 size = node->getSize().getF32ptr()[0]; + if (size >= 15.f && size <= 17.f) { - OctreeNode* node = group->getOctreeNode(); - F32 size = node->getSize().getF32ptr()[0]; - if (size >= 15.f && size <= 17.f) - { - return addProbe(group); - } + return addProbe(group); } } diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h index 066b1e380f..234bde51a8 100644 --- a/indra/newview/llreflectionmapmanager.h +++ b/indra/newview/llreflectionmapmanager.h @@ -77,6 +77,7 @@ public: // presently hacked into LLViewerObject::setTE // Used by LLViewerObjects that are Reflection Probes + // vobj must not be null // Guaranteed to not return null LLReflectionMap* registerViewerObject(LLViewerObject* vobj); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 6c38550049..0dd1ff5483 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -573,6 +573,7 @@ void LLFloaterTexturePicker::draw() if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL) { mGLTFMaterial = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mImageAssetID); + llassert(mGLTFMaterial == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(gGLTFMaterialList.getMaterial(mImageAssetID)) != nullptr); } else { diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 8973d1c099..bbdae95b7f 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -420,6 +420,7 @@ static bool handleReflectionProbeDetailChanged(const LLSD& newvalue) gPipeline.releaseGLBuffers(); gPipeline.createGLBuffers(); LLViewerShaderMgr::instance()->setShaders(); + gPipeline.mReflectionMapManager.reset(); } return true; } @@ -652,6 +653,7 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderDeferredNoise", handleReleaseGLBufferChanged); setting_setup_signal_listener(gSavedSettings, "RenderDebugPipeline", handleRenderDebugPipelineChanged); setting_setup_signal_listener(gSavedSettings, "RenderResolutionDivisor", handleRenderResolutionDivisorChanged); + setting_setup_signal_listener(gSavedSettings, "RenderReflectionProbeLevel", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderReflectionProbeDetail", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderReflectionsEnabled", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderScreenSpaceReflections", handleReflectionProbeDetailChanged); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e641ac4215..100c73377f 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4957,10 +4957,12 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) } LLFetchedGLTFMaterial* mat = (LLFetchedGLTFMaterial*) getTE(te)->getGLTFRenderMaterial(); + llassert(mat == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(getTE(te)->getGLTFRenderMaterial()) != nullptr); LLUUID mat_id = getRenderMaterialID(te); if (mat == nullptr && mat_id.notNull()) { mat = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mat_id); + llassert(mat == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(gGLTFMaterialList.getMaterial(mat_id)) != nullptr); if (mat->isFetching()) { // material is not loaded yet, rebuild draw info when the object finishes loading mat->onMaterialComplete([id=getID()] @@ -5383,7 +5385,7 @@ S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_ma } LLFetchedGLTFMaterial* src_mat = (LLFetchedGLTFMaterial*) tep->getGLTFMaterial(); - + llassert(src_mat == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(tep->getGLTFMaterial()) != nullptr); // if override mat exists, we must also have a source mat if (!src_mat) { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d3ee6daa6f..402d03bc6e 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1255,43 +1255,40 @@ U32 LLViewerRegion::getNumOfVisibleGroups() const void LLViewerRegion::updateReflectionProbes() { - static LLCachedControl<S32> automatic_probes(gSavedSettings, "RenderAutomaticReflectionProbes", 2); - if (automatic_probes > 0) - { - const F32 probe_spacing = 32.f; - const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); - const F32 hover_height = 2.f; + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + const F32 probe_spacing = 32.f; + const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); + const F32 hover_height = 2.f; - F32 start = probe_spacing * 0.5f; + F32 start = probe_spacing * 0.5f; - U32 grid_width = REGION_WIDTH_METERS / probe_spacing; + U32 grid_width = REGION_WIDTH_METERS / probe_spacing; - mReflectionMaps.resize(grid_width * grid_width); + mReflectionMaps.resize(grid_width * grid_width); - F32 water_height = getWaterHeight(); - LLVector3 origin = getOriginAgent(); + F32 water_height = getWaterHeight(); + LLVector3 origin = getOriginAgent(); - for (U32 i = 0; i < grid_width; ++i) + for (U32 i = 0; i < grid_width; ++i) + { + F32 x = i * probe_spacing + start; + for (U32 j = 0; j < grid_width; ++j) { - F32 x = i * probe_spacing + start; - for (U32 j = 0; j < grid_width; ++j) - { - F32 y = j * probe_spacing + start; + F32 y = j * probe_spacing + start; - U32 idx = i * grid_width + j; + U32 idx = i * grid_width + j; - if (mReflectionMaps[idx].isNull()) - { - mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe(); - } + if (mReflectionMaps[idx].isNull()) + { + mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe(); + } - LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y))); - probe_origin.mV[2] += hover_height; - probe_origin += origin; + LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y))); + probe_origin.mV[2] += hover_height; + probe_origin += origin; - mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); - mReflectionMaps[idx]->mRadius = probe_radius; - } + mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); + mReflectionMaps[idx]->mRadius = probe_radius; } } } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index b0123a116a..63cc7ba623 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -154,8 +154,9 @@ LLGLSLShader gDeferredShadowProgram; LLGLSLShader gDeferredSkinnedShadowProgram; LLGLSLShader gDeferredShadowCubeProgram; LLGLSLShader gDeferredShadowAlphaMaskProgram; -LLGLSLShader gDeferredShadowGLTFAlphaMaskProgram; LLGLSLShader gDeferredSkinnedShadowAlphaMaskProgram; +LLGLSLShader gDeferredShadowGLTFAlphaMaskProgram; +LLGLSLShader gDeferredSkinnedShadowGLTFAlphaMaskProgram; LLGLSLShader gDeferredShadowFullbrightAlphaMaskProgram; LLGLSLShader gDeferredSkinnedShadowFullbrightAlphaMaskProgram; LLGLSLShader gDeferredAvatarShadowProgram; @@ -659,6 +660,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() bool has_reflection_probes = gSavedSettings.getBOOL("RenderReflectionsEnabled") && gGLManager.mGLVersion > 3.99f; S32 probe_count = llclamp(gSavedSettings.getS32("RenderReflectionProbeCount"), 1, LL_MAX_REFLECTION_PROBE_COUNT); + S32 probe_level = llclamp(gSavedSettings.getS32("RenderReflectionProbeLevel"), 0, 3); if (ambient_kill) { @@ -695,6 +697,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() if (has_reflection_probes) { attribs["REFMAP_COUNT"] = std::to_string(probe_count); + attribs["REFMAP_LEVEL"] = std::to_string(probe_level); attribs["REF_SAMPLE_COUNT"] = "32"; } @@ -971,8 +974,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedShadowProgram.unload(); gDeferredShadowCubeProgram.unload(); gDeferredShadowAlphaMaskProgram.unload(); - gDeferredShadowGLTFAlphaMaskProgram.unload(); gDeferredSkinnedShadowAlphaMaskProgram.unload(); + gDeferredShadowGLTFAlphaMaskProgram.unload(); + gDeferredSkinnedShadowGLTFAlphaMaskProgram.unload(); gDeferredShadowFullbrightAlphaMaskProgram.unload(); gDeferredSkinnedShadowFullbrightAlphaMaskProgram.unload(); gDeferredAvatarShadowProgram.unload(); @@ -2309,29 +2313,12 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("DEPTH_CLAMP", "1"); gDeferredShadowFullbrightAlphaMaskProgram.addPermutation("IS_FULLBRIGHT", "1"); gDeferredShadowFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - gDeferredShadowFullbrightAlphaMaskProgram.mRiggedVariant = &gDeferredSkinnedShadowFullbrightAlphaMaskProgram; - success = gDeferredShadowFullbrightAlphaMaskProgram.createShader(NULL, NULL); + success = make_rigged_variant(gDeferredShadowFullbrightAlphaMaskProgram, gDeferredSkinnedShadowFullbrightAlphaMaskProgram); + success = success && gDeferredShadowFullbrightAlphaMaskProgram.createShader(NULL, NULL); llassert(success); } if (success) - { - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.mName = "Deferred Skinned Shadow Fullbright Alpha Mask Shader"; - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.mFeatures.hasObjectSkinning = true; - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.mShaderFiles.clear(); - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskSkinnedV.glsl", GL_VERTEX_SHADER)); - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER)); - - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.clearPermutations(); - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.addPermutation("DEPTH_CLAMP", "1"); - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.addPermutation("IS_FULLBRIGHT", "1"); - gDeferredSkinnedShadowFullbrightAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredSkinnedShadowFullbrightAlphaMaskProgram.createShader(NULL, NULL); - llassert(success); - } - - if (success) { gDeferredShadowAlphaMaskProgram.mName = "Deferred Shadow Alpha Mask Shader"; gDeferredShadowAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; @@ -2340,15 +2327,15 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER)); gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER)); gDeferredShadowAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - gDeferredShadowAlphaMaskProgram.mRiggedVariant = &gDeferredSkinnedShadowAlphaMaskProgram; - success = gDeferredShadowAlphaMaskProgram.createShader(NULL, NULL); + success = make_rigged_variant(gDeferredShadowAlphaMaskProgram, gDeferredSkinnedShadowAlphaMaskProgram); + success = success && gDeferredShadowAlphaMaskProgram.createShader(NULL, NULL); llassert(success); } if (success) { - gDeferredShadowGLTFAlphaMaskProgram.mName = "Deferred Shadow Alpha Mask Shader"; + gDeferredShadowGLTFAlphaMaskProgram.mName = "Deferred GLTF Shadow Alpha Mask Shader"; gDeferredShadowGLTFAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredShadowGLTFAlphaMaskProgram.mShaderFiles.clear(); gDeferredShadowGLTFAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER)); @@ -2356,21 +2343,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredShadowGLTFAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; gDeferredShadowGLTFAlphaMaskProgram.clearPermutations(); gDeferredShadowGLTFAlphaMaskProgram.addPermutation("GLTF", "1"); - gDeferredShadowGLTFAlphaMaskProgram.mRiggedVariant = &gDeferredSkinnedShadowAlphaMaskProgram; - success = gDeferredShadowGLTFAlphaMaskProgram.createShader(NULL, NULL); - llassert(success); - } - - if (success) - { - gDeferredSkinnedShadowAlphaMaskProgram.mName = "Deferred Skinned Shadow Alpha Mask Shader"; - gDeferredSkinnedShadowAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; - gDeferredSkinnedShadowAlphaMaskProgram.mFeatures.hasObjectSkinning = true; - gDeferredSkinnedShadowAlphaMaskProgram.mShaderFiles.clear(); - gDeferredSkinnedShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskSkinnedV.glsl", GL_VERTEX_SHADER)); - gDeferredSkinnedShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER)); - gDeferredSkinnedShadowAlphaMaskProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - success = gDeferredSkinnedShadowAlphaMaskProgram.createShader(NULL, NULL); + success = make_rigged_variant(gDeferredShadowGLTFAlphaMaskProgram, gDeferredSkinnedShadowGLTFAlphaMaskProgram); + success = success && gDeferredShadowGLTFAlphaMaskProgram.createShader(NULL, NULL); llassert(success); } diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 1449844588..d4c5e5535e 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -914,6 +914,7 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag // stats const LLTextureEntry* te = face->getTextureEntry(); LLFetchedGLTFMaterial* mat = te ? (LLFetchedGLTFMaterial*)te->getGLTFRenderMaterial() : nullptr; + llassert(mat == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(te->getGLTFRenderMaterial()) != nullptr); if (mat) { touch_texture(mat->mBaseColorTexture, vsize); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index cbb2d4ac76..7cc3337243 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -623,7 +623,7 @@ private: //-------------------------------------------------------------------- public: virtual LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLGLTexture::BOOST_AVATAR; } - virtual LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLGLTexture::BOOST_AVATAR_BAKED_SELF; } + virtual LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLGLTexture::BOOST_AVATAR_BAKED; } virtual S32 getTexImageSize() const; /*virtual*/ S32 getTexImageArea() const { return getTexImageSize()*getTexImageSize(); } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 77849c668a..a73d149b10 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5291,6 +5291,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLUUID mat_id; auto* gltf_mat = (LLFetchedGLTFMaterial*) facep->getTextureEntry()->getGLTFRenderMaterial(); + llassert(gltf_mat == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(facep->getTextureEntry()->getGLTFRenderMaterial()) != nullptr); if (gltf_mat != nullptr) { mat_id = gltf_mat->getHash(); // TODO: cache this hash @@ -5466,6 +5467,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_info->validate(); } + llassert(info->mGLTFMaterial == nullptr || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TANGENT) != 0); llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR || info->mGLTFMaterial != nullptr); llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_RIGGED || info->mGLTFMaterial != nullptr); llassert(type != LLPipeline::RENDER_TYPE_PASS_GLTF_PBR_ALPHA_MASK || info->mGLTFMaterial != nullptr); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index fb39e0a8ea..60d19bf1d6 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6754,7 +6754,8 @@ void LLPipeline::renderShadowSimple(U32 type) gGLLastMatrix = NULL; } -void LLPipeline::renderAlphaObjects(bool texture, bool batch_texture, bool rigged) +// Currently only used for shadows -Cosmic,2023-04-19 +void LLPipeline::renderAlphaObjects(bool rigged) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; assertInitialized(); @@ -6771,9 +6772,20 @@ void LLPipeline::renderAlphaObjects(bool texture, bool batch_texture, bool rigge LLDrawInfo* pparams = *i; LLCullResult::increment_iterator(i, end); + if (rigged != (pparams->mAvatar != nullptr)) + { + // Pool contains both rigged and non-rigged DrawInfos. Only draw + // the objects we're interested in in this pass. + continue; + } + if (rigged) { - if (pparams->mAvatar != nullptr) + if (pparams->mGLTFMaterial) + { + mSimplePool->pushRiggedGLTFBatch(*pparams, lastAvatar, lastMeshId); + } + else { if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash) { @@ -6782,12 +6794,19 @@ void LLPipeline::renderAlphaObjects(bool texture, bool batch_texture, bool rigge lastMeshId = pparams->mSkinInfo->mHash; } - mSimplePool->pushBatch(*pparams, texture, batch_texture); + mSimplePool->pushBatch(*pparams, true, true); } } - else if (pparams->mAvatar == nullptr) + else { - mSimplePool->pushBatch(*pparams, texture, batch_texture); + if (pparams->mGLTFMaterial) + { + mSimplePool->pushGLTFBatch(*pparams); + } + else + { + mSimplePool->pushBatch(*pparams, true, true); + } } } @@ -6795,6 +6814,7 @@ void LLPipeline::renderAlphaObjects(bool texture, bool batch_texture, bool rigge gGLLastMatrix = NULL; } +// Currently only used for shadows -Cosmic,2023-04-19 void LLPipeline::renderMaskedObjects(U32 type, bool texture, bool batch_texture, bool rigged) { assertInitialized(); @@ -6812,6 +6832,7 @@ void LLPipeline::renderMaskedObjects(U32 type, bool texture, bool batch_texture, gGLLastMatrix = NULL; } +// Currently only used for shadows -Cosmic,2023-04-19 void LLPipeline::renderFullbrightMaskedObjects(U32 type, bool texture, bool batch_texture, bool rigged) { assertInitialized(); @@ -7676,6 +7697,12 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ stop_glerror(); } + channel = shader.enableTexture(LLShaderMgr::EXPOSURE_MAP); + if (channel > -1) + { + gGL.getTexUnit(channel)->bind(&mExposureMap); + } + if (shader.getUniformLocation(LLShaderMgr::VIEWPORT) != -1) { shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0], @@ -8732,6 +8759,8 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera U32 saved_occlusion = sUseOcclusion; sUseOcclusion = 0; + // List of render pass types that use the prim volume as the shadow, + // ignoring textures. static const U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_FULLBRIGHT, @@ -8857,7 +8886,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha blend"); LL_PROFILE_GPU_ZONE("shadow alpha blend"); LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(0.598f); - renderAlphaObjects(true, true, rigged); + renderAlphaObjects(rigged); } { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 7b4f6d44c8..a7ae290f9c 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -272,7 +272,7 @@ public: void renderObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false); void renderShadowSimple(U32 type); - void renderAlphaObjects(bool texture = true, bool batch_texture = false, bool rigged = false); + void renderAlphaObjects(bool rigged = false); void renderMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false); void renderFullbrightMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false); diff --git a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml index f6bfb3574d..ca5c7fe264 100644 --- a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml +++ b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml @@ -258,7 +258,7 @@ left_delta="-5" top_pad="15" width="180">Reflection Probe Ambiance:</text> - <slider decimal_digits="3" + <slider decimal_digits="2" follows="left|top" height="16" increment="0.01" diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index 16b965843d..d867123c4b 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -649,26 +649,12 @@ </combo_box> <check_box - control_name="RenderReflectionsEnabled" - height="16" - initial_value="true" - label="Reflections" - layout="topleft" - left="420" - name="ReflectionsEnabled" - top_delta="16" - width="240"> - <check_box.commit_callback - function="Pref.RenderOptionUpdate" /> - </check_box> - - <check_box control_name="RenderScreenSpaceReflections" height="16" initial_value="true" label="Screen Space Reflections" layout="topleft" - left="440" + left="420" name="ScreenSpaceReflections" top_delta="16" width="240"> @@ -682,7 +668,7 @@ follows="left|top" height="16" layout="topleft" - left="440" + left="420" name="ReflectionDetailText" text_readonly_color="LabelDisabledColor" top_delta="16" @@ -694,7 +680,7 @@ control_name="RenderReflectionProbeDetail" height="18" layout="topleft" - left_delta="110" + left_delta="130" top_delta="0" name="ReflectionDetail" width="150"> @@ -712,7 +698,47 @@ value="2"/> </combo_box> - <slider + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="420" + name="ReflectionProbeText" + text_readonly_color="LabelDisabledColor" + top_delta="16" + width="128"> + Reflection Coverage: + </text> + + <combo_box + control_name="RenderReflectionProbeLevel" + height="18" + layout="topleft" + left_delta="130" + top_delta="0" + name="ReflectionLevel" + width="150"> + <combo_box.item + label="None" + name="0" + value="0"/> + <combo_box.item + label="Manual only" + name="1" + value="1"/> + <combo_box.item + label="Manual + terrain and water" + name="2" + value="2"/> + <combo_box.item + label="Full scene" + name="3" + value="3"/> + </combo_box> + + <slider control_name="RenderExposure" decimal_digits="1" follows="left|top" diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml index a80b1a9166..622c999254 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml @@ -325,7 +325,7 @@ Reflection Probe Ambiance: </text> <slider - decimal_digits="3" + decimal_digits="2" follows="left|top" height="16" increment="0.01" |