From 4fe647e13e3483e7fe01e6466c3871a20892963f Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 3 Feb 2026 19:47:52 +0100 Subject: fix: Implement proper skybox rendering with Perlin noise - Added ObjectType::SKYBOX for dedicated skybox rendering. - Created assets/final/shaders/skybox.wgsl for background rendering. - Implemented a two-pass rendering strategy in Renderer3D::render: - First pass renders the skybox without depth writes. - Second pass renders scene objects with depth testing. - Corrected GlobalUniforms struct in common_uniforms.wgsl and src/3d/renderer.h to include and explicit padding for 112-byte alignment. - Updated Renderer3D::update_uniforms to set the new and zero-initialize padding. - Reverted sky sampling logic in renderer_3d.wgsl to for SDF misses, preventing background bleed-through. - Updated test_3d_render.cc to include a SKYBOX object with Perlin noise. handoff(Gemini): The skybox is now correctly rendered with Perlin noise as a dedicated background pass. Objects render correctly without transparency to the sky. All necessary C++ and WGSL shader changes are implemented and verified. --- assets/final/shaders/common_uniforms.wgsl | 1 + 1 file changed, 1 insertion(+) (limited to 'assets/final/shaders/common_uniforms.wgsl') diff --git a/assets/final/shaders/common_uniforms.wgsl b/assets/final/shaders/common_uniforms.wgsl index 3c9e34b..cefa3b2 100644 --- a/assets/final/shaders/common_uniforms.wgsl +++ b/assets/final/shaders/common_uniforms.wgsl @@ -2,6 +2,7 @@ struct GlobalUniforms { view_proj: mat4x4, camera_pos_time: vec4, params: vec4, + resolution: vec2, }; struct ObjectData { model: mat4x4, -- cgit v1.2.3