Merge branch 'zesterer/shaders' into 'master'

Fixed bloom sample UV, added Cinematic shader

See merge request veloren/veloren!4002
This commit is contained in:
Joshua Barretto 2023-06-29 18:12:39 +00:00
commit e6e4f8f77a
2 changed files with 12 additions and 2 deletions

View File

@ -283,7 +283,7 @@ void main() {
// Bloom // Bloom
#ifdef BLOOM_FACTOR #ifdef BLOOM_FACTOR
vec4 bloom = textureLod(sampler2D(t_src_bloom, s_src_color), uv, 0); vec4 bloom = textureLod(sampler2D(t_src_bloom, s_src_color), sample_uv, 0);
#if (BLOOM_UNIFORM_BLUR == false) #if (BLOOM_UNIFORM_BLUR == false)
// divide by 4.0 to account for adding blurred layers together // divide by 4.0 to account for adding blurred layers together
bloom /= 4.0; bloom /= 4.0;
@ -294,7 +294,11 @@ void main() {
// Tonemapping // Tonemapping
float exposure_offset = 1.0; float exposure_offset = 1.0;
// Adding an in-code offset to gamma and exposure let us have more precise control over the game's look // Adding an in-code offset to gamma and exposure let us have more precise control over the game's look
float gamma_offset = 0.3; #ifdef EXPERIMENTAL_CINEMATIC
float gamma_offset = 0.5;
#else
float gamma_offset = 0.3;
#endif
aa_color.rgb = vec3(1.0) - exp(-aa_color.rgb * (gamma_exposure.y + exposure_offset)); aa_color.rgb = vec3(1.0) - exp(-aa_color.rgb * (gamma_exposure.y + exposure_offset));
// gamma correction // gamma correction
aa_color.rgb = pow(aa_color.rgb, vec3(gamma_exposure.x + gamma_offset)); aa_color.rgb = pow(aa_color.rgb, vec3(gamma_exposure.x + gamma_offset));
@ -373,5 +377,9 @@ void main() {
#endif #endif
#endif #endif
#ifdef EXPERIMENTAL_CINEMATIC
final_color.rgb = hsv2rgb(rgb2hsv(final_color.rgb) * vec3(1, 1, 1.3) + vec3(-0.01, 0.05, 0));
#endif
tgt_color = vec4(final_color.rgb, 1); tgt_color = vec4(final_color.rgb, 1);
} }

View File

@ -543,4 +543,6 @@ pub enum ExperimentalShader {
Newspaper, Newspaper,
/// A colorful dithering effect. /// A colorful dithering effect.
ColorDithering, ColorDithering,
/// Cinematic color grading.
Cinematic,
} }