Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
576603a
Vulkan Pipeline: HDR, Post-Processing, FXAA, and Bloom (Phase 2 & 3) …
MichaelFisher1997 Jan 24, 2026
4be4978
Phase 4: Optimization & Polish - GPU Profiling & Preset Tuning (#219)
MichaelFisher1997 Jan 24, 2026
5cf4f35
fix: final visual polish and LOD integration fixes for issue #201
MichaelFisher1997 Jan 25, 2026
a37196f
Visual Polish: Smooth LOD Transitions, AO Smoothing, and Grid-Free Te…
MichaelFisher1997 Jan 25, 2026
e240ab3
Merge main into dev and resolve conflicts by keeping dev's latest ren…
MichaelFisher1997 Jan 25, 2026
9984a16
Refactor: Relocate drawDebugShadowMap to Debug Overlay System (#227)
MichaelFisher1997 Jan 25, 2026
67100fb
Refactor: Relocate computeSSAO to SSAOSystem (#228)
MichaelFisher1997 Jan 25, 2026
b15c024
fix: harden Bloom/FXAA systems and clean up technical debt identified…
MichaelFisher1997 Jan 25, 2026
f4f6172
fix: address code review feedback for Bloom/FXAA systems and RHI tech…
MichaelFisher1997 Jan 25, 2026
0f27b96
fix: address all remaining code review feedback for memory safety and…
MichaelFisher1997 Jan 26, 2026
7cee2d8
fix(test): update mock RHI vtable to include missing fields for issue…
MichaelFisher1997 Jan 26, 2026
95a6509
fix: PBR lighting energy conservation (#230)
MichaelFisher1997 Jan 26, 2026
bdc295e
Merge main into dev and resolve PBR conflicts
MichaelFisher1997 Jan 26, 2026
8ad74ee
polish: remove HUD notification for energy conservation
MichaelFisher1997 Jan 26, 2026
66d6911
fix: resolve duplicate G key toggle causing shadow debug to fail
MichaelFisher1997 Jan 26, 2026
1bad10f
refactor: address PR review feedback for PBR lighting fixes
MichaelFisher1997 Jan 26, 2026
73a6c7a
refactor: address code review feedback for PBR lighting energy conser…
MichaelFisher1997 Jan 26, 2026
d27ea6f
refactor: apply SOLID principles and documentation refinements to ter…
MichaelFisher1997 Jan 26, 2026
bf4ff8e
refactor: address final code review feedback for PBR lighting fixes
MichaelFisher1997 Jan 26, 2026
96c54c6
refactor: finalize PBR energy conservation refinements
MichaelFisher1997 Jan 26, 2026
485fc4c
refactor: address final code review feedback for #230
MichaelFisher1997 Jan 26, 2026
ad690b6
fix: resolve shader compilation errors
MichaelFisher1997 Jan 26, 2026
f995bc2
fix: resolve missing getVolShadow function in terrain shader
MichaelFisher1997 Jan 26, 2026
2b57010
feat(graphics): implement industry-grade shadow system with Reverse-Z…
MichaelFisher1997 Jan 26, 2026
50811d8
fix(graphics): resolve shadow regression and stabilize CSM
MichaelFisher1997 Jan 26, 2026
77fad1e
fix(graphics): stabilize CSM snapping and correct shadow bounds check
MichaelFisher1997 Jan 27, 2026
68110e1
merge: resolve conflicts in terrain.frag and regenerate shaders
MichaelFisher1997 Jan 27, 2026
bef8f5d
Consolidated Keymap Improvements: Bug Fixes, Debouncing, and Human-Re…
MichaelFisher1997 Jan 27, 2026
589479b
fix(graphics): address critical review feedback for shadow system
MichaelFisher1997 Jan 27, 2026
13cf280
fix(graphics): finalize shadow system with review-addressed improvements
MichaelFisher1997 Jan 27, 2026
91794ff
Refactor Input system to use SOLID interfaces (Phase 3) (#242)
MichaelFisher1997 Jan 27, 2026
ad17347
fix(graphics): address all review feedback and finalize shadow system
MichaelFisher1997 Jan 27, 2026
75af4cf
fix(graphics): stop SSAO artifacts in LOD
MichaelFisher1997 Jan 28, 2026
32883f4
fix: cloud shadow blob artifacts
MichaelFisher1997 Jan 28, 2026
7fab600
fix(shadows): Fix shadow artifacts and add configurable shadow distan…
MichaelFisher1997 Jan 28, 2026
d232511
refactor(vulkan): PR1 - Add PipelineManager and RenderPassManager mod…
MichaelFisher1997 Jan 29, 2026
88d7d98
refactor(vulkan): PR2 - Migrate to Pipeline and Render Pass Managers …
MichaelFisher1997 Feb 6, 2026
8b277d2
refactor(vulkan): split monolithic RHI backend into focused modules (…
MichaelFisher1997 Feb 6, 2026
6e3c69a
refactor: separate LOD logic from GPU operations in lod_manager.zig (…
MichaelFisher1997 Feb 6, 2026
a7458db
refactor(worldgen): split overworld generator into focused subsystems…
MichaelFisher1997 Feb 6, 2026
af86a91
ci(workflows): migrate opencode from MiniMax to Kimi k2p5 and enhance…
MichaelFisher1997 Feb 6, 2026
f119da6
fix(workflows): prevent opencode temp files from triggering infinite …
MichaelFisher1997 Feb 7, 2026
58566a3
fix(workflows): remove file-based diff fetching, add timeout
MichaelFisher1997 Feb 7, 2026
8dda26c
refactor(worldgen): split biome.zig into focused sub-modules (#257)
MichaelFisher1997 Feb 7, 2026
7944d36
ci(workflows): enhance opencode review to check linked issues
MichaelFisher1997 Feb 7, 2026
d7fd4a4
refactor(world): extract chunk_mesh.zig meshing stages into independe…
MichaelFisher1997 Feb 7, 2026
3bba5f8
fix(shadows): resolve intermittent massive shadow artifact below play…
MichaelFisher1997 Feb 7, 2026
e221c38
feat(lighting): Complete Phases A & C of Modern Lighting Overhaul (#261)
MichaelFisher1997 Feb 7, 2026
8005ace
ci(workflows): add previous review tracking to opencode PR reviews
MichaelFisher1997 Feb 8, 2026
f96164a
fix(workflows): fix heredoc delimiter syntax in opencode workflow
MichaelFisher1997 Feb 8, 2026
a3325b3
feat(lighting): implement LPV compute GI and debug tooling (#262)
MichaelFisher1997 Feb 8, 2026
dc1ab06
feat(lighting): PCSS soft shadows, SH L1 LPV with occlusion, LUT colo…
MichaelFisher1997 Feb 8, 2026
65d51d5
Merge origin/main into dev
MichaelFisher1997 Feb 8, 2026
9170931
fix(lpv,lod): harden failure paths and runtime guards
MichaelFisher1997 Feb 8, 2026
8133d8d
chore(docs): remove obsolete PR2 investigation notes
MichaelFisher1997 Feb 8, 2026
79de356
Issue #229: staged migration from full-scene MSAA to TAA (#266)
MichaelFisher1997 Feb 9, 2026
086b3a7
Merge main into dev
MichaelFisher1997 Feb 9, 2026
caddfd1
fix(ci): add fallback Nix installer in build workflow
MichaelFisher1997 Feb 9, 2026
2685ec8
fix(taa): harden history allocation and shader wiring
MichaelFisher1997 Feb 9, 2026
f216723
fix(ci): make Nix cache restore non-blocking
MichaelFisher1997 Feb 9, 2026
450cc9f
fix(taa): tighten allocation and framebuffer error cleanup
MichaelFisher1997 Feb 10, 2026
28e6bff
fix(taa): unify history texture error cleanup path
MichaelFisher1997 Feb 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,23 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Nix
- name: Install Nix (primary)
id: nix_install_primary
continue-on-error: true
uses: DeterminateSystems/nix-installer-action@v16

- name: Install Nix (fallback)
if: steps.nix_install_primary.outcome == 'failure'
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes

- name: Verify Nix installation
run: nix --version

- name: Cache Nix Store
continue-on-error: true
uses: nix-community/cache-nix-action@v7
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock') }}
Expand Down Expand Up @@ -60,10 +73,23 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Nix
- name: Install Nix (primary)
id: nix_install_primary
continue-on-error: true
uses: DeterminateSystems/nix-installer-action@v16

- name: Install Nix (fallback)
if: steps.nix_install_primary.outcome == 'failure'
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes

- name: Verify Nix installation
run: nix --version

- name: Cache Nix Store
continue-on-error: true
uses: nix-community/cache-nix-action@v7
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock') }}
Expand All @@ -84,10 +110,23 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Nix
- name: Install Nix (primary)
id: nix_install_primary
continue-on-error: true
uses: DeterminateSystems/nix-installer-action@v16

- name: Install Nix (fallback)
if: steps.nix_install_primary.outcome == 'failure'
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes

- name: Verify Nix installation
run: nix --version

- name: Cache Nix Store
continue-on-error: true
uses: nix-community/cache-nix-action@v7
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/opencode-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
uses: DeterminateSystems/nix-installer-action@v16

- name: Cache Nix Store
continue-on-error: true
uses: nix-community/cache-nix-action@v7
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock') }}
Expand Down Expand Up @@ -191,4 +192,3 @@ jobs:
5. Confidence scores should reflect how certain you are - use "Low" when unsure
6. If you have nothing meaningful to add to a section, write "None identified" instead of omitting it
7. Always provide actionable fixes, never just complaints

1 change: 1 addition & 0 deletions .github/workflows/opencode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
uses: DeterminateSystems/nix-installer-action@v16

- name: Cache Nix Store
continue-on-error: true
uses: nix-community/cache-nix-action@v7
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock') }}
Expand Down
20 changes: 16 additions & 4 deletions assets/config/presets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"pbr_enabled": false,
"pbr_quality": 0,
"msaa_samples": 1,
"taa_enabled": false,
"taa_blend_factor": 0.85,
"taa_velocity_rejection": 0.03,
"anisotropic_filtering": 1,
"max_texture_resolution": 64,
"cloud_shadows_enabled": false,
Expand All @@ -32,7 +35,10 @@
"shadow_cascade_blend": false,
"pbr_enabled": true,
"pbr_quality": 1,
"msaa_samples": 2,
"msaa_samples": 1,
"taa_enabled": true,
"taa_blend_factor": 0.9,
"taa_velocity_rejection": 0.02,
"anisotropic_filtering": 4,
"max_texture_resolution": 128,
"cloud_shadows_enabled": true,
Expand All @@ -45,7 +51,7 @@
"ssao_enabled": true,
"lod_enabled": true,
"render_distance": 12,
"fxaa_enabled": true,
"fxaa_enabled": false,
"bloom_enabled": true,
"bloom_intensity": 0.5
},
Expand All @@ -57,7 +63,10 @@
"shadow_cascade_blend": true,
"pbr_enabled": true,
"pbr_quality": 2,
"msaa_samples": 4,
"msaa_samples": 1,
"taa_enabled": true,
"taa_blend_factor": 0.93,
"taa_velocity_rejection": 0.015,
"anisotropic_filtering": 8,
"max_texture_resolution": 256,
"cloud_shadows_enabled": true,
Expand All @@ -82,7 +91,10 @@
"shadow_cascade_blend": true,
"pbr_enabled": true,
"pbr_quality": 2,
"msaa_samples": 4,
"msaa_samples": 1,
"taa_enabled": true,
"taa_blend_factor": 0.95,
"taa_velocity_rejection": 0.01,
"anisotropic_filtering": 16,
"max_texture_resolution": 512,
"cloud_shadows_enabled": true,
Expand Down
50 changes: 50 additions & 0 deletions assets/shaders/vulkan/taa.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#version 450

layout(location = 0) in vec2 outUV;
layout(location = 0) out vec4 outColor;

layout(set = 0, binding = 0) uniform sampler2D uCurrentHdr;
layout(set = 0, binding = 1) uniform sampler2D uHistory;
layout(set = 0, binding = 2) uniform sampler2D uVelocity;

layout(push_constant) uniform TAAPush {
float blend_factor;
float velocity_rejection;
float reset_history;
float _pad;
} taa;

vec3 sampleCurrent(vec2 uv) {
return texture(uCurrentHdr, uv).rgb;
}

void main() {
vec2 velocity = texture(uVelocity, outUV).xy;
vec2 history_uv = outUV - velocity;

vec3 current = sampleCurrent(outUV);

if (taa.reset_history > 0.5 || any(lessThan(history_uv, vec2(0.0))) || any(greaterThan(history_uv, vec2(1.0)))) {
outColor = vec4(current, 1.0);
return;
}

vec3 history = texture(uHistory, history_uv).rgb;

vec2 texel = 1.0 / vec2(textureSize(uCurrentHdr, 0));
vec3 c1 = sampleCurrent(clamp(outUV + vec2(texel.x, 0.0), 0.0, 1.0));
vec3 c2 = sampleCurrent(clamp(outUV + vec2(-texel.x, 0.0), 0.0, 1.0));
vec3 c3 = sampleCurrent(clamp(outUV + vec2(0.0, texel.y), 0.0, 1.0));
vec3 c4 = sampleCurrent(clamp(outUV + vec2(0.0, -texel.y), 0.0, 1.0));

vec3 min_color = min(current, min(min(c1, c2), min(c3, c4)));
vec3 max_color = max(current, max(max(c1, c2), max(c3, c4)));
vec3 clamped_history = clamp(history, min_color, max_color);

float speed = length(velocity);
float stable = 1.0 - smoothstep(taa.velocity_rejection, taa.velocity_rejection * 4.0, speed);
float history_weight = taa.blend_factor * stable;
vec3 resolved = mix(current, clamped_history, history_weight);

outColor = vec4(resolved, 1.0);
}
8 changes: 8 additions & 0 deletions assets/shaders/vulkan/taa.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#version 450

layout(location = 0) out vec2 outUV;

void main() {
outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f);
}
4 changes: 4 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ pub fn build(b: *std.Build) void {
const validate_vulkan_ssao_frag = b.addSystemCommand(&.{ "glslangValidator", "-V", "assets/shaders/vulkan/ssao.frag" });
const validate_vulkan_ssao_blur_frag = b.addSystemCommand(&.{ "glslangValidator", "-V", "assets/shaders/vulkan/ssao_blur.frag" });
const validate_vulkan_g_pass_frag = b.addSystemCommand(&.{ "glslangValidator", "-V", "assets/shaders/vulkan/g_pass.frag" });
const validate_vulkan_taa_vert = b.addSystemCommand(&.{ "glslangValidator", "-V", "assets/shaders/vulkan/taa.vert" });
const validate_vulkan_taa_frag = b.addSystemCommand(&.{ "glslangValidator", "-V", "assets/shaders/vulkan/taa.frag" });
const validate_vulkan_lpv_inject_comp = b.addSystemCommand(&.{ "glslangValidator", "-V", "assets/shaders/vulkan/lpv_inject.comp" });
const validate_vulkan_lpv_propagate_comp = b.addSystemCommand(&.{ "glslangValidator", "-V", "assets/shaders/vulkan/lpv_propagate.comp" });

Expand All @@ -197,6 +199,8 @@ pub fn build(b: *std.Build) void {
test_step.dependOn(&validate_vulkan_ssao_frag.step);
test_step.dependOn(&validate_vulkan_ssao_blur_frag.step);
test_step.dependOn(&validate_vulkan_g_pass_frag.step);
test_step.dependOn(&validate_vulkan_taa_vert.step);
test_step.dependOn(&validate_vulkan_taa_frag.step);
test_step.dependOn(&validate_vulkan_lpv_inject_comp.step);
test_step.dependOn(&validate_vulkan_lpv_propagate_comp.step);
}
42 changes: 42 additions & 0 deletions src/engine/graphics/camera.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ const Key = @import("../core/interfaces.zig").Key;
const InputMapper = @import("../../game/input_mapper.zig").InputMapper;

pub const Camera = struct {
// 4-tap Halton(2,3) sequence centered to [-0.5, 0.5] pixel offsets.
// We keep this to 4 samples to keep temporal convergence fast while matching
// the current low-latency TAA target (minimal history lag and ghosting).
const JITTER_SEQUENCE = [_][2]f32{
.{ 0.0, -0.16666667 },
.{ -0.25, 0.16666667 },
.{ 0.25, -0.3888889 },
.{ -0.375, -0.055555556 },
};

position: Vec3,

/// Yaw in radians (rotation around Y axis)
Expand Down Expand Up @@ -36,6 +46,7 @@ pub const Camera = struct {
forward: Vec3,
right: Vec3,
up: Vec3,
jitter_index: usize,

pub const Config = struct {
position: Vec3 = Vec3.init(0, 0, 3),
Expand All @@ -61,11 +72,25 @@ pub const Camera = struct {
.forward = Vec3.zero,
.right = Vec3.zero,
.up = Vec3.zero,
.jitter_index = 0,
};
cam.updateVectors();
return cam;
}

pub fn resetJitter(self: *Camera) void {
self.jitter_index = 0;
}

pub fn advanceJitter(self: *Camera) void {
self.jitter_index = (self.jitter_index + 1) % JITTER_SEQUENCE.len;
}

fn currentJitterPixel(self: *const Camera, enabled: bool) [2]f32 {
if (!enabled) return .{ 0.0, 0.0 };
return JITTER_SEQUENCE[self.jitter_index];
}

/// Update camera from input (call once per frame)
pub fn update(self: *Camera, input: *const Input, mapper: *const InputMapper, delta_time: f32) void {
// Mouse look
Expand Down Expand Up @@ -126,6 +151,23 @@ pub const Camera = struct {
return Mat4.perspective(self.fov, aspect_ratio, self.near, self.far);
}

pub fn getProjectionMatrixReverseZ(self: *const Camera, aspect_ratio: f32) Mat4 {
return Mat4.perspectiveReverseZ(self.fov, aspect_ratio, self.near, self.far);
}

pub fn getJitteredProjectionMatrixReverseZ(self: *const Camera, aspect_ratio: f32, viewport_width: f32, viewport_height: f32, jitter_enabled: bool) Mat4 {
const base_projection = self.getProjectionMatrixReverseZ(aspect_ratio);
if (!jitter_enabled or viewport_width <= 0.0 or viewport_height <= 0.0) {
return base_projection;
}

const jitter = self.currentJitterPixel(jitter_enabled);
const jitter_x_ndc = (jitter[0] * 2.0) / viewport_width;
const jitter_y_ndc = (jitter[1] * 2.0) / viewport_height;
const jitter_matrix = Mat4.translate(Vec3.init(jitter_x_ndc, jitter_y_ndc, 0.0));
return jitter_matrix.multiply(base_projection);
}

/// Get view matrix centered at origin (for floating origin rendering)
/// Camera is conceptually at origin looking in the forward direction
pub fn getViewMatrixOriginCentered(self: *const Camera) Mat4 {
Expand Down
34 changes: 29 additions & 5 deletions src/engine/graphics/render_graph.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const World = @import("../../world/world.zig").World;
const shadow_scene = @import("shadow_scene.zig");
const RHI = @import("rhi.zig").RHI;
const rhi_pkg = @import("rhi.zig");
const Mat4 = @import("../math/mat4.zig").Mat4;
const Vec3 = @import("../math/vec3.zig").Vec3;
const log = @import("../core/log.zig");
const CSM = @import("csm.zig");
Expand All @@ -22,6 +21,9 @@ pub const SceneContext = struct {
aspect: f32,
sky_params: rhi_pkg.SkyParams,
cloud_params: rhi_pkg.CloudParams,
taa_enabled: bool,
viewport_width: f32,
viewport_height: f32,
main_shader: rhi_pkg.ShaderHandle,
env_map_handle: rhi_pkg.TextureHandle,
shadow: rhi_pkg.ShadowConfig,
Expand Down Expand Up @@ -212,7 +214,7 @@ pub const GPass = struct {
ctx.rhi.beginGPass();
const atlas = ctx.material_system.getAtlasHandles(ctx.env_map_handle);
ctx.rhi.bindTexture(atlas.diffuse, 1);
const view_proj = Mat4.perspectiveReverseZ(ctx.camera.fov, ctx.aspect, ctx.camera.near, ctx.camera.far).multiply(ctx.camera.getViewMatrixOriginCentered());
const view_proj = ctx.camera.getJitteredProjectionMatrixReverseZ(ctx.aspect, ctx.viewport_width, ctx.viewport_height, ctx.taa_enabled).multiply(ctx.camera.getViewMatrixOriginCentered());
ctx.world.render(view_proj, ctx.camera.position, false);
ctx.rhi.endGPass();
}
Expand All @@ -234,7 +236,7 @@ pub const SSAOPass = struct {
fn execute(ptr: *anyopaque, ctx: SceneContext) anyerror!void {
_ = ptr;
if (!ctx.ssao_enabled or ctx.disable_ssao) return;
const proj = Mat4.perspectiveReverseZ(ctx.camera.fov, ctx.aspect, ctx.camera.near, ctx.camera.far);
const proj = ctx.camera.getJitteredProjectionMatrixReverseZ(ctx.aspect, ctx.viewport_width, ctx.viewport_height, ctx.taa_enabled);
const inv_proj = proj.inverse();
ctx.rhi.ssao().compute(proj, inv_proj);
}
Expand Down Expand Up @@ -288,7 +290,7 @@ pub const OpaquePass = struct {
rhi.bindTexture(ctx.lpv_texture_handle, 11);
rhi.bindTexture(ctx.lpv_texture_handle_g, 12);
rhi.bindTexture(ctx.lpv_texture_handle_b, 13);
const view_proj = Mat4.perspectiveReverseZ(ctx.camera.fov, ctx.aspect, ctx.camera.near, ctx.camera.far).multiply(ctx.camera.getViewMatrixOriginCentered());
const view_proj = ctx.camera.getJitteredProjectionMatrixReverseZ(ctx.aspect, ctx.viewport_width, ctx.viewport_height, ctx.taa_enabled).multiply(ctx.camera.getViewMatrixOriginCentered());
ctx.world.render(view_proj, ctx.camera.position, true);
}
};
Expand All @@ -309,7 +311,7 @@ pub const CloudPass = struct {
fn execute(ptr: *anyopaque, ctx: SceneContext) anyerror!void {
_ = ptr;
if (ctx.disable_clouds) return;
const view_proj = Mat4.perspectiveReverseZ(ctx.camera.fov, ctx.aspect, ctx.camera.near, ctx.camera.far).multiply(ctx.camera.getViewMatrixOriginCentered());
const view_proj = ctx.camera.getJitteredProjectionMatrixReverseZ(ctx.aspect, ctx.viewport_width, ctx.viewport_height, ctx.taa_enabled).multiply(ctx.camera.getViewMatrixOriginCentered());
ctx.atmosphere_system.renderClouds(ctx.cloud_params, view_proj) catch |err| {
if (err != error.ResourceNotReady and
err != error.CloudPipelineNotReady and
Expand Down Expand Up @@ -386,6 +388,28 @@ pub const BloomPass = struct {
}
};

// TAA pass - reserved temporal AA stage between scene rendering and bloom/post.
pub const TAAPass = struct {
enabled: bool = true,
const VTABLE = IRenderPass.VTable{
.name = "TAAPass",
.needs_main_pass = false,
.execute = execute,
};
pub fn pass(self: *TAAPass) IRenderPass {
return .{
.ptr = self,
.vtable = &VTABLE,
};
}

fn execute(ptr: *anyopaque, ctx: SceneContext) anyerror!void {
const self: *TAAPass = @ptrCast(@alignCast(ptr));
if (!self.enabled or !ctx.taa_enabled) return;
ctx.rhi.computeTAA();
}
};

// FXAA pass - applies anti-aliasing to LDR output
pub const FXAAPass = struct {
enabled: bool = true,
Expand Down
Loading
Loading