diff options
author | reduz <reduzio@gmail.com> | 2020-12-04 15:26:24 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2020-12-04 18:39:46 -0300 |
commit | 2787ad65be12a8ac84b7cc8536749686e9fe80dc (patch) | |
tree | 2f2cfbc02bddd77ba217797a5206767881184913 /servers/rendering/renderer_rd/shaders/specular_merge.glsl | |
parent | 3dc8aaaccc642cddbd8d5c1841fef079db5c7edf (diff) |
RenderingServer reorganization
Diffstat (limited to 'servers/rendering/renderer_rd/shaders/specular_merge.glsl')
-rw-r--r-- | servers/rendering/renderer_rd/shaders/specular_merge.glsl | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/shaders/specular_merge.glsl b/servers/rendering/renderer_rd/shaders/specular_merge.glsl new file mode 100644 index 0000000000..0b8f406213 --- /dev/null +++ b/servers/rendering/renderer_rd/shaders/specular_merge.glsl @@ -0,0 +1,53 @@ +#[vertex] + +#version 450 + +VERSION_DEFINES + +layout(location = 0) out vec2 uv_interp; + +void main() { + vec2 base_arr[4] = vec2[](vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0)); + uv_interp = base_arr[gl_VertexIndex]; + + gl_Position = vec4(uv_interp * 2.0 - 1.0, 0.0, 1.0); +} + +#[fragment] + +#version 450 + +VERSION_DEFINES + +layout(location = 0) in vec2 uv_interp; + +layout(set = 0, binding = 0) uniform sampler2D specular; + +#ifdef MODE_SSR + +layout(set = 1, binding = 0) uniform sampler2D ssr; + +#endif + +#ifdef MODE_MERGE + +layout(set = 2, binding = 0) uniform sampler2D diffuse; + +#endif + +layout(location = 0) out vec4 frag_color; + +void main() { + frag_color.rgb = texture(specular, uv_interp).rgb; + frag_color.a = 0.0; +#ifdef MODE_SSR + + vec4 ssr_color = texture(ssr, uv_interp); + frag_color.rgb = mix(frag_color.rgb, ssr_color.rgb, ssr_color.a); +#endif + +#ifdef MODE_MERGE + frag_color += texture(diffuse, uv_interp); +#endif + //added using additive blend +} |