diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/effects')
7 files changed, 164 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/effects/bloomBlurF.glsl b/indra/newview/app_settings/shaders/class1/effects/bloomBlurF.glsl new file mode 100644 index 0000000000..0efbbdce96 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/bloomBlurF.glsl @@ -0,0 +1,37 @@ +out vec4 frag_color; + +in vec2 vary_texcoord0; + +uniform sampler2D bloomEMap; + +uniform bool bloomHorizontal; +uniform float bloomBlurRadius = 1.5; + +uniform float weight[5] = float[] (0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216); + +void main() +{ + vec2 size = vec2(bloomBlurRadius, bloomBlurRadius); + + vec2 tex_offset = size / textureSize(bloomEMap, 0); // gets size of single texel + vec3 result = texture(bloomEMap, vary_texcoord0).rgb * weight[0]; // current fragment's contribution + + if(bloomHorizontal) + { + for(int i = 1; i < 5; i++) + { + result += texture(bloomEMap, vary_texcoord0 + vec2(tex_offset.x * i, 0.0)).rgb * weight[i]; + result += texture(bloomEMap, vary_texcoord0 - vec2(tex_offset.x * i, 0.0)).rgb * weight[i]; + } + } + else + { + for(int i = 1; i < 5; i++) + { + result += texture(bloomEMap, vary_texcoord0 + vec2(0.0, tex_offset.y * i)).rgb * weight[i]; + result += texture(bloomEMap, vary_texcoord0 - vec2(0.0, tex_offset.y * i)).rgb * weight[i]; + } + } + + frag_color = vec4(result, 1.0); +}
\ No newline at end of file diff --git a/indra/newview/app_settings/shaders/class1/effects/bloomBlurV.glsl b/indra/newview/app_settings/shaders/class1/effects/bloomBlurV.glsl new file mode 100644 index 0000000000..e40b60ed3c --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/bloomBlurV.glsl @@ -0,0 +1,8 @@ +in vec3 position; +out vec2 vary_texcoord0; + +void main() +{ + gl_Position = vec4(position, 1.0); + vary_texcoord0.xy = position.xy * 0.5 + 0.5; +}
\ No newline at end of file diff --git a/indra/newview/app_settings/shaders/class1/effects/bloomCombineF.glsl b/indra/newview/app_settings/shaders/class1/effects/bloomCombineF.glsl new file mode 100644 index 0000000000..40cfdd6bff --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/bloomCombineF.glsl @@ -0,0 +1,21 @@ +out vec4 frag_color; + +in vec2 vary_texcoord0; + +uniform sampler2D diffuseMap; +uniform sampler2D bloomBlurredMap; + +uniform float bloomStrength; +uniform float bloomClampValue; + +void main() +{ + vec4 hdrColor = texture(diffuseMap, vary_texcoord0); + vec4 bloomColor = texture(bloomBlurredMap, vary_texcoord0); + vec4 result = hdrColor; + + result.rgb += bloomStrength * bloomColor.rgb; + result.rgb = clamp(result.rgb, vec3(0.0), vec3(bloomClampValue)); + + frag_color = result; +}
\ No newline at end of file diff --git a/indra/newview/app_settings/shaders/class1/effects/bloomCombineV.glsl b/indra/newview/app_settings/shaders/class1/effects/bloomCombineV.glsl new file mode 100644 index 0000000000..e40b60ed3c --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/bloomCombineV.glsl @@ -0,0 +1,8 @@ +in vec3 position; +out vec2 vary_texcoord0; + +void main() +{ + gl_Position = vec4(position, 1.0); + vary_texcoord0.xy = position.xy * 0.5 + 0.5; +}
\ No newline at end of file diff --git a/indra/newview/app_settings/shaders/class1/effects/bloomExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/bloomExtractF.glsl new file mode 100644 index 0000000000..d878ab053e --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/bloomExtractF.glsl @@ -0,0 +1,81 @@ +out vec4 frag_color; + +uniform sampler2D diffuseMap; +uniform sampler2D bloomExtractORM; // orm +uniform sampler2D bloomExtractEmissive; // emissive +uniform sampler2D bloomExtractEmissive2; // emissive 2 + +uniform float bloomExtractBrightness = 0.9; +uniform float bloomExtractMetal = 0.20; +uniform float bloomExtractNonMetal = 0.20; + +in vec2 vary_texcoord0; + +void main() +{ + vec4 col = texture(diffuseMap, vary_texcoord0.xy); + + //int valid = 0; + //float brightness = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)); + float brightness = dot(col.rgb, vec3(0.3, 0.5, 0.2)); + + if(brightness < bloomExtractBrightness) + { + discard; + return; + } + + vec3 emi = texture(bloomExtractEmissive, vary_texcoord0.xy).rgb; + if(emi.r + emi.g + emi.b > 0.01) + { + discard; + return; + } + + emi = texture(bloomExtractEmissive2, vary_texcoord0.xy).rgb; + if(emi.r + emi.g + emi.b > 0.01) + { + discard; + return; + } + + vec4 orm = texture(bloomExtractORM, vary_texcoord0.xy); + + if(orm.r < 0.7) + { + discard; + return; + } + + if(bloomExtractMetal == 1.0 && bloomExtractNonMetal == 1.0) + { + frag_color = vec4(col.rgb, 0.0); + return; + } + + if(orm.b < 0.15) + { + // non metal + if(orm.g >= bloomExtractNonMetal) + { + discard; + return; + } + } + else if(orm.b > 0.8) + { + // metal + if(orm.g >= bloomExtractMetal) + { + discard; + return; + } + } + else + { + discard; + return; + } + + frag_color = vec4(col.rgb, 0.0); +}
\ No newline at end of file diff --git a/indra/newview/app_settings/shaders/class1/effects/bloomExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/bloomExtractV.glsl new file mode 100644 index 0000000000..e40b60ed3c --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/bloomExtractV.glsl @@ -0,0 +1,8 @@ +in vec3 position; +out vec2 vary_texcoord0; + +void main() +{ + gl_Position = vec4(position, 1.0); + vary_texcoord0.xy = position.xy * 0.5 + 0.5; +}
\ No newline at end of file diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl index 72eda80716..bfb592be9b 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl @@ -49,7 +49,7 @@ void main() float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) ); #if HAS_NOISE - float TRUE_NOISE_RES = 128; // See mTrueNoiseMap + float TRUE_NOISE_RES = 128.0; // See mTrueNoiseMap // *NOTE: Usually this is vary_fragcoord not vary_texcoord0, but glow extraction is in screen space vec3 glow_noise = texture(glowNoiseMap, vary_texcoord0.xy * (screen_res / TRUE_NOISE_RES)).xyz; // Dithering. Reduces banding effects in the reduced precision glow buffer. |