diff options
| author | Ptolemy <ptolemy@lindenlab.com> | 2022-07-06 12:29:19 -0700 | 
|---|---|---|
| committer | Ptolemy <ptolemy@lindenlab.com> | 2022-07-06 12:29:19 -0700 | 
| commit | 6369180eae30f2a4dfa7dc4a10149c632d69c4c3 (patch) | |
| tree | aa92cdbaf3b6fa43dfffd8fda1b03b1e406cf403 /indra | |
| parent | f49579ad25128b643f62115d9df249788d77d435 (diff) | |
SL-17682 PBR: Fix Occlusion Roughness Metal not being in linear space; removes need for redundant linear/sRGB conversions.
Diffstat (limited to 'indra')
4 files changed, 15 insertions, 15 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl index 6e96186c18..5072f16988 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl @@ -137,8 +137,9 @@ void main()      col.rgb = vary_position.xyz;  #endif +    // See: C++: addDeferredAttachments(), GLSL: softenLightF      frag_data[0] = vec4(col, 0.0);                                                   // Diffuse -    frag_data[1] = vec4(spec.rgb, vertex_color.a);                                   // Occlusion, Roughness, Metal +    frag_data[1] = vec4(emissive, vertex_color.a);                                   // PBR sRGB Emissive      frag_data[2] = vec4(encode_normal(tnorm), vertex_color.a, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags -    frag_data[3] = vec4(emissive,0);                                                 // Emissive +    frag_data[3] = vec4(spec.rgb,0);                                                 // PBR linear packed Occlusion, Roughness, Metal.  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index fbcc69586a..2bf2183f29 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -223,13 +223,13 @@ void main()          // These values MUST be encoded with a linear transfer function.          vec3 colorDiffuse      = vec3(0); -        vec3 colorEmissive     = srgb_to_linear(texture2DRect(emissiveRect, tc).rgb); +        vec3 colorEmissive     = spec.rgb; // PBR sRGB Emissive.  See: pbropaqueF.glsl          vec3 colorSpec         = vec3(0);  //      vec3 colorClearCoat    = vec3(0);  //      vec3 colorSheen        = vec3(0);  //      vec3 colorTransmission = vec3(0); -        vec3 packedORM        = spec.rgb; // Packed: Occlusion Roughness Metal +        vec3 packedORM        = texture2DRect(emissiveRect, tc).rgb; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl  #if DEBUG_PBR_PACK_ORM0               packedORM        = vec3(0,0,0);  #endif @@ -323,21 +323,18 @@ void main()      #endif      #if DEBUG_PBR_METAL          color.rgb = vec3(metal); -        color.rgb = linear_to_srgb(color.rgb);      #endif      #if DEBUG_PBR_NORMAL_MAP          color.rgb = diffuse.rgb;      #endif      #if DEBUG_PBR_OCCLUSION          color.rgb = vec3(packedORM.r); -        color.rgb = linear_to_srgb(color.rgb);      #endif      #if DEBUG_PBR_ORM          color.rgb = packedORM;      #endif      #if DEBUG_PBR_ROUGH_PERCEPTUAL          color.rgb = vec3(perceptualRough); -        color.rgb = linear_to_srgb(color.rgb);      #endif      #if DEBUG_PBR_ROUGH_ALPHA          color.rgb = vec3(alphaRough); diff --git a/indra/newview/lldrawpoolpbropaque.cpp b/indra/newview/lldrawpoolpbropaque.cpp index 86d73de14e..b59bffea1a 100644 --- a/indra/newview/lldrawpoolpbropaque.cpp +++ b/indra/newview/lldrawpoolpbropaque.cpp @@ -121,7 +121,7 @@ void LLDrawPoolPBROpaque::renderDeferred(S32 pass)          if (params.mSpecularMap)          { -            gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); // Packed Occlusion Roughness Metal +            gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); // PBR linear packed Occlusion, Roughness, Metal.          }          else          { @@ -130,7 +130,7 @@ void LLDrawPoolPBROpaque::renderDeferred(S32 pass)          if (params.mEmissiveMap)          { -            gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::EMISSIVE_MAP, params.mEmissiveMap); +            gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::EMISSIVE_MAP, params.mEmissiveMap);  // PBR sRGB Emissive          }          else          { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 88ee6ea860..bf0d074fcc 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -374,9 +374,9 @@ bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false)  {      bool pbr = gSavedSettings.getBOOL("RenderPBR");      bool valid = true -        && target.addColorAttachment(for_impostor ? GL_RGBA : GL_SRGB8_ALPHA8) // frag-data[1] specular or PBR packed OcclusionRoughnessMetal +        && target.addColorAttachment(for_impostor ? GL_RGBA : GL_SRGB8_ALPHA8) // frag-data[1] specular or PBR sRGB Emissive          && target.addColorAttachment(GL_RGB10_A2)                              // frag_data[2] normal+z+fogmask, See: class1\deferred\materialF.glsl & softenlight -        && (pbr ? target.addColorAttachment(GL_RGBA) : true);                  // frag_data[3] emissive +        && (pbr ? target.addColorAttachment(GL_RGBA) : true);                  // frag_data[3] PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl      return valid;  } @@ -8124,25 +8124,27 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_      channel = shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, deferred_target->getUsage());  	if (channel > -1)  	{ -        deferred_target->bindTexture(0,channel, LLTexUnit::TFO_POINT); +        deferred_target->bindTexture(0,channel, LLTexUnit::TFO_POINT); // frag_data[0]  	} +    // NOTE: PBR sRGB Emissive -- See: C++: addDeferredAttachments(), GLSL: pbropaqueF.glsl      channel = shader.enableTexture(LLShaderMgr::DEFERRED_SPECULAR, deferred_target->getUsage());  	if (channel > -1)  	{ -        deferred_target->bindTexture(1, channel, LLTexUnit::TFO_POINT); +        deferred_target->bindTexture(1, channel, LLTexUnit::TFO_POINT); // frag_data[1]  	}      channel = shader.enableTexture(LLShaderMgr::DEFERRED_NORMAL, deferred_target->getUsage());  	if (channel > -1)  	{ -        deferred_target->bindTexture(2, channel, LLTexUnit::TFO_POINT); +        deferred_target->bindTexture(2, channel, LLTexUnit::TFO_POINT); // frag_data[2]  	} +    // NOTE: PBR linear packed Occlusion, Roughness, Metal -- See: C++: addDeferredAttachments(), GLSL: pbropaqueF.glsl      channel = shader.enableTexture(LLShaderMgr::DEFERRED_EMISSIVE, deferred_target->getUsage());      if (channel > -1)      { -        deferred_target->bindTexture(3, channel, LLTexUnit::TFO_POINT); +        deferred_target->bindTexture(3, channel, LLTexUnit::TFO_POINT); // frag_data[3]      }      channel = shader.enableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_depth_target->getUsage()); | 
