mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-01 13:54:16 +01:00
46db482e22
With the new bloom graphic pack you can simply choose a preset of the amount of bloom and brightness/post-processing inside the shadow land, or you can fine-tune it to your likings with the custom options. Thanks to @KoB-Kirito for making this dedicated bloom pack!
68 lines
2.4 KiB
Plaintext
68 lines
2.4 KiB
Plaintext
#version 430
|
|
#extension GL_ARB_texture_gather : enable
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
|
|
|
|
// shader 6e2f31b2b2fcab1f: creates bloom mask
|
|
|
|
|
|
#ifdef VULKAN
|
|
#define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location)
|
|
#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation, std140)
|
|
#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation)
|
|
#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.z, 1.0/gl_FragCoord.w)
|
|
|
|
#else
|
|
#define ATTR_LAYOUT(__vkSet, __location) layout(location = __location)
|
|
#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation, std140)
|
|
#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation)
|
|
#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale,gl_FragCoord.zw)
|
|
|
|
#endif
|
|
|
|
#ifdef VULKAN
|
|
layout(set = 1, binding = 1) uniform ufBlock
|
|
{
|
|
uniform ivec4 uf_remappedPS[1]; // mask threshold
|
|
uniform vec4 uf_fragCoordScale;
|
|
};
|
|
|
|
#else
|
|
uniform ivec4 uf_remappedPS[1]; // mask threshold
|
|
uniform vec2 uf_fragCoordScale;
|
|
|
|
#endif
|
|
|
|
TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0; // frame
|
|
layout(location = 0) out vec4 passPixelColor0; // outputs to a texture used by c612390d4c70f430, 95a5a89d62998e0d and 49865bd2e62efda1
|
|
|
|
|
|
void main()
|
|
{
|
|
// get mask threshold data
|
|
float cutoff = intBitsToFloat(uf_remappedPS[0].x); // ~0.39: 0-1, higher = less glowing pixels
|
|
float contrast = intBitsToFloat(uf_remappedPS[0].y); // 4.5: higher = sharper edges
|
|
|
|
// get texture coordinate of this pixel
|
|
vec4 coord = GET_FRAGCOORD();
|
|
coord.x = coord.x * intBitsToFloat(0x3b088889); // align to scale/grid?
|
|
coord.y = coord.y * intBitsToFloat(0x3b72b9d6);
|
|
|
|
// get color of this pixel
|
|
vec3 color = texture(textureUnitPS0, vec2(coord.x, coord.y)).xyz;
|
|
|
|
// calculate luminance = percieved brightness
|
|
float luminance = dot(color, vec3(0.299, 0.587, 0.114)); // percieved approximation
|
|
|
|
// apply threshold, removes dark areas from the mask
|
|
luminance = contrast * (luminance - cutoff) * $bloom_strength; // apply custom strength
|
|
|
|
// apply to color and clamp
|
|
color.x = clamp(luminance * color.x, 0.0, 1.0);
|
|
color.y = clamp(luminance * color.y, 0.0, 1.0);
|
|
color.z = clamp(luminance * color.z, 0.0, 1.0);
|
|
|
|
// export
|
|
passPixelColor0 = vec4(color.x, color.y, color.z, 0.0);
|
|
}
|