diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2021-03-10 21:59:56 +0100 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2021-03-10 22:00:45 +0100 |
| commit | 214c32a5475ec302b0caa837ea4d241ece263174 (patch) | |
| tree | 9dee7eadaf833bd97d5a31448110bb74e940b98c /shaders/compute.comp | |
| parent | f32b8f50f5d826c9bb8c6cd78a9f69ffe787fa69 (diff) | |
Fix TAA to have infinite accumulation
Diffstat (limited to 'shaders/compute.comp')
| -rw-r--r-- | shaders/compute.comp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/shaders/compute.comp b/shaders/compute.comp index 411c520..a47b9ce 100644 --- a/shaders/compute.comp +++ b/shaders/compute.comp @@ -218,16 +218,18 @@ void main() { vec2 uv = vec2(float(x) / (width - 1), 1.0 - (float(y) / (height - 1))); + sample_index %= 1000; + vec2 jittered_uvs = uv + vec2(random_disk[sample_index].x / (width - 1), random_disk[sample_index].y / (height - 1)); vec2 lens_disk = random_disk[sample_index] * cam.lens_radius; vec3 offset = lens_disk.x * cam.right.xyz + lens_disk.y * cam.up.xyz; vec4 proj_plane_pos = cam.first_pixel + jittered_uvs.x * cam.horizontal + jittered_uvs.y * cam.vertical; - ray r = ray(cam.position.xyz + offset, proj_plane_pos.xyz - cam.position.xyz - offset); + ray r = ray(cam.position.xyz, proj_plane_pos.xyz - cam.position.xyz); vec4 out_color = ray_color(r, sample_index); float spp_scale = (1.0 / samples_per_pixel); vec4 acc_color = imageLoad(accumulation_image, ivec2(x, y)); - imageStore(output_image, ivec2(x, y), acc_color + out_color * spp_scale); + imageStore(output_image, ivec2(x, y), mix(acc_color, out_color, spp_scale)); } |
