2layout(std140, binding = 0) uniform CameraData {
6 mat4 unjittered_projection;
9 mat4 unjittered_inv_projection;
35layout(std140, binding = 1) uniform RenderingData {
43 vec3 scale =
vec3((lutSize - 1.0) / lutSize);
44 vec3 offset =
vec3(1.0 / (2.0 * lutSize));
48 return texture(
uLUT, lutUVW).rgb;
53 float lum = dot(avgColor,
vec3(0.2126, 0.7152, 0.0722));
55 lum = max(lum, 0.0001f);
57 float middleGray = 0.18f;
58 float acesBoost = 0.01f;
63 float targetExposure = (middleGray / lum);
65 return clamp(targetExposure, minExp, maxExp);
74 return clamp((x*(a*x+b))/(x*(c*x+d)+e), 0.0, 1.0);
79 float nvdist = length(nvuv);
89 0.613097, 0.070194, 0.020585,
90 0.339523, 0.916394, 0.109572,
91 0.047379, 0.013412, 0.869843
96 1.704859, -0.130258, -0.024003,
97 -0.621714, 1.140733, -0.128963,
98 -0.083145, -0.010475, 1.152966
105 vec3 log_low = 10.5402377416545 * ap1 + 0.0729055341958355;
106 vec3 log_high = (log2(max(ap1,
vec3(1e-6))) + 9.72) / 17.52;
108 vec3 use_low =
vec3(lessThanEqual(ap1,
vec3(0.0078125)));
110 return mix(log_high, log_low, step(ap1,
vec3(0.0078125)));
116 vec3 linear_t = (graded - 0.0729055341958355) / 10.5402377416545;
117 vec3 log_curve= exp2(graded * 17.52 - 9.72);
119 vec3 use_low =
vec3(lessThanEqual(graded,
vec3(0.155228)));
120 vec3 ap1 = mix(log_curve, linear_t, step(graded,
vec3(0.155251141552511)));
135 return (10.5402377416545 * x + 0.0729055341958355);
139 return ((log2(x) + 9.72) / 17.52);
146 return (x - 0.072905534195) / 10.5402377416;
150 return pow(2.0, x * 17.52 - 9.72);
200#define MAX_MESH_NODES 1024
201layout(std430, binding = 15) buffer MeshNodeData {
203 float focal_distance;
212 vec4 ndc =
vec4(
uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
214 vec4 viewSpacePos = invProjMatrix * ndc;
216 return viewSpacePos.xyz / viewSpacePos.
w;
228 float s = texture(
uDPP,
uv).r;
260 vec2 currentTexCoords =
uv - (velocity * 0.7);
262 for (
int i = 1; i <
samples; ++i) {
263 currentTexCoords += texelStep;
264 sc += textureLod(
uSSR, currentTexCoords, 0);
272 float rawDepth = texture(
uDPP,
uv).r;
275 float pixelDist = -viewPos.
z;
278 float cocMeters = coeff * ((pixelDist - focal_distance) / pixelDist);
286 blendFactor =
smoothstep(0.05, 0.9, blendFactor);
290 sc.rgb = mix(sc.rgb, bokeh.rgb, blendFactor);
296 color.rgb = mix(sc.rgb, text.rgb, text.a);
302 vec3 halationColor =
vec3(halationSample.r * 1.5, halationSample.g * 0.2, 0.0);
304 color.rgb += bloom.rgb * 0.3f;
306 vec2 st = gl_FragCoord.xy / resolution.xy;
310 float noise = fract(sin(dot(st.xy +
vec2(
uTime * 0.001, 0),
vec2(12.9898, 78.233))) * 43758.5453123);
319 int lastLOD = textureQueryLevels(
uScene) - 1;
334 aces.rgb = pow(aces,
vec3(1.0/gamma));
layout(local_size_x=16, local_size_y=16) in
uniform float uFocalLength
vec3 get_view_pos_from_depth(vec2 uv, float depth, mat4 invProjMatrix)
uniform float uSensorHeight
#define MAX_MESH_NODES
Maximum MeshNodes in a scene (used for SSBO sizing).
bool static_mesh
If this mesh is static (DrawArrays) or dynamic (DrawElements), used to indicate Lightmap status.
size_t count
Count of vertices pushed into the MAIN_VBO.
MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to ...
float smoothstep(float a, float b, float c)
float clamp(float a, float b, float c)
uniform float uRenderFramerate
uniform sampler3D uColorLUT
uniform sampler2D uHistory
vec3 acescct_to_linear(vec3 graded)
uniform sampler2D uCurrentSSR
vec3 vignette(vec3 color, float u, float v)
float linear_to_acescct_channel(float x)
vec3 processLUT(vec3 color)
uniform float uDOFMaxBlurRadius
vec3 linear_to_acescct(vec3 linearRGB)
uniform float uPhysicsFramerate
float calculateExposure(vec3 avgColor)
uniform uint uWireframeToggled
float acescct_to_linear_channel(float x)
vec3 applyLUT(vec3 color)