diff options
author | Jonathan Goodman <geenz@lindenlab.com> | 2022-11-14 18:12:22 +0000 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-11-14 18:12:22 +0000 |
commit | 97277e74a9d966ed441e51f844f9012f55cca3dc (patch) | |
tree | ed6a5c00a5065951ff9f77bf0277fb202dff0c0e /indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl | |
parent | 843a5c287e34855fb7bd4882d8d0a106e987a9f7 (diff) |
Merged in SL-18332 (pull request #1194)
First pass of Screen Space Reflections
Approved-by: Dave Parks
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 879f4ef510..5f6982746b 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -37,19 +37,19 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseRect; -uniform sampler2DRect specularRect; -uniform sampler2DRect normalMap; -uniform sampler2DRect emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl +uniform sampler2D diffuseRect; +uniform sampler2D specularRect; +uniform sampler2D normalMap; +uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl uniform sampler2D altDiffuseMap; // PBR: irradiance, skins/default/textures/default_irradiance.png const float M_PI = 3.14159265; #if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO) -uniform sampler2DRect lightMap; +uniform sampler2D lightMap; #endif -uniform sampler2DRect depthMap; +uniform sampler2D depthMap; uniform sampler2D lightFunc; uniform float blur_size; @@ -81,6 +81,7 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 pos, vec3 norm, float glossiness, float envIntensity); void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm); void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); +float getDepth(vec2 pos_screen); vec3 linear_to_srgb(vec3 c); vec3 srgb_to_linear(vec3 c); @@ -118,18 +119,18 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, void main() { vec2 tc = vary_fragcoord.xy; - float depth = texture2DRect(depthMap, tc.xy).r; + float depth = getDepth(tc.xy); vec4 pos = getPositionWithDepth(tc, depth); - vec4 norm = texture2DRect(normalMap, tc); + vec4 norm = texture2D(normalMap, tc); float envIntensity = norm.z; norm.xyz = getNorm(tc); vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - vec4 baseColor = texture2DRect(diffuseRect, tc); - vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); // NOTE: PBR linear Emissive + vec4 baseColor = texture2D(diffuseRect, tc); + vec4 spec = texture2D(specularRect, vary_fragcoord.xy); // NOTE: PBR linear Emissive #if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO) - vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; + vec2 scol_ambocc = texture2D(lightMap, vary_fragcoord.xy).rg; #endif #if defined(HAS_SUN_SHADOW) @@ -155,12 +156,12 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 orm = texture2DRect(specularRect, tc).rgb; + vec3 orm = texture2D(specularRect, tc).rgb; float perceptualRoughness = orm.g; float metallic = orm.b; float ao = orm.r * ambocc; - vec3 colorEmissive = texture2DRect(emissiveRect, tc).rgb; + vec3 colorEmissive = texture2D(emissiveRect, tc).rgb; // PBR IBL float gloss = 1.0 - perceptualRoughness; |