mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 07:41:31 +11:00
Fixed Magic Bloom wrapping issue
This commit is contained in:
parent
defceb3d0a
commit
e300398571
|
@ -1,108 +0,0 @@
|
|||
shaders = 12
|
||||
|
||||
shader0 = ../../stock.slang
|
||||
filter_linear0 = true
|
||||
wrap_mode0 = mirrored_repeat
|
||||
scale_type0 = viewport
|
||||
scale0 = 1.0
|
||||
alias0 = "PreBloomPass"
|
||||
|
||||
// shader0 = ../kawase/linearize.slang
|
||||
// filter_linear0 = true
|
||||
// wrap_mode0 = mirrored_repeat
|
||||
// scale_type0 = viewport
|
||||
// scale0 = 1.0
|
||||
// alias0 = "PreBloomPass"
|
||||
|
||||
shader1 = ./magicbloom_blur_pass_1.slang
|
||||
filter_linear1 = true
|
||||
mipmap_input1 = true
|
||||
wrap_mode1 = mirrored_repeat
|
||||
scale_type1 = absolute
|
||||
// scale_x1 = 960
|
||||
// scale_y1 = 540
|
||||
scale_x1 = 1920
|
||||
scale_y1 = 1080
|
||||
// scale_type1 = viewport
|
||||
// scale1 = 0.5
|
||||
alias1 = "tMagicBloom_1"
|
||||
|
||||
shader2 = ./magicbloom_blur_pass_2.slang
|
||||
filter_linear2 = true
|
||||
mipmap_input2 = true
|
||||
wrap_mode2 = mirrored_repeat
|
||||
scale_type2 = source
|
||||
scale2 = 0.75
|
||||
// scale2 = 0.25
|
||||
alias2 = "tMagicBloom_2"
|
||||
|
||||
shader3 = ./magicbloom_blur_pass_3.slang
|
||||
filter_linear3 = true
|
||||
mipmap_input3 = true
|
||||
wrap_mode3 = mirrored_repeat
|
||||
scale_type3 = source
|
||||
scale3 = 0.75
|
||||
// scale3 = 0.125
|
||||
alias3 = "tMagicBloom_3"
|
||||
|
||||
shader4 = ./magicbloom_blur_pass_4.slang
|
||||
filter_linear4 = true
|
||||
mipmap_input4 = true
|
||||
wrap_mode4 = mirrored_repeat
|
||||
scale_type4 = source
|
||||
scale4 = 0.75
|
||||
alias4 = "tMagicBloom_4"
|
||||
|
||||
shader5 = ./magicbloom_blur_pass_5.slang
|
||||
filter_linear5 = true
|
||||
mipmap_input5 = true
|
||||
wrap_mode5 = mirrored_repeat
|
||||
scale_type5 = source
|
||||
scale5 = 0.75
|
||||
alias5 = "tMagicBloom_5"
|
||||
|
||||
shader6 = ./magicbloom_blur_pass_6.slang
|
||||
filter_linear6 = true
|
||||
mipmap_input6 = true
|
||||
scale_type6 = source
|
||||
scale6 = 0.5
|
||||
alias6 = "tMagicBloom_6"
|
||||
|
||||
shader7 = ./magicbloom_blur_pass_7.slang
|
||||
filter_linear7 = true
|
||||
mipmap_input7 = true
|
||||
scale_type7 = source
|
||||
scale7 = 0.5
|
||||
alias7 = "tMagicBloom_7"
|
||||
|
||||
shader8 = ./magicbloom_blur_pass_8.slang
|
||||
filter_linear8 = true
|
||||
mipmap_input8 = true
|
||||
scale_type8 = source
|
||||
scale8 = 0.5
|
||||
alias8 = "tMagicBloom_8"
|
||||
|
||||
shader9 = ./magicbloom_get_small_luma.slang
|
||||
filter_linear9 = true
|
||||
mipmap_input9 = true
|
||||
scale_type9 = absolute
|
||||
scale_x9 = 256
|
||||
scale_y9 = 256
|
||||
alias9 = "tMagicBloom_Small"
|
||||
|
||||
shader10 = ./magicbloom_get_adapt.slang
|
||||
filter_linear10 = true
|
||||
mipmap_input10 = true
|
||||
scale_type10 = source
|
||||
scale10 = 1.0
|
||||
alias10 = "tMagicBloom_Adapt"
|
||||
|
||||
shader11 = ./magicbloom_blend.slang
|
||||
filter_linear11 = true
|
||||
mipmap_input11 = true
|
||||
scale_type11 = viewport
|
||||
scale11 = 1.0
|
||||
|
||||
textures = "tMagicBloom_Dirt"
|
||||
|
||||
tMagicBloom_Dirt = "MagicBloom_dirt.png"
|
|
@ -1,7 +1,7 @@
|
|||
shaders = 12
|
||||
|
||||
shader0 = ../stock.slang
|
||||
filter_linear0 = true
|
||||
filter_linear0 = false
|
||||
wrap_mode0 = mirrored_repeat
|
||||
scale_type0 = viewport
|
||||
scale0 = 1.0
|
||||
|
@ -51,6 +51,7 @@ alias5 = "tMagicBloom_5"
|
|||
shader6 = ./shaders/magicbloom/magicbloom_blur_pass_6.slang
|
||||
filter_linear6 = true
|
||||
mipmap_input6 = true
|
||||
wrap_mode6 = mirrored_repeat
|
||||
scale_type6 = source
|
||||
scale6 = 0.5
|
||||
alias6 = "tMagicBloom_6"
|
||||
|
@ -58,6 +59,7 @@ alias6 = "tMagicBloom_6"
|
|||
shader7 = ./shaders/magicbloom/magicbloom_blur_pass_7.slang
|
||||
filter_linear7 = true
|
||||
mipmap_input7 = true
|
||||
wrap_mode7 = mirrored_repeat
|
||||
scale_type7 = source
|
||||
scale7 = 0.5
|
||||
alias7 = "tMagicBloom_7"
|
||||
|
@ -65,6 +67,7 @@ alias7 = "tMagicBloom_7"
|
|||
shader8 = ./shaders/magicbloom/magicbloom_blur_pass_8.slang
|
||||
filter_linear8 = true
|
||||
mipmap_input8 = true
|
||||
wrap_mode8 = mirrored_repeat
|
||||
scale_type8 = source
|
||||
scale8 = 0.5
|
||||
alias8 = "tMagicBloom_8"
|
||||
|
|
|
@ -96,16 +96,16 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
|||
mat4 MVP;
|
||||
} global;
|
||||
|
||||
#pragma parameter ApplyBloom " Apply Bloom" 1 0 1 1
|
||||
#pragma parameter ApplyBloom " Apply Bloom" 1 0 1 1
|
||||
#define ApplyBloom params.ApplyBloom
|
||||
|
||||
#pragma parameter fExposure " Exposure" 0.2 0 1 0.001
|
||||
#pragma parameter fExposure " Exposure" 0.2 0 1 0.01
|
||||
#define fExposure params.fExposure
|
||||
|
||||
#pragma parameter fDirt_Intensity " Dirt Intensity" 0 0 1 0.001
|
||||
#pragma parameter fDirt_Intensity " Dirt Intensity" 0 0 1 0.01
|
||||
#define fDirt_Intensity params.fDirt_Intensity
|
||||
|
||||
#pragma parameter iDebug " Debug: Show Blur Pass" 0 0 1 1
|
||||
#pragma parameter iDebug " Debug: Show Bloom Contribution" 0 0 1 1
|
||||
#define iDebug params.iDebug
|
||||
|
||||
#pragma stage vertex
|
||||
|
@ -178,27 +178,27 @@ vec4 PS_Blend(vec2 uv){
|
|||
bloom /= 8;
|
||||
|
||||
// TODO need to use the feedback, also the blend is possibly the last pass
|
||||
// #if !MAGICBLOOM_NOADAPT
|
||||
#if !MAGICBLOOM_NOADAPT
|
||||
float exposure = fExposure / max(texture(tMagicBloom_Adapt, vec2(0.0)).x, 0.00001);
|
||||
bloom = tonemap(bloom, exposure);
|
||||
// #else
|
||||
#else
|
||||
// Without adaptation it seems 100.0 exposure is needed for bloom to look bright enough.
|
||||
// bloom = tonemap(bloom, 100.0);
|
||||
// #endif
|
||||
bloom = tonemap(bloom, 100.0);
|
||||
#endif
|
||||
|
||||
// // #if !MAGICBLOOM_NODIRT
|
||||
#if !MAGICBLOOM_NODIRT
|
||||
vec3 dirt = texture(tMagicBloom_Dirt, uv).rgb;
|
||||
dirt *= fDirt_Intensity;
|
||||
bloom = blend_screen(bloom, dirt * bloom);
|
||||
// // #endif
|
||||
#endif
|
||||
|
||||
vec3 col_max = max(col, bloom);
|
||||
|
||||
col = blend_screen(col, bloom);
|
||||
|
||||
// If we're to display the bloom texture, we replace col with it.
|
||||
col = iDebug == 1 ? bloom : col;
|
||||
|
||||
// col = pow(abs(col), vec3(1/2.2));
|
||||
|
||||
return vec4(col, 1.0);
|
||||
}
|
||||
|
||||
|
@ -206,10 +206,8 @@ void main()
|
|||
{
|
||||
if (ApplyBloom < 1){
|
||||
FragColor = texture(PreBloomPass, vTexCoord);
|
||||
// FragColor = pow(abs(FragColor), vec4(1/2.2));
|
||||
return;
|
||||
}
|
||||
|
||||
FragColor = PS_Blend(vTexCoord);
|
||||
// FragColor = pow(abs(FragColor), vec4(1/2.2));
|
||||
}
|
||||
|
|
|
@ -99,21 +99,24 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
|||
mat4 MVP;
|
||||
} global;
|
||||
|
||||
#pragma parameter ApplyBloom " Apply Bloom" 1 0 1 1
|
||||
#pragma parameter ApplyBloom " Apply Bloom" 1 0 1 1
|
||||
#define ApplyBloom params.ApplyBloom
|
||||
|
||||
#pragma parameter fAdapt_Speed " Adaptation Speed" 1 0.001 1 0.001
|
||||
#define fAdapt_Speed params.fAdapt_Speed
|
||||
#pragma parameter fExposure " Exposure" 0.2 0 1 0.01
|
||||
#define fExposure params.fExposure
|
||||
|
||||
#pragma parameter fAdapt_Sensitivity " Adaptation Sensitivity" 1 0 3 0.001
|
||||
#pragma parameter fAdapt_Sensitivity " Adaptation Sensitivity" 1 0 3 0.01
|
||||
float fAdapt_Sensitivity = params.fAdapt_Sensitivity;
|
||||
|
||||
#pragma parameter f2Adapt_Clip_Min " Adaptation Min" 0 0 3 0.001
|
||||
#pragma parameter f2Adapt_Clip_Min " Adaptation Min" 0 0 3 0.01
|
||||
#define f2Adapt_Clip_Min params.f2Adapt_Clip_Min
|
||||
|
||||
#pragma parameter f2Adapt_Clip_Max " Adaptation Max" 1 0 3 0.001
|
||||
#pragma parameter f2Adapt_Clip_Max " Adaptation Max" 1 0 3 0.01
|
||||
#define f2Adapt_Clip_Max params.f2Adapt_Clip_Max
|
||||
|
||||
#pragma parameter fAdapt_Speed " Adaptation Speed" 1 0.001 1 0.01
|
||||
#define fAdapt_Speed params.fAdapt_Speed
|
||||
|
||||
|
||||
#pragma stage vertex
|
||||
layout(location = 0) in vec4 Position;
|
||||
|
|
Loading…
Reference in a new issue