diff options
author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-05-22 10:42:18 -0700 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-05-22 10:42:18 -0700 |
commit | b273edd1253e088ea864d399342a0cba2fd0aaa9 (patch) | |
tree | 317ff7c05eacccb80b3fe06d65d8f64d7ff6019d /indra/newview/app_settings/shaders/class3/deferred | |
parent | da72081582c3fd376e228cf0fceaef2ecb1948a9 (diff) | |
parent | c6fc951f34c665d0f1cd6dcff1bea114fb0ff1a0 (diff) |
Merge branch 'DRTVWR-559' into DRTVWR-583
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred')
11 files changed, 71 insertions, 118 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index 6b7dc7ac1d..1c79748b49 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -25,26 +25,23 @@ /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif #ifndef HAS_DIFFUSE_LOOKUP uniform sampler2D diffuseMap; #endif -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; -VARYING vec3 vary_position; +in vec4 vertex_color; +in vec2 vary_texcoord0; +in vec3 vary_texcoord1; +in vec3 vary_position; uniform samplerCube environmentMap; -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); - +vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); +vec3 legacy_adjust_fullbright(vec3 c); +vec3 legacy_adjust(vec3 c); void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); vec3 linear_to_srgb(vec3 c); @@ -61,7 +58,7 @@ void main() #ifdef HAS_DIFFUSE_LOOKUP vec4 color = diffuseLookup(vary_texcoord0.xy); #else - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 color = texture(diffuseMap, vary_texcoord0.xy); #endif color.rgb *= vertex_color.rgb; @@ -84,10 +81,13 @@ void main() vec3 norm = normalize(vary_texcoord1.xyz); vec4 spec = vec4(0,0,0,0); sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity); - applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity); + color.rgb = legacy_adjust(color.rgb); color.rgb = srgb_to_linear(color.rgb); - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); + color.rgb = legacy_adjust_fullbright(color.rgb); + + applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity); + color.rgb = atmosFragLighting(color.rgb, additive, atten); #endif color.a = 1.0; diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index e5341386bd..77e3b92385 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -52,11 +52,7 @@ vec3 legacy_adjust(vec3 c); #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif #ifdef HAS_SUN_SHADOW float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); @@ -77,9 +73,9 @@ uniform mat3 env_mat; uniform vec3 sun_dir; uniform vec3 moon_dir; -VARYING vec2 vary_fragcoord; +in vec2 vary_fragcoord; -VARYING vec3 vary_position; +in vec3 vary_position; uniform mat4 proj_mat; uniform mat4 inv_proj; @@ -167,7 +163,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe if (nh > 0.0) { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da); + float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt / (nh*da); vec3 speccol = lit*scol*light_col.rgb*spec.rgb; speccol = clamp(speccol, vec3(0), vec3(1)); col += speccol; @@ -184,11 +180,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe } #else -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_data[4]; -#else -#define frag_data gl_FragData -#endif #endif uniform sampler2D diffuseMap; //always in sRGB space @@ -200,7 +192,7 @@ uniform sampler2D bumpMap; #ifdef HAS_SPECULAR_MAP uniform sampler2D specularMap; -VARYING vec2 vary_texcoord2; +in vec2 vary_texcoord2; #endif uniform float env_intensity; @@ -214,13 +206,13 @@ uniform float minimum_alpha; in vec3 vary_normal; in vec3 vary_tangent; flat in float vary_sign; -VARYING vec2 vary_texcoord1; +in vec2 vary_texcoord1; #else -VARYING vec3 vary_normal; +in vec3 vary_normal; #endif -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; +in vec4 vertex_color; +in vec2 vary_texcoord0; vec2 encode_normal(vec3 n); @@ -228,7 +220,7 @@ vec2 encode_normal(vec3 n); vec3 getNormal(inout float glossiness) { #ifdef HAS_NORMAL_MAP - vec4 vNt = texture2D(bumpMap, vary_texcoord1.xy); + vec4 vNt = texture(bumpMap, vary_texcoord1.xy); glossiness *= vNt.a; vNt.xyz = vNt.xyz * 2 - 1; float sign = vary_sign; @@ -247,7 +239,7 @@ vec3 getNormal(inout float glossiness) vec4 getSpecular() { #ifdef HAS_SPECULAR_MAP - vec4 spec = texture2D(specularMap, vary_texcoord2.xy); + vec4 spec = texture(specularMap, vary_texcoord2.xy); spec.rgb *= specular_color.rgb; #else vec4 spec = vec4(specular_color.rgb, 1.0); @@ -301,7 +293,7 @@ void main() waterClip(); // diffcol == diffuse map combined with vertex color - vec4 diffcol = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 diffcol = texture(diffuseMap, vary_texcoord0.xy); diffcol.rgb *= vertex_color.rgb; alphaMask(diffcol.a); @@ -364,7 +356,7 @@ void main() if (glossiness > 0.0) // specular reflection { float sa = dot(normalize(refnormpersp), light_dir.xyz); - vec3 dumbshiny = sunlit_linear * shadow * (texture2D(lightFunc, vec2(sa, glossiness)).r); + vec3 dumbshiny = sunlit_linear * shadow * (texture(lightFunc, vec2(sa, glossiness)).r); // add the two types of shiny together vec3 spec_contrib = dumbshiny * spec.rgb; @@ -395,7 +387,7 @@ void main() float gtdenom = 2 * nh; float gt = max(0,(min(gtdenom * nv / vh, gtdenom * nl / vh))); - float scol = shadow*fres*texture2D(lightFunc, vec2(nh, glossiness)).r*gt/(nh*nl); + float scol = shadow*fres*texture(lightFunc, vec2(nh, glossiness)).r*gt/(nh*nl); color.rgb += lit*scol*sunlit_linear.rgb*spec.rgb; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index 2da177ea7e..2a096a98ec 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -23,15 +23,9 @@ * $/LicenseInfo$ */ -#extension GL_ARB_texture_rectangle : enable - /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif uniform sampler2D depthMap; uniform sampler2D diffuseRect; @@ -49,7 +43,7 @@ uniform vec2 screen_res; uniform float far_z; uniform mat4 inv_proj; -VARYING vec4 vary_fragcoord; +in vec4 vary_fragcoord; void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist); float calcLegacyDistanceAttenuation(float distance, float falloff); @@ -88,15 +82,15 @@ void main() vec3 n; vec4 norm = getNormalEnvIntensityFlags(tc, n, envIntensity); // need `norm.w` for GET_GBUFFER_FLAG() - vec4 spec = texture2D(specularRect, tc); - vec3 diffuse = texture2D(diffuseRect, tc).rgb; + vec4 spec = texture(specularRect, tc); + vec3 diffuse = texture(diffuseRect, tc).rgb; vec3 h, l, v = -normalize(pos); float nh, nv, vh, lightDist; if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = texture2D(emissiveRect, tc).rgb; + vec3 colorEmissive = texture(emissiveRect, tc).rgb; vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; @@ -167,7 +161,7 @@ void main() if (nh > 0.0) { - float scol = fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt / (nh * nl); + float scol = fres * texture(lightFunc, vec2(nh, spec.a)).r * gt / (nh * nl); col += lit * scol * light_col[i].rgb * spec.rgb; } } diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl index 831b3b2684..c2b9ed3d96 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl @@ -23,9 +23,9 @@ * $/LicenseInfo$ */ -ATTRIBUTE vec3 position; +in vec3 position; -VARYING vec4 vary_fragcoord; +out vec4 vary_fragcoord; void main() { diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl index 33715d4d87..23120bbbbe 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl @@ -23,16 +23,9 @@ * $/LicenseInfo$ */ -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif uniform sampler2D diffuseRect; uniform sampler2D specularRect; @@ -67,7 +60,7 @@ uniform float size; uniform vec3 color; uniform float falloff; -VARYING vec4 vary_fragcoord; +in vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; @@ -118,7 +111,7 @@ void main() if (proj_shadow_idx >= 0) { - vec4 shd = texture2D(lightMap, tc); + vec4 shd = texture(lightMap, tc); shadow = (proj_shadow_idx==0)?shd.b:shd.a; shadow += shadow_fade; shadow = clamp(shadow, 0.0, 1.0); @@ -139,8 +132,8 @@ void main() float nh, nl, nv, vh, lightDist; calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist); - vec3 diffuse = texture2D(diffuseRect, tc).rgb; - vec4 spec = texture2D(specularRect, tc); + vec3 diffuse = texture(diffuseRect, tc).rgb; + vec4 spec = texture(specularRect, tc); vec3 dlit = vec3(0, 0, 0); vec3 slit = vec3(0, 0, 0); @@ -148,7 +141,7 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = texture2D(emissiveRect, tc).rgb; + vec3 colorEmissive = texture(emissiveRect, tc).rgb; vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; @@ -223,7 +216,7 @@ void main() if (nh > 0.0) { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); + float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); vec3 speccol = dlit*scol*spec.rgb*shadow; speccol = clamp(speccol, vec3(0), vec3(1)); final_color += speccol; diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 7724a6cac9..42ba96148c 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -23,15 +23,9 @@ * $/LicenseInfo$ */ -#extension GL_ARB_texture_rectangle : enable - /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif uniform sampler2D diffuseRect; uniform sampler2D specularRect; @@ -48,8 +42,8 @@ uniform vec3 color; uniform float falloff; uniform float size; -VARYING vec4 vary_fragcoord; -VARYING vec3 trans_center; +in vec4 vary_fragcoord; +in vec3 trans_center; uniform vec2 screen_res; @@ -83,8 +77,8 @@ void main() vec3 n; vec4 norm = getNormalEnvIntensityFlags(tc, n, envIntensity); // need `norm.w` for GET_GBUFFER_FLAG() - vec3 diffuse = texture2D(diffuseRect, tc).rgb; - vec4 spec = texture2D(specularRect, tc); + vec3 diffuse = texture(diffuseRect, tc).rgb; + vec4 spec = texture(specularRect, tc); // Common half vectors calcs vec3 lv = trans_center.xyz-pos; @@ -101,7 +95,7 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = texture2D(emissiveRect, tc).rgb; + vec3 colorEmissive = texture(emissiveRect, tc).rgb; vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; @@ -141,7 +135,7 @@ void main() if (nh > 0.0) { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); + float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); final_color += lit*scol*color.rgb*spec.rgb; } } diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl index d42c8f6cf6..8d23f1b427 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl @@ -26,13 +26,13 @@ uniform mat4 modelview_projection_matrix; uniform mat4 modelview_matrix; -ATTRIBUTE vec3 position; +in vec3 position; uniform vec3 center; uniform float size; -VARYING vec4 vary_fragcoord; -VARYING vec3 trans_center; +out vec4 vary_fragcoord; +out vec3 trans_center; void main() { diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl index 8043a78a82..dbf20fe2d8 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl @@ -23,15 +23,9 @@ * $/LicenseInfo$ */ -#extension GL_ARB_texture_rectangle : enable - /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif uniform vec2 screen_res; uniform mat4 projection_matrix; @@ -39,8 +33,8 @@ uniform mat4 inv_proj; uniform float zNear; uniform float zFar; -VARYING vec2 vary_fragcoord; -VARYING vec3 camera_ray; +in vec2 vary_fragcoord; +in vec3 camera_ray; uniform sampler2D specularRect; uniform sampler2D diffuseRect; @@ -67,10 +61,10 @@ void main() vec3 n; vec4 norm = getNormalEnvIntensityFlags(tc, n, envIntensity); // need `norm.w` for GET_GBUFFER_FLAG() vec3 pos = getPositionWithDepth(tc, getDepth(tc)).xyz; - vec4 spec = texture2D(specularRect, tc); + vec4 spec = texture(specularRect, tc); vec2 hitpixel; - vec4 diffuse = texture2D(diffuseRect, tc); + vec4 diffuse = texture(diffuseRect, tc); vec3 specCol = spec.rgb; vec4 fcol = texture(diffuseMap, tc); diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl index b084094d4d..f7e7268cc3 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl @@ -26,12 +26,12 @@ uniform mat4 projection_matrix; uniform mat4 inv_proj; -ATTRIBUTE vec3 position; +in vec3 position; uniform vec2 screen_res; -VARYING vec2 vary_fragcoord; -VARYING vec3 camera_ray; +out vec2 vary_fragcoord; +out vec3 camera_ray; void main() diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index a8d61afeca..2f3efaa94a 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -23,19 +23,12 @@ * $/LicenseInfo$ */ -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - #define FLT_MAX 3.402823466e+38 #define REFMAP_COUNT 256 #define REF_SAMPLE_COUNT 64 //maximum number of samples to consider -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif uniform sampler2D diffuseRect; uniform sampler2D specularRect; @@ -60,7 +53,7 @@ uniform mat3 env_mat; uniform vec3 sun_dir; uniform vec3 moon_dir; uniform int sun_up_factor; -VARYING vec2 vary_fragcoord; +in vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -127,16 +120,16 @@ void main() vec2 tc = vary_fragcoord.xy; float depth = getDepth(tc.xy); vec4 pos = getPositionWithDepth(tc, depth); - vec4 norm = texture2D(normalMap, tc); + vec4 norm = texture(normalMap, tc); float envIntensity = norm.z; norm.xyz = getNorm(tc); vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - vec4 baseColor = texture2D(diffuseRect, tc); - vec4 spec = texture2D(specularRect, vary_fragcoord.xy); // NOTE: PBR linear Emissive + vec4 baseColor = texture(diffuseRect, tc); + vec4 spec = texture(specularRect, vary_fragcoord.xy); // NOTE: PBR linear Emissive #if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO) - vec2 scol_ambocc = texture2D(lightMap, vary_fragcoord.xy).rg; + vec2 scol_ambocc = texture(lightMap, vary_fragcoord.xy).rg; #endif #if defined(HAS_SUN_SHADOW) @@ -180,12 +173,12 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 orm = texture2D(specularRect, tc).rgb; + vec3 orm = texture(specularRect, tc).rgb; float perceptualRoughness = orm.g; float metallic = orm.b; float ao = orm.r * ambocc; - vec3 colorEmissive = texture2D(emissiveRect, tc).rgb; + vec3 colorEmissive = texture(emissiveRect, tc).rgb; // PBR IBL float gloss = 1.0 - perceptualRoughness; @@ -211,7 +204,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 = texture2D(emissiveRect, tc).rgb; + color = texture(emissiveRect, tc).rgb; color = srgb_to_linear(color); if (sun_up_factor > 0) { @@ -263,7 +256,7 @@ void main() float gtdenom = 2 * nh; float gt = max(0,(min(gtdenom * nv / vh, gtdenom * nl / vh))); - scol *= fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); + scol *= fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); color.rgb += lit*scol*sunlit_linear.rgb*spec.rgb; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index f2ab585716..1ea801d7d7 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -23,9 +23,6 @@ * $/LicenseInfo$ */ -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - /*[EXTRA_CODE_HERE]*/ #define DEBUG_ANY_LIGHT_TYPE 0 // Output green light cone @@ -38,11 +35,7 @@ #define DEBUG_SPOT_NL 0 // monochome area effected by light #define DEBUG_SPOT_ZERO 0 // Output zero for spotlight -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif uniform sampler2D diffuseRect; uniform sampler2D specularRect; @@ -75,8 +68,8 @@ uniform float size; uniform vec3 color; uniform float falloff; -VARYING vec3 trans_center; -VARYING vec4 vary_fragcoord; +in vec3 trans_center; +in vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; @@ -126,7 +119,7 @@ void main() if (proj_shadow_idx >= 0) { - vec4 shd = texture2D(lightMap, tc); + vec4 shd = texture(lightMap, tc); shadow = (proj_shadow_idx == 0) ? shd.b : shd.a; shadow += shadow_fade; shadow = clamp(shadow, 0.0, 1.0); @@ -147,15 +140,15 @@ void main() float nh, nl, nv, vh, lightDist; calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist); - vec3 diffuse = texture2D(diffuseRect, tc).rgb; - vec4 spec = texture2D(specularRect, tc); + vec3 diffuse = texture(diffuseRect, tc).rgb; + vec4 spec = texture(specularRect, tc); vec3 dlit = vec3(0, 0, 0); vec3 slit = vec3(0, 0, 0); vec3 amb_rgb = vec3(0); if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = texture2D(emissiveRect, tc).rgb; + vec3 colorEmissive = texture(emissiveRect, tc).rgb; vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; @@ -231,7 +224,7 @@ void main() if (nh > 0.0) { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); + float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); vec3 speccol = dlit*scol*spec.rgb*shadow; speccol = clamp(speccol, vec3(0), vec3(1)); final_color += speccol; |