Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion crates/renderide/shaders/modules/skybox/common.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn view_is_orthographic(sky: SkyboxView, view_layer: u32) -> bool {
/// Reconstructs a view-space sky ray from NDC and packed projection coefficients.
fn view_ray_from_ndc(ndc: vec2<f32>, proj_params: vec4<f32>, orthographic: bool) -> vec3<f32> {
if (orthographic) {
return vec3<f32>(0.0, 0.0, -1.0);
return vec3<f32>(ndc.xy, -1.0);
}
// Asymmetric OpenXR projections store skew on the Z column. With sky rays fixed at z = -1
// and clip_w = -view_z, inverse projection uses ndc + skew.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ fn clip_pos_from_view_ray(
orthographic: bool,
) -> vec4<f32> {
if (view_ray.z >= -1e-6) {
// Send point behind near plane
return vec4<f32>(view_ray.xy, 2.0, 1.0);
}
let camera_ray = view_ray.xy / (-view_ray.z);
if (orthographic) {
return vec4<f32>(sign(view_ray.xy * proj_params.xy), 0.0, 1.0);
return vec4<f32>(camera_ray * sign(proj_params.xy), 0.0, 1.0);

@Baplar Baplar Jun 4, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a discrepancy with Unity in the way all skyboxes got rendered in ortho cameras, this change seems to bring it up to parity, along with the change in the common module

}
return vec4<f32>(view_ray.xy * proj_params.xy / (-view_ray.z) - proj_params.zw, 0.0, 1.0);
return vec4<f32>(camera_ray * proj_params.xy - proj_params.zw, 0.0, 1.0);
}

fn view_ray_from_world_ray(world_ray: vec3<f32>, view_layer: u32) -> vec3<f32> {
Expand Down
Loading