mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-24 21:19:13 +01:00
Vulkan: parity with GL (P1–P7), shared GPU culling records (N6c), threaded command recording and render thread (M1, M4)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#version 460 core
|
||||
#define STAGE_FRAGMENT 1
|
||||
#define LAYOUT_POST 1
|
||||
#include "common.glsl"
|
||||
// applies the ambient occlusion of the half size target to the image at full size, as a multiplier: drawn with the
|
||||
// blending dst * src over the image (opengl46_ao::apply). the four nearest pixels of the occlusion are weighed by how
|
||||
@@ -8,22 +7,21 @@
|
||||
// edges of objects. each pixel of the occlusion stands for the top left one of the four full size pixels it covers
|
||||
// params.x: 0 ground truth ambient occlusion, 1 the older ssao (its own fixed curve)
|
||||
// params.y: strength, a power of the occlusion (1 = as computed); params.z: albedo assumed by the multiple bounce term.
|
||||
// the fog in front of a surface hides its occlusion as it hides the surface: the analytic fog of apply_fog.glsl, the fog
|
||||
// volume comes with the stage P2.
|
||||
// the parameters are in the push constants (loose uniforms in the opengl renderer): pc.data[0..3] the columns of the inverse
|
||||
// of the projection (inv_projection), pc.data[4] params, pc.data[5].x the density of the fog of the scene (fog_density of the
|
||||
// regular draws, 0: no fog), pc.data[5].yzw unused
|
||||
// the fog in front of a surface hides its occlusion as it hides the surface (fog_volume.glsl): drawn in the layout of the passes of
|
||||
// the scene, with the pass set of the colour pass and the block of its weather. the parameters are in the push constants (loose
|
||||
// uniforms in the opengl renderer): pc.data[0..3] the columns of the inverse of the projection, pc.data[4] params
|
||||
|
||||
layout(location = 14) in vec2 f_coords;
|
||||
|
||||
#include "fog_volume.glsl"
|
||||
layout(location = 0) out vec4 out_color;
|
||||
|
||||
layout(set = POST_SET, binding = POST_TEXTURE_FIRST + 0) uniform sampler2D depth_tex;
|
||||
layout(set = POST_SET, binding = POST_TEXTURE_FIRST + 1) uniform sampler2D ao_tex;
|
||||
// the textures of the draw
|
||||
layout(set = MATERIAL_SET, binding = MATERIAL_TEXTURE_FIRST + 0) uniform sampler2D depth_tex;
|
||||
layout(set = MATERIAL_SET, binding = MATERIAL_TEXTURE_FIRST + 1) uniform sampler2D ao_tex;
|
||||
|
||||
#define inv_projection mat4(pc.data[0], pc.data[1], pc.data[2], pc.data[3])
|
||||
#define params pc.data[4]
|
||||
#define scene_fog_density pc.data[5].x
|
||||
|
||||
vec3 view_position(ivec2 pixel, float depth)
|
||||
{
|
||||
@@ -93,7 +91,6 @@ void main()
|
||||
ao = multi_bounce(ao, params.z);
|
||||
}
|
||||
// what the fog lets through of the surface is what is left to occlude
|
||||
float transmittance = (scene_fog_density > 0.0) ? clamp(exp(-distance * scene_fog_density), 0.0, 1.0) : 1.0;
|
||||
ao = mix(1.0, ao, transmittance);
|
||||
ao = mix(1.0, ao, fog_along_view(view_position(pixel, depth), gl_FragCoord.xy).a);
|
||||
out_color = vec4(vec3(ao), 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user