diff options
author | mobserveur <mobserveur@gmail.com> | 2025-08-30 01:59:43 +0200 |
---|---|---|
committer | mobserveur <mobserveur@gmail.com> | 2025-08-30 01:59:43 +0200 |
commit | 7f0c81918575d3f05e4eadc160b600eaa8b383d1 (patch) | |
tree | 4c6bb40e93e38bb8a32964380f97ac2a06490b11 /indra/newview/app_settings/shaders/class1/effects | |
parent | 03140ed619c5d49eb3851284ae53bbea73a8b831 (diff) |
Performance Optimisations, Bloom effect, Visuals Panel
This commit contains performance optimisations in the the pipeline,
framebuffer, vertexbuffer, reflection probes, shadows. It also fixes
many opengl errors, modifies the opengl debugging, and adds
a visuals effects panel.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/effects')
6 files changed, 165 insertions, 0 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..31a6e10fa4 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/effects/bloomCombineF.glsl @@ -0,0 +1,23 @@ +out vec4 frag_color; + +in vec2 vary_texcoord0; + +uniform sampler2D diffuseMap; +uniform sampler2D bloomBlurredMap; + +uniform float bloomStrength; + +void main() +{ + vec4 hdrColor = texture(diffuseMap, vary_texcoord0); + vec3 bloomColor = texture(bloomBlurredMap, vary_texcoord0).rgb; + vec4 result = vec4(0.0); + + result.r = min(hdrColor.r + bloomStrength * bloomColor.r, 1.0); + result.g = min(hdrColor.g + bloomStrength * bloomColor.g, 1.0); + result.b = min(hdrColor.b + bloomStrength * bloomColor.b, 1.0); + result.a = hdrColor.a; + + //bloomColor += hdrColor.rgb; + 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..8fb10d8698 --- /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 |