diff options
Diffstat (limited to 'indra/newview')
33 files changed, 362 insertions, 270 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8996b1dd4f..e0662b8115 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9002,37 +9002,6 @@ <key>Value</key> <integer>1</integer> </map> - - <key>RenderShadowNearDist</key> - <map> - <key>Comment</key> - <string>Near clip plane of shadow camera (affects precision of depth shadows).</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Vector3</string> - <key>Value</key> - <array> - <real>256</real> - <real>256</real> - <real>256</real> - </array> - </map> - <key>RenderShadowClipPlanes</key> - <map> - <key>Comment</key> - <string>Near clip plane split distances for shadow map frusta.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Vector3</string> - <key>Value</key> - <array> - <real>1.0</real> - <real>12.0</real> - <real>32.0</real> - </array> - </map> <key>RenderShadowSplitExponent</key> <map> <key>Comment</key> @@ -9048,21 +9017,6 @@ <real>2.0</real> </array> </map> - <key>RenderShadowOrthoClipPlanes</key> - <map> - <key>Comment</key> - <string>Near clip plane split distances for orthographic shadow map frusta.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Vector3</string> - <key>Value</key> - <array> - <real>4.0</real> - <real>8.0</real> - <real>24.0</real> - </array> - </map> <key>RenderShadowProjOffset</key> <map> <key>Comment</key> @@ -10402,7 +10356,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <real>32</real> + <real>16</real> </map> <key>RenderTonemapper</key> <map> @@ -14261,6 +14215,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>RenderOcclusionTimeout</key> + <map> + <key>Comment</key> + <string>Maximum number of frames to wait on an occlusion query before forcibly reading it back</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>8</integer> + </map> <key>UseObjectCacheOcclusion</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index fe796a054d..e0e97bb938 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -24,19 +24,15 @@ */ /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif +out vec4 frag_data[4]; ///////////////////////////////////////////////////////////////////////// // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -VARYING vec3 vary_CloudColorSun; -VARYING vec3 vary_CloudColorAmbient; -VARYING float vary_CloudDensity; +in vec3 vary_CloudColorSun; +in vec3 vary_CloudColorAmbient; +in float vary_CloudDensity; uniform sampler2D cloud_noise_texture; uniform sampler2D cloud_noise_texture_next; @@ -46,16 +42,16 @@ uniform vec3 cloud_pos_density2; uniform float cloud_scale; uniform float cloud_variance; -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; -VARYING vec2 vary_texcoord2; -VARYING vec2 vary_texcoord3; -VARYING float altitude_blend_factor; +in vec2 vary_texcoord0; +in vec2 vary_texcoord1; +in vec2 vary_texcoord2; +in vec2 vary_texcoord3; +in float altitude_blend_factor; vec4 cloudNoise(vec2 uv) { - vec4 a = texture2D(cloud_noise_texture, uv); - vec4 b = texture2D(cloud_noise_texture_next, uv); + vec4 a = texture(cloud_noise_texture, uv); + vec4 b = texture(cloud_noise_texture_next, uv); vec4 cloud_noise_sample = mix(a, b, blend_factor); return cloud_noise_sample; } @@ -118,8 +114,9 @@ void main() color.rgb *= 2.0; /// Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(color.rgb, alpha1); + frag_data[0] = vec4(0); frag_data[1] = vec4(0.0,0.0,0.0,0.0); frag_data[2] = vec4(0,0,0,GBUFFER_FLAG_SKIP_ATMOS); + frag_data[3] = vec4(color.rgb, alpha1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 41dd485fae..fabc61eb5e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -27,11 +27,7 @@ /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif +out vec4 frag_data[4]; uniform vec4 color; uniform vec3 moonlight_color; @@ -39,12 +35,7 @@ uniform vec3 moon_dir; uniform float moon_brightness; uniform sampler2D diffuseMap; -VARYING vec2 vary_texcoord0; - -vec3 srgb_to_linear(vec3 c); - -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); +in vec2 vary_texcoord0; void main() { @@ -53,24 +44,25 @@ void main() if( moon_dir.z > 0 ) fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 ); - vec4 c = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 c = texture(diffuseMap, vary_texcoord0.xy); // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> if (c.a <= 2./255.) // 0.00784 + { discard; + } -// c.rgb = srgb_to_linear(c.rgb); - c.rgb *= moonlight_color.rgb; - c.rgb *= moon_brightness; - c.rgb *= fade; - c.a *= fade; + c.rgb *= moonlight_color.rgb; + c.rgb *= moon_brightness; - c.rgb = scaleSoftClip(c.rgb); + c.rgb *= fade; + c.a *= fade; - frag_data[0] = vec4(c.rgb, c.a); + frag_data[0] = vec4(0); frag_data[1] = vec4(0.0); frag_data[2] = vec4(0.0, 0.0, 0.0, GBUFFER_FLAG_HAS_ATMOS); + frag_data[3] = vec4(c.rgb, c.a); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 930338cefb..cc4c3b5dce 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -22,12 +22,10 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - -/*[EXTRA_CODE_HERE]*/ // Inputs -VARYING vec3 vary_HazeColor; -VARYING float vary_LightNormPosDot; +in vec3 vary_HazeColor; +in float vary_LightNormPosDot; uniform sampler2D rainbow_map; uniform sampler2D halo_map; @@ -36,11 +34,9 @@ uniform float moisture_level; uniform float droplet_radius; uniform float ice_level; -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif +out vec4 frag_data[4]; + +vec3 srgb_to_linear(vec3 c); ///////////////////////////////////////////////////////////////////////// // The fragment shader for the sky @@ -63,19 +59,16 @@ vec3 rainbow(float d) d = clamp(d, 0.0, 0.25) + interior_coord; float rad = (droplet_radius - 5.0f) / 1024.0f; - return pow(texture2D(rainbow_map, vec2(rad+0.5, d)).rgb, vec3(1.8)) * moisture_level; + return pow(texture(rainbow_map, vec2(rad+0.5, d)).rgb, vec3(1.8)) * moisture_level; } vec3 halo22(float d) { d = clamp(d, 0.1, 1.0); float v = sqrt(clamp(1 - (d * d), 0, 1)); - return texture2D(halo_map, vec2(0, v)).rgb * ice_level; + return texture(halo_map, vec2(0, v)).rgb * ice_level; } -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); - void main() { // Potential Fill-rate optimization. Add cloud calculation @@ -91,11 +84,10 @@ void main() color.rgb += rainbow(optic_d); color.rgb += halo_22; color.rgb *= 2.; - color.rgb = scaleSoftClip(color.rgb); - // Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(color.rgb, 1.0); - frag_data[1] = vec4(0.0,0.0,0.0,0.0); + frag_data[0] = vec4(0); + frag_data[1] = vec4(0); frag_data[2] = vec4(0.0,0.0,0.0,GBUFFER_FLAG_SKIP_ATMOS); //1.0 in norm.w masks off fog + frag_data[3] = vec4(color.rgb, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl index cdafdba15c..4f1756c367 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -25,15 +25,11 @@ /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif +out vec4 frag_data[4]; -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec2 screenpos; +in vec4 vertex_color; +in vec2 vary_texcoord0; +in vec2 screenpos; uniform sampler2D diffuseMap; uniform float blend_factor; @@ -62,8 +58,9 @@ void main() col.a = (col.a * factor) * 32.0f; col.a *= twinkle(); - frag_data[0] = col; + frag_data[0] = vec4(0); frag_data[1] = vec4(0.0f); frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS); + frag_data[3] = col; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index e35ea83f0a..a85e6ebc66 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -27,36 +27,29 @@ /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif +out vec4 frag_data[4]; vec3 srgb_to_linear(vec3 c); -vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; uniform float blend_factor; // interp factor between sunDisc A/B -VARYING vec2 vary_texcoord0; -VARYING float sun_fade; +in vec2 vary_texcoord0; +in float sun_fade; void main() { - vec4 sunDiscA = texture2D(diffuseMap, vary_texcoord0.xy); - vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy); + vec4 sunDiscA = texture(diffuseMap, vary_texcoord0.xy); + vec4 sunDiscB = texture(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunDiscA, sunDiscB, blend_factor); - //c.rgb = fullbrightAtmosTransport(c.rgb); - c.rgb = fullbrightScaleSoftClip(c.rgb); // SL-9806 stars poke through //c.a *= sun_fade; - frag_data[0] = c; + frag_data[0] = vec4(0); frag_data[1] = vec4(0.0f); frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS); + frag_data[3] = c; } diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl index b6f080739e..a1839d4a67 100644 --- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl @@ -151,7 +151,7 @@ vec4 prefilterEnvMap(vec3 R) // Solid angle of 1 pixel across all cube faces float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim); // Biased (+1.0) mip level for better result - float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f); + float mipLevel = roughness == 0.0 ? 0.0 : clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, max_probe_lod); color += textureLod(reflectionProbes, vec4(L, sourceIdx), mipLevel) * dotNL; totalWeight += dotNL; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index ef35bf3fd7..e7322c14fb 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -79,7 +79,6 @@ vec3 srgb_to_linear(vec3 c); vec3 linear_to_srgb(vec3 c); vec2 encode_normal (vec3 n); -vec3 scaleSoftClipFragLinear(vec3 l); vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten); void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive); @@ -279,7 +278,6 @@ void main() color.rgb = linear_to_srgb(color.rgb); color.rgb = atmosFragLightingLinear(color.rgb, additive, atten); - color.rgb = scaleSoftClipFragLinear(color.rgb); color.rgb = srgb_to_linear(color.rgb); vec4 light = vec4(0,0,0,0); diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index 7d8f9c218d..0fb30559d4 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -37,7 +37,6 @@ uniform sampler2D depthMap; uniform sampler2D diffuseRect; uniform sampler2D specularRect; uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl -uniform sampler2D noiseMap; uniform sampler2D lightFunc; uniform vec3 env_mat[3]; @@ -132,9 +131,6 @@ void main() } else { - - float noise = texture2D(noiseMap, tc).b; - diffuse = srgb_to_linear(diffuse); spec.rgb = srgb_to_linear(spec.rgb); @@ -154,7 +150,6 @@ void main() float fa = light_col[i].a; float dist_atten = calcLegacyDistanceAttenuation(dist, fa); - dist_atten *= noise; float lit = nl * dist_atten; diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl index 5ed8a75e0e..30b7895157 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl @@ -41,7 +41,6 @@ uniform sampler2D normalMap; uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl uniform samplerCube environmentMap; uniform sampler2D lightMap; -uniform sampler2D noiseMap; uniform sampler2D projectionMap; // rgba uniform sampler2D lightFunc; @@ -187,7 +186,6 @@ void main() diffuse = srgb_to_linear(diffuse); spec.rgb = srgb_to_linear(spec.rgb); - float noise = texture2D(noiseMap, tc).b; if (proj_tc.z > 0.0 && proj_tc.x < 1.0 && proj_tc.y < 1.0 && @@ -199,7 +197,7 @@ void main() if (nl > 0.0) { - lit = nl * dist_atten * noise; + lit = nl * dist_atten; dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy ); @@ -209,7 +207,7 @@ void main() amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance; } - amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, noise, proj_tc.xy ); + amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy ); final_color += diffuse.rgb * amb_rgb; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 9b5cb39883..7a5676e0ab 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -92,6 +92,7 @@ bool shouldSampleProbe(int i, vec3 pos) return false; } + // never allow automatic probes to encroach on box probes sample_automatic = false; } else @@ -426,25 +427,19 @@ void boxIntersectDebug(vec3 origin, vec3 pos, int i, inout vec4 col) // dir - normal to be weighted // origin - center of sphere probe // r - radius of probe influence volume -// min_da - minimum angular attenuation coefficient // i - index of probe in refSphere // dw - distance weight -float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, float min_da, int i, out float dw) +float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, int i, out float dw) { float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down) vec3 delta = pos.xyz - origin; float d2 = max(length(delta), 0.001); - float r2 = r1; //r1 * r1; - - //float atten = 1.0 - max(d2 - r2, 0.0) / max((rr - r2), 0.001); - float atten = 1.0 - max(d2 - r2, 0.0) / max((r - r2), 0.001); + float atten = 1.0 - max(d2 - r1, 0.0) / max((r - r1), 0.001); float w = 1.0 / d2; dw = w * atten * max(r, 1.0)*4; - atten *= max(dot(normalize(-delta), dir), min_da); - w *= atten; return w; @@ -481,7 +476,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres rr); - w = sphereWeight(pos, dir, refSphere[i].xyz, r, 0.25, i, dw); + w = sphereWeight(pos, dir, refSphere[i].xyz, r, i, dw); } v -= c; @@ -521,7 +516,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres rr); - w = sphereWeight(pos, dir, refSphere[i].xyz, r, 0.001, i, dw); + w = sphereWeight(pos, dir, refSphere[i].xyz, r, i, dw); } v -= c; @@ -559,7 +554,6 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod) float dw = 0; vec3 refcol; - { refcol = tapRefMap(pos, dir, w, dw, lod, refSphere[i].xyz, i); @@ -653,7 +647,7 @@ void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, vec2 tc, vec3 pos, vec3 norm, float glossiness) { // TODO - don't hard code lods - float reflection_lods = max_probe_lod-1; + float reflection_lods = max_probe_lod; preProbeSample(pos); vec3 refnormpersp = reflect(pos.xyz, norm.xyz); @@ -732,7 +726,7 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 refnormpersp = reflect(pos.xyz, norm.xyz); ambenv = sampleProbeAmbient(pos, norm); - + if (glossiness > 0.0) { float lod = (1.0-glossiness)*reflection_lods; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index dfd1d47b3e..0e3ebd1534 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -211,7 +211,7 @@ void main() else if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS)) { //should only be true of WL sky, just port over base color value - color = srgb_to_linear(baseColor.rgb); + color = srgb_to_linear(texture2D(emissiveRect, tc).rgb); } else { diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index 3d8b95b882..33ea2129cf 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -51,7 +51,6 @@ uniform sampler2D normalMap; uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl uniform samplerCube environmentMap; uniform sampler2D lightMap; -uniform sampler2D noiseMap; uniform sampler2D projectionMap; // rgba uniform sampler2D lightFunc; @@ -193,7 +192,6 @@ void main() diffuse = srgb_to_linear(diffuse); spec.rgb = srgb_to_linear(spec.rgb); - float noise = texture2D(noiseMap, tc).b; if (proj_tc.z > 0.0 && proj_tc.x < 1.0 && proj_tc.y < 1.0 && @@ -205,7 +203,7 @@ void main() if (nl > 0.0) { - lit = nl * dist_atten * noise; + lit = nl * dist_atten; dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy ); @@ -214,7 +212,7 @@ void main() amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance; } - vec3 amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, noise, proj_tc.xy ); + 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); diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 020c7bbc74..14d8d3fae5 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 51 +version 52 // 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 @@ -109,6 +109,7 @@ RenderScreenSpaceReflections 1 0 list LowMid RenderAnisotropic 1 0 RenderAvatarLODFactor 1 0.5 +RenderAvatarMaxNonImpostors 1 5 RenderAvatarMaxComplexity 1 100000 RenderAvatarPhysicsLODFactor 1 0.75 RenderFarClip 1 96 @@ -136,6 +137,7 @@ RenderScreenSpaceReflections 1 0 list Mid RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 7 RenderAvatarMaxComplexity 1 200000 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 128 @@ -147,7 +149,7 @@ RenderTransparentWater 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.25 RenderDeferredSSAO 1 0 RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 @@ -163,6 +165,7 @@ RenderScreenSpaceReflections 1 0 list MidHigh RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 9 RenderAvatarMaxComplexity 1 250000 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 128 @@ -174,7 +177,7 @@ RenderTransparentWater 1 1 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.375 RenderDeferredSSAO 1 0 RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 @@ -190,6 +193,7 @@ RenderScreenSpaceReflections 1 0 list High RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 11 RenderAvatarMaxComplexity 1 300000 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 128 @@ -201,7 +205,7 @@ RenderTransparentWater 1 1 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.5 RenderDeferredSSAO 1 1 RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 @@ -217,6 +221,7 @@ RenderScreenSpaceReflections 1 0 list HighUltra RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderAvatarMaxComplexity 1 350000 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 128 @@ -228,7 +233,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.75 RenderDeferredSSAO 1 1 RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 2 @@ -244,6 +249,7 @@ RenderScreenSpaceReflections 1 0 list Ultra RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 256 RenderFlexTimeFactor 1 1.0 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index dbb33b3997..b7a0ac6e28 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 46 +version 47 // 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 @@ -107,6 +107,7 @@ RenderScreenSpaceReflections 1 0 list LowMid RenderAnisotropic 1 0 RenderAvatarLODFactor 1 0.5 +RenderAvatarMaxNonImpostors 1 5 RenderAvatarMaxComplexity 1 100000 RenderAvatarPhysicsLODFactor 1 0.75 RenderFarClip 1 96 @@ -134,6 +135,7 @@ RenderScreenSpaceReflections 1 0 list Mid RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 7 RenderAvatarMaxComplexity 1 200000 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 128 @@ -145,7 +147,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.25 RenderDeferredSSAO 1 0 RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 @@ -161,6 +163,7 @@ RenderScreenSpaceReflections 1 0 list MidHigh RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 9 RenderAvatarMaxComplexity 1 250000 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 128 @@ -172,7 +175,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.375 RenderDeferredSSAO 1 0 RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 @@ -188,6 +191,7 @@ RenderScreenSpaceReflections 1 0 list High RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 11 RenderAvatarMaxComplexity 1 300000 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 128 @@ -199,7 +203,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.5 RenderDeferredSSAO 1 1 RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 @@ -215,6 +219,7 @@ RenderScreenSpaceReflections 1 0 list HighUltra RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderAvatarMaxComplexity 1 350000 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 128 @@ -226,7 +231,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.75 RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 RenderUseAdvancedAtmospherics 1 0 @@ -242,6 +247,7 @@ RenderScreenSpaceReflections 1 0 list Ultra RenderAnisotropic 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 256 RenderFlexTimeFactor 1 1.0 diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index d88f0f9847..84ddb3ca99 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -812,7 +812,7 @@ const F64Seconds LLEnvironment::TRANSITION_SLOW(10.0f); const F64Seconds LLEnvironment::TRANSITION_ALTITUDE(5.0f); const LLUUID LLEnvironment::KNOWN_SKY_SUNRISE("01e41537-ff51-2f1f-8ef7-17e4df760bfb"); -const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("6c83e853-e7f8-cad7-8ee6-5f31c453721c"); +const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("e4391f43-74d6-d889-19fb-99a4a3ad6c5c"); const LLUUID LLEnvironment::KNOWN_SKY_SUNSET("084e26cd-a900-28e8-08d0-64a9de5c15e2"); const LLUUID LLEnvironment::KNOWN_SKY_MIDNIGHT("8a01b97a-cb20-c1ea-ac63-f7ea84ad0090"); @@ -1758,7 +1758,11 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con { // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color auto max_vec = [](LLVector4 col) { - col.mV[0] = col.mV[1] = col.mV[2] = llmax(llmax(col.mV[0], col.mV[1]), col.mV[2]); + LLColor3 color(col); + F32 h, s, l; + color.calcHSL(&h, &s, &l); + + col.mV[0] = col.mV[1] = col.mV[2] = l; return col; }; diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index 80074cc655..2e71b4fa87 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -46,6 +46,18 @@ LLFetchedGLTFMaterial::~LLFetchedGLTFMaterial() } +LLFetchedGLTFMaterial& LLFetchedGLTFMaterial::operator=(const LLFetchedGLTFMaterial& rhs) +{ + LLGLTFMaterial::operator =(rhs); + + mBaseColorTexture = rhs.mBaseColorTexture; + mNormalTexture = rhs.mNormalTexture; + mMetallicRoughnessTexture = rhs.mMetallicRoughnessTexture; + mEmissiveTexture = rhs.mEmissiveTexture; + + return *this; +} + void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex) { // glTF 2.0 Specification 3.9.4. Alpha Coverage diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h index 96f7fbea8e..1668657281 100644 --- a/indra/newview/llfetchedgltfmaterial.h +++ b/indra/newview/llfetchedgltfmaterial.h @@ -39,6 +39,8 @@ public: LLFetchedGLTFMaterial(); virtual ~LLFetchedGLTFMaterial(); + LLFetchedGLTFMaterial& operator=(const LLFetchedGLTFMaterial& rhs); + // If this material is loaded, fire the given function void onMaterialComplete(std::function<void()> material_complete); @@ -46,6 +48,8 @@ public: // media_tex - optional media texture that may override the base color texture void bind(LLViewerTexture* media_tex = nullptr); + bool isFetching() const { return mFetching; } + // Textures used for fetching/rendering LLPointer<LLViewerFetchedTexture> mBaseColorTexture; LLPointer<LLViewerFetchedTexture> mNormalTexture; diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 4051521ad4..9c78e48cab 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -157,8 +157,8 @@ public: // receive override data from simulator via LargeGenericMessage // message should have: // object_id - UUID of LLViewerObject - // side - S32 index of texture entry - // gltf_json - String of GLTF json for override data + // sides - array of S32 indices of texture entries + // gltf_json - array of corresponding Strings of GLTF json for override data LLSD message; @@ -366,6 +366,8 @@ void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFM void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj) { LL_PROFILE_ZONE_SCOPED; + + llassert(obj); const LLUUID& id = obj->getID(); auto iter = mQueuedOverrides.find(id); @@ -376,15 +378,33 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj) { if (overrides[i].notNull()) { - if (!obj->getTE(i) || !obj->getTE(i)->getGLTFMaterial()) - { // object doesn't have its base GLTF material yet, don't apply override (yet) + if (!obj->getTE(i)) + { // object is incomplete + return; + } + + if (!obj->getTE(i)->getGLTFMaterial()) + { + // doesn't have its base GLTF material yet, don't apply override(yet) return; } - obj->setTEGLTFMaterialOverride(i, overrides[i]); + + S32 status = obj->setTEGLTFMaterialOverride(i, overrides[i]); + if (status == TEM_CHANGE_NONE) + { + // can't apply this yet, since failure to change the material override + // probably means the base material is still being fetched. leave in + // the queue for later + //obj->setDebugText("early out 3"); + return; + } + if (obj->getTE(i)->isSelected()) { handle_gltf_override_message.doSelectionCallbacks(id, i); } + // success! + overrides[i] = nullptr; } } diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index 996b168262..d464ea0571 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -45,6 +45,7 @@ #include "llmaterialmgr.h" #include "llnotificationsutil.h" #include "llscrolllistctrl.h" +#include "lltextureentry.h" #include "lltinygltfhelper.h" #include "llviewertexture.h" @@ -118,6 +119,15 @@ S32 LLLocalGLTFMaterial::getIndexInFile() const return mMaterialIndex; } +void LLLocalGLTFMaterial::addTextureEntry(LLTextureEntry* te) +{ + mTextureEntires.insert(te); +} +void LLLocalGLTFMaterial::removeTextureEntry(LLTextureEntry* te) +{ + mTextureEntires.erase(te); +} + /* update functions */ bool LLLocalGLTFMaterial::updateSelf() { @@ -154,6 +164,27 @@ bool LLLocalGLTFMaterial::updateSelf() gGLTFMaterialList.addMaterial(mWorldID, this); mUpdateRetries = LL_LOCAL_UPDATE_RETRIES; + + for (LLTextureEntry* entry : mTextureEntires) + { + // Normally a change in applied material id is supposed to + // drop overrides thus reset material, but local materials + // currently reuse their existing asset id, and purpose is + // to preview how material will work in-world, overrides + // included, so do an override to render update instead. + LLGLTFMaterial* override_mat = entry->getGLTFMaterialOverride(); + if (override_mat) + { + // do not create a new material, reuse existing pointer + LLFetchedGLTFMaterial* render_mat = (LLFetchedGLTFMaterial*)entry->getGLTFRenderMaterial(); + if (render_mat) + { + *render_mat = *this; + render_mat->applyOverride(*override_mat); + } + } + } + updated = true; } diff --git a/indra/newview/lllocalgltfmaterials.h b/indra/newview/lllocalgltfmaterials.h index 6919b9b4b2..1442b83a40 100644 --- a/indra/newview/lllocalgltfmaterials.h +++ b/indra/newview/lllocalgltfmaterials.h @@ -34,6 +34,7 @@ class LLScrollListCtrl; class LLGLTFMaterial; class LLViewerObject; +class LLTextureEntry; class LLLocalGLTFMaterial : public LLFetchedGLTFMaterial { @@ -48,6 +49,9 @@ public: /* accessors */ LLUUID getWorldID() const; S32 getIndexInFile() const; + void addTextureEntry(LLTextureEntry* te) override; + void removeTextureEntry(LLTextureEntry* te) override; + public: bool updateSelf(); @@ -77,6 +81,7 @@ private: /* members */ ELinkStatus mLinkStatus; S32 mUpdateRetries; S32 mMaterialIndex; // Single file can have more than one + std::set<LLTextureEntry*> mTextureEntires; }; class LLLocalGLTFMaterialTimer : public LLEventTimer diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 4cdc503af8..609d8ea5d7 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -2045,6 +2045,15 @@ void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std:: setFromGltfMetaData(filename, model_in, index); + if (getDoubleSided()) + { + // SL-19392 Double sided materials double the number of pixels that must be rasterized, + // and a great many tools that export GLTF simply leave double sided enabled whether + // or not it is necessary. + LL_DEBUGS("MaterialEditor") << "Defaulting Double Sided to disabled on import" << LL_ENDL; + setDoubleSided(false); + } + markChangesUnsaved(U32_MAX); if (open_floater) diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cb7bc7b5df..dd3fdf91d9 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1282,7 +1282,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLCheckBoxCtrl* cb_planar_align = getChild<LLCheckBoxCtrl>("checkbox planar align"); align_planar = (cb_planar_align && cb_planar_align->get()); - bool enabled = (editable && isIdenticalPlanarTexgen() && (!pbr_selected || texture_info_selected)); + bool enabled = (editable && isIdenticalPlanarTexgen() && !texture_info_selected); childSetValue("checkbox planar align", align_planar && enabled); childSetVisible("checkbox planar align", enabled); childSetEnabled("checkbox planar align", enabled); @@ -1826,10 +1826,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); if (show_pbr) { - const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); - const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); - const bool show_texture_info = texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; - const bool new_state = show_texture_info && has_pbr_capabilities && has_pbr_material; + const bool new_state = has_pbr_capabilities && has_pbr_material; LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU"); LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV"); @@ -1858,11 +1855,6 @@ void LLPanelFace::updateVisibilityGLTF() const U32 pbr_type = radio_pbr_type->getSelectedIndex(); const bool show_pbr_render_material_id = show_pbr && (pbr_type == PBRTYPE_RENDER_MATERIAL_ID); - const bool show_pbr_base_color = show_pbr && (pbr_type == PBRTYPE_BASE_COLOR); - const bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL); - const bool show_pbr_metallic_roughness = show_pbr && (pbr_type == PBRTYPE_METALLIC_ROUGHNESS); - const bool show_pbr_emissive = show_pbr && (pbr_type == PBRTYPE_EMISSIVE); - const bool show_pbr_transform = show_pbr_base_color || show_pbr_normal || show_pbr_metallic_roughness || show_pbr_emissive; getChildView("pbr_control")->setVisible(show_pbr_render_material_id); @@ -1870,11 +1862,11 @@ void LLPanelFace::updateVisibilityGLTF() getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id); getChildView("save_selected_pbr")->setVisible(show_pbr_render_material_id); - getChildView("gltfTextureScaleU")->setVisible(show_pbr_transform); - getChildView("gltfTextureScaleV")->setVisible(show_pbr_transform); - getChildView("gltfTextureRotation")->setVisible(show_pbr_transform); - getChildView("gltfTextureOffsetU")->setVisible(show_pbr_transform); - getChildView("gltfTextureOffsetV")->setVisible(show_pbr_transform); + getChildView("gltfTextureScaleU")->setVisible(show_pbr); + getChildView("gltfTextureScaleV")->setVisible(show_pbr); + getChildView("gltfTextureRotation")->setVisible(show_pbr); + getChildView("gltfTextureOffsetU")->setVisible(show_pbr); + getChildView("gltfTextureOffsetV")->setVisible(show_pbr); } void LLPanelFace::updateCopyTexButton() @@ -2731,14 +2723,14 @@ void LLPanelFace::updateVisibility() const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); - const bool show_texture_info = show_pbr && texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; + const bool show_pbr_asset = show_pbr && texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; radio_mat_type->setVisible(show_material); // Shared material controls - getChildView("checkbox_sync_settings")->setVisible(show_material || show_media || show_texture_info); - getChildView("tex gen")->setVisible(show_material || show_media || show_texture_info); - getChildView("combobox texgen")->setVisible(show_material || show_media || show_texture_info); + getChildView("checkbox_sync_settings")->setVisible(show_material || show_media); + getChildView("tex gen")->setVisible(show_material || show_media || show_pbr_asset); + getChildView("combobox texgen")->setVisible(show_material || show_media || show_pbr_asset); getChildView("button align textures")->setVisible(show_material || show_media); // Media controls @@ -4654,7 +4646,8 @@ void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::fun { U32 texture_info_start; U32 texture_info_end; - if (gSavedSettings.getBOOL("SyncMaterialSettings")) + const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + if (texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT) { texture_info_start = 0; texture_info_end = LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; @@ -4685,11 +4678,20 @@ void LLPanelFace::setMaterialOverridesFromSelection() { const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + U32 texture_info_start; + U32 texture_info_end; if (texture_info == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT) { - return; + texture_info_start = 0; + texture_info_end = LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT; + } + else + { + texture_info_start = texture_info; + texture_info_end = texture_info + 1; } + bool read_transform = true; LLGLTFMaterial::TextureTransform transform; bool scale_u_same = true; bool scale_v_same = true; @@ -4697,26 +4699,56 @@ void LLPanelFace::setMaterialOverridesFromSelection() bool offset_u_same = true; bool offset_v_same = true; - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mScale[VX] : 0.f; - }, transform.mScale[VX], scale_u_same, true, 1e-3f); - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mScale[VY] : 0.f; - }, transform.mScale[VY], scale_v_same, true, 1e-3f); - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + for (U32 i = texture_info_start; i < texture_info_end; ++i) { - return mat ? mat->mTextureTransform[texture_info].mRotation : 0.f; - }, transform.mRotation, rotation_same, true, 1e-3f); - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mOffset[VX] : 0.f; - }, transform.mOffset[VX], offset_u_same, true, 1e-3f); - readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mOffset[VY] : 0.f; - }, transform.mOffset[VY], offset_v_same, true, 1e-3f); + LLGLTFMaterial::TextureTransform this_transform; + bool this_scale_u_same = true; + bool this_scale_v_same = true; + bool this_rotation_same = true; + bool this_offset_u_same = true; + bool this_offset_v_same = true; + + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mScale[VX] : 0.f; + }, this_transform.mScale[VX], this_scale_u_same, true, 1e-3f); + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mScale[VY] : 0.f; + }, this_transform.mScale[VY], this_scale_v_same, true, 1e-3f); + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mRotation : 0.f; + }, this_transform.mRotation, this_rotation_same, true, 1e-3f); + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mOffset[VX] : 0.f; + }, this_transform.mOffset[VX], this_offset_u_same, true, 1e-3f); + readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mOffset[VY] : 0.f; + }, this_transform.mOffset[VY], this_offset_v_same, true, 1e-3f); + + scale_u_same = scale_u_same && this_scale_u_same; + scale_v_same = scale_v_same && this_scale_v_same; + rotation_same = rotation_same && this_rotation_same; + offset_u_same = offset_u_same && this_offset_u_same; + offset_v_same = offset_v_same && this_offset_v_same; + + if (read_transform) + { + read_transform = false; + transform = this_transform; + } + else + { + scale_u_same = scale_u_same && (this_transform.mScale[VX] == transform.mScale[VX]); + scale_v_same = scale_v_same && (this_transform.mScale[VY] == transform.mScale[VY]); + rotation_same = rotation_same && (this_transform.mRotation == transform.mRotation); + offset_u_same = offset_u_same && (this_transform.mOffset[VX] == transform.mOffset[VX]); + offset_v_same = offset_v_same && (this_transform.mOffset[VY] == transform.mOffset[VY]); + } + } LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU"); LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV"); diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index c664dbbe9e..58ce571505 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -1018,7 +1018,7 @@ void LLReflectionMapManager::initReflectionMaps() mTexture->allocate(mProbeResolution, 3, mReflectionProbeCount + 2); mIrradianceMaps = new LLCubeMapArray(); - mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 4, mReflectionProbeCount, FALSE); + mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, FALSE); } if (mVertexBuffer.isNull()) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index fd3c8de3e9..1c53bddb62 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4961,6 +4961,22 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) if (mat == nullptr && mat_id.notNull()) { mat = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mat_id); + if (mat->isFetching()) + { // material is not loaded yet, rebuild draw info when the object finishes loading + mat->onMaterialComplete([id=getID()] + { + LLViewerObject* obj = gObjectList.findObject(id); + if (obj) + { + LLViewerRegion* region = obj->getRegion(); + if(region) + { + region->loadCacheMiscExtras(obj->getLocalID()); + } + obj->markForUpdate(FALSE); + } + }); + } getTE(te)->setGLTFMaterial(mat); } else if (mat_id.isNull() && mat != nullptr) @@ -5368,24 +5384,30 @@ S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_ma LLFetchedGLTFMaterial* src_mat = (LLFetchedGLTFMaterial*) tep->getGLTFMaterial(); + // if override mat exists, we must also have a source mat if (!src_mat) - { // we can get into this state if an override has arrived before the viewer has + { + // we can get into this state if an override has arrived before the viewer has // received or handled an update, return TEM_CHANGE_NONE to signal to LLGLTFMaterialList that it // should queue the update for later return retval; } - tep->setGLTFMaterialOverride(override_mat); + if(src_mat->isFetching()) + { + // if still fetching, we need to wait until it is done and try again + return retval; + } - // if override mat exists, we must also have a source mat - llassert(override_mat ? bool(src_mat) : true); + tep->setGLTFMaterialOverride(override_mat); - if (override_mat && src_mat) + if (override_mat) { LLFetchedGLTFMaterial* render_mat = new LLFetchedGLTFMaterial(*src_mat); render_mat->applyOverride(*override_mat); tep->setGLTFRenderMaterial(render_mat); retval = TEM_CHANGE_TEXTURE; + } else if (tep->setGLTFRenderMaterial(nullptr)) { @@ -5680,6 +5702,23 @@ void LLViewerObject::setDebugText(const std::string &utf8text) updateText(); } +void LLViewerObject::appendDebugText(const std::string &utf8text) +{ + if (utf8text.empty() && !mText) + { + return; + } + + if (!mText) + { + initHudText(); + } + mText->addLine(utf8text, LLColor4::white); + mText->setZCompare(FALSE); + mText->setDoFade(FALSE); + updateText(); +} + void LLViewerObject::initHudText() { mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); @@ -7242,12 +7281,14 @@ void LLViewerObject::setRenderMaterialID(S32 te_in, const LLUUID& id, bool updat } else { - LLPointer<LLViewerObject> this_ptr = this; - new_material->onMaterialComplete([this_ptr]() mutable { - if (this_ptr->isDead()) { return; } - - this_ptr->rebuildMaterial(); - }); + new_material->onMaterialComplete([obj_id = getID()]() + { + LLViewerObject* obj = gObjectList.findObject(obj_id); + if (obj) + { + obj->rebuildMaterial(); + } + }); } // predictively update LLRenderMaterialParams (don't wait for server) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 560c51139b..e647fdd045 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -442,6 +442,7 @@ public: void sendMaterialUpdate() const; void setDebugText(const std::string &utf8text); + void appendDebugText(const std::string &utf8text); void initHudText(); void restoreHudText(); void setIcon(LLViewerTexture* icon_image); diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index d1d23cfb8e..a2d8d30fb2 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -1131,7 +1131,9 @@ void LLOcclusionCullingGroup::checkOcclusion() mOcclusionCheckCount[LLViewerCamera::sCurCameraID]++; } - if (available || mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > 4) + static LLCachedControl<S32> occlusion_timeout(gSavedSettings, "RenderOcclusionTimeout", 4); + + if (available || mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > occlusion_timeout) { mOcclusionCheckCount[LLViewerCamera::sCurCameraID] = 0; GLuint query_result; // Will be # samples drawn, or a boolean depending on mHasOcclusionQuery2 (both are type GLuint) diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index afe48f01b5..dd4ff50259 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -823,7 +823,7 @@ void LLViewerRegion::saveObjectCache() // Map of LLVOCacheEntry takes time to release, store map for cleanup on idle sRegionCacheCleanup.insert(mImpl->mCacheMap.begin(), mImpl->mCacheMap.end()); mImpl->mCacheMap.clear(); - // TODO - probably need to do the same for overrides cache + // TODO - probably need to do the same for overrides cache } void LLViewerRegion::sendMessage() @@ -1151,6 +1151,8 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) entry->setState(LLVOCacheEntry::INACTIVE); entry->removeOctreeEntry(); entry->setValid(FALSE); + + // TODO kill extras/material overrides cache too } //physically delete the cache entry @@ -1862,6 +1864,9 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) //should not hit here any more, but does not hurt either, just put it back to active list addActiveCacheEntry(entry); } + + loadCacheMiscExtras(entry->getLocalID()); + return obj; } @@ -2759,7 +2764,7 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss entry->setValid(); decodeBoundingInfo(entry); - loadCacheMiscExtras(local_id, entry, crc); + //loadCacheMiscExtras(local_id, entry, crc); return true; } @@ -2876,6 +2881,7 @@ void LLViewerRegion::dumpCache() { LL_INFOS() << "Changes " << i << " " << change_bin[i] << LL_ENDL; } + // TODO - add overrides cache too } void LLViewerRegion::unpackRegionHandshake() @@ -3544,15 +3550,11 @@ std::string LLViewerRegion::getSimHostName() return std::string("..."); } -void LLViewerRegion::loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U32 crc) +void LLViewerRegion::loadCacheMiscExtras(U32 local_id) { auto iter = mImpl->mGLTFOverridesJson.find(local_id); if (iter != mImpl->mGLTFOverridesJson.end()) { LLGLTFMaterialList::loadCacheOverrides(iter->second); } - else - { - LL_DEBUGS("GLTF") << "cache miss for handle: " << mHandle << " local_id:" << local_id << LL_ENDL; - } } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index ec507fb982..b132a3a5f3 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -423,9 +423,9 @@ private: void decodeBoundingInfo(LLVOCacheEntry* entry); bool isNonCacheableObjectCreated(U32 local_id); - void loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U32 crc); - public: + void loadCacheMiscExtras(U32 local_id); + struct CompareDistance { bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index d1f4fa1c7a..77849c668a 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5416,7 +5416,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (gltf_mat) { - // nothing to do, render pools will reference the GLTF material + // just remember the material ID, render pools will reference the GLTF material + draw_info->mMaterialID = mat_id; } else if (mat) { @@ -5472,6 +5473,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, llassert(type != LLRenderPass::PASS_BUMP || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TANGENT) != 0); llassert(type != LLRenderPass::PASS_NORMSPEC || info->mNormalMap.notNull()); + llassert(type != LLRenderPass::PASS_SPECMAP || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TEXCOORD2) != 0); } void LLVolumeGeometryManager::getGeometry(LLSpatialGroup* group) @@ -5669,6 +5671,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) continue; } + // HACK -- brute force this check every time a drawable gets rebuilt + for (S32 i = 0; i < drawablep->getNumFaces(); ++i) + { + vobj->updateTEMaterialTextures(i); + } + // apply any pending material overrides gGLTFMaterialList.applyQueuedOverrides(vobj); @@ -5753,9 +5761,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { continue; } - - // HACK -- brute force this check every time a drawable gets rebuilt - vobj->updateTEMaterialTextures(i); #if 0 #if LL_RELEASE_WITH_DEBUG_INFO const LLUUID pbr_id( "49c88210-7238-2a6b-70ac-92d4f35963cf" ); @@ -6655,12 +6660,28 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace LLRenderPass::PASS_NORMSPEC_EMISSIVE, }; - U32 mask = mat->getShaderMask(); + U32 alpha_mode = mat->getDiffuseAlphaMode(); + if (!distance_sort && alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + { // HACK - this should never happen, but sometimes we get a material that thinks it has alpha blending when it ought not + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + } + U32 mask = mat->getShaderMask(alpha_mode); + + U32 vb_mask = facep->getVertexBuffer()->getTypeMask(); + + // HACK - this should also never happen, but sometimes we get here and the material thinks it has a specmap now + // even though it didn't appear to have a specmap when the face was added to the list of faces + if ((mask & 0x4) && !(vb_mask & LLVertexBuffer::MAP_TEXCOORD2)) + { + mask &= ~0x4; + } llassert(mask < sizeof(pass)/sizeof(U32)); mask = llmin(mask, (U32)(sizeof(pass)/sizeof(U32)-1)); + // if this is going into alpha pool, distance sort MUST be true + llassert(pass[mask] == LLRenderPass::PASS_ALPHA ? distance_sort : true); registerFace(group, facep, pass[mask]); } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 18b0192346..a53b3aac8e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -202,9 +202,6 @@ LLVector3 LLPipeline::RenderShadowGaussian; F32 LLPipeline::RenderShadowBlurDistFactor; bool LLPipeline::RenderDeferredAtmospheric; F32 LLPipeline::RenderHighlightFadeTime; -LLVector3 LLPipeline::RenderShadowClipPlanes; -LLVector3 LLPipeline::RenderShadowOrthoClipPlanes; -LLVector3 LLPipeline::RenderShadowNearDist; F32 LLPipeline::RenderFarClip; LLVector3 LLPipeline::RenderShadowSplitExponent; F32 LLPipeline::RenderShadowErrorCutoff; @@ -558,9 +555,6 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderShadowBlurDistFactor"); connectRefreshCachedSettingsSafe("RenderDeferredAtmospheric"); connectRefreshCachedSettingsSafe("RenderHighlightFadeTime"); - connectRefreshCachedSettingsSafe("RenderShadowClipPlanes"); - connectRefreshCachedSettingsSafe("RenderShadowOrthoClipPlanes"); - connectRefreshCachedSettingsSafe("RenderShadowNearDist"); connectRefreshCachedSettingsSafe("RenderFarClip"); connectRefreshCachedSettingsSafe("RenderShadowSplitExponent"); connectRefreshCachedSettingsSafe("RenderShadowErrorCutoff"); @@ -1043,9 +1037,6 @@ void LLPipeline::refreshCachedSettings() RenderShadowBlurDistFactor = gSavedSettings.getF32("RenderShadowBlurDistFactor"); RenderDeferredAtmospheric = gSavedSettings.getBOOL("RenderDeferredAtmospheric"); RenderHighlightFadeTime = gSavedSettings.getF32("RenderHighlightFadeTime"); - RenderShadowClipPlanes = gSavedSettings.getVector3("RenderShadowClipPlanes"); - RenderShadowOrthoClipPlanes = gSavedSettings.getVector3("RenderShadowOrthoClipPlanes"); - RenderShadowNearDist = gSavedSettings.getVector3("RenderShadowNearDist"); RenderFarClip = gSavedSettings.getF32("RenderFarClip"); RenderShadowSplitExponent = gSavedSettings.getVector3("RenderShadowSplitExponent"); RenderShadowErrorCutoff = gSavedSettings.getF32("RenderShadowErrorCutoff"); @@ -9277,27 +9268,12 @@ void LLPipeline::generateSunShadow(LLCamera& camera) glh::matrix4f view[6]; glh::matrix4f proj[6]; - //clip contains parallel split distances for 3 splits - LLVector3 clip = RenderShadowClipPlanes; - LLVector3 caster_dir(environment.getIsSunUp() ? mSunDir : mMoonDir); - //F32 slope_threshold = gSavedSettings.getF32("RenderShadowSlopeThreshold"); - - //far clip on last split is minimum of camera view distance and 128 - mSunClipPlanes = LLVector4(clip, clip.mV[2] * clip.mV[2]/clip.mV[1]); - - clip = RenderShadowOrthoClipPlanes; - mSunOrthoClipPlanes = LLVector4(clip, clip.mV[2]*clip.mV[2]/clip.mV[1]); - - //currently used for amount to extrude frusta corners for constructing shadow frusta - //LLVector3 n = RenderShadowNearDist; - //F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; - //put together a universal "near clip" plane for shadow frusta LLPlane shadow_near_clip; { - LLVector3 p = gAgent.getPositionAgent(); + LLVector3 p = camera.getOrigin(); // gAgent.getPositionAgent(); p += caster_dir * RenderFarClip*2.f; shadow_near_clip.setVec(p, caster_dir); } @@ -9318,9 +9294,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) up = camera.getUpAxis(); } - /*LLVector3 left = up%at; - up = at%left;*/ - up.normVec(); at.normVec(); @@ -9403,6 +9376,14 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mSunClipPlanes.mV[0] *= 1.25f; //bump back first split for transition padding } + if (gCubeSnapshot) + { // stretch clip planes for reflection probe renders to reduce number of shadow passes + mSunClipPlanes.mV[1] = mSunClipPlanes.mV[2]; + mSunClipPlanes.mV[2] = mSunClipPlanes.mV[3]; + mSunClipPlanes.mV[3] *= 1.5f; + } + + // convenience array of 4 near clip plane distances F32 dist[] = { near_clip, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] }; @@ -9419,7 +9400,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } else { - for (S32 j = 0; j < 4; j++) + for (S32 j = 0; j < (gCubeSnapshot ? 2 : 4); j++) { if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot) { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 0faa0c3f20..4cefb719fd 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -999,9 +999,6 @@ public: static F32 RenderShadowBlurDistFactor; static bool RenderDeferredAtmospheric; static F32 RenderHighlightFadeTime; - static LLVector3 RenderShadowClipPlanes; - static LLVector3 RenderShadowOrthoClipPlanes; - static LLVector3 RenderShadowNearDist; static F32 RenderFarClip; static LLVector3 RenderShadowSplitExponent; static F32 RenderShadowErrorCutoff; diff --git a/indra/newview/skins/default/xui/en/floater_material_editor.xml b/indra/newview/skins/default/xui/en/floater_material_editor.xml index 1c58ea6977..a6a401f43e 100644 --- a/indra/newview/skins/default/xui/en/floater_material_editor.xml +++ b/indra/newview/skins/default/xui/en/floater_material_editor.xml @@ -29,7 +29,6 @@ color="DkGray2" opaque="true" tab_stop="true" - border="false" reserve_scroll_corner="false"> <panel name="panel_material" |