mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 21:21:14 +00:00
This puts pixels that have not been rendered at infinity. I was rather surprised to see fog in my test scene, but it depended on my position relative to the origin, so something was definitely off (the pixels were at the origin).
35 lines
1.1 KiB
GLSL
35 lines
1.1 KiB
GLSL
#version 450
|
|
#extension GL_GOOGLE_include_directive : enable
|
|
#extension GL_EXT_multiview : enable
|
|
|
|
#define OIT_SET 1
|
|
#include "oit_blend.finc"
|
|
|
|
#include "fog.finc"
|
|
|
|
layout (push_constant) uniform PushConstants {
|
|
vec4 fog;
|
|
vec4 camera;
|
|
};
|
|
|
|
layout (input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput color;
|
|
layout (input_attachment_index = 1, set = 0, binding = 1) uniform subpassInput light;
|
|
layout (input_attachment_index = 2, set = 0, binding = 2) uniform subpassInput emission;
|
|
layout (input_attachment_index = 3, set = 0, binding = 3) uniform subpassInput position;
|
|
|
|
layout (location = 0) out vec4 frag_color;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
vec3 c = subpassLoad (color).rgb;
|
|
vec3 l = subpassLoad (light).rgb;
|
|
vec3 e = subpassLoad (emission).rgb;
|
|
vec4 p = subpassLoad (position);
|
|
vec3 o = max(BlendFrags (vec4 (c * l + e, 1)).xyz, vec3(0));
|
|
|
|
float d = p.w > 0 ? length (p.xyz - camera.xyz) : 1e36;
|
|
o = FogBlend (vec4(o,1), fog, d).xyz;
|
|
o = pow (o, vec3(0.83));//FIXME make gamma correction configurable
|
|
frag_color = vec4 (o, 1);
|
|
}
|