Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect function calls to hsv_to_rgb in render debug code. #14260

Merged
merged 4 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 4 additions & 2 deletions crates/bevy_pbr/src/render/clustered_forward.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ fn cluster_debug_visualization(
if (z_slice & 1u) == 1u {
z_slice = z_slice + bindings::lights.cluster_dimensions.z / 2u;
}
let slice_color = hsv_to_rgb(
let slice_color_hsv = vec3<f32>(
Soulghost marked this conversation as resolved.
Show resolved Hide resolved
f32(z_slice) / f32(bindings::lights.cluster_dimensions.z + 1u) * PI_2,
1.0,
0.5
);
let slice_color = hsv_to_rgb(slice_color_hsv);
output_color = vec4<f32>(
(1.0 - cluster_overlay_alpha) * output_color.rgb + cluster_overlay_alpha * slice_color,
output_color.a
Expand All @@ -115,7 +116,8 @@ fn cluster_debug_visualization(
// NOTE: Visualizes the cluster to which the fragment belongs
let cluster_overlay_alpha = 0.1;
var rng = cluster_index;
let cluster_color = hsv_to_rgb(rand_f(&rng) * PI_2, 1.0, 0.5);
let cluster_color_hsv = vec3<f32>(rand_f(&rng) * PI_2, 1.0, 0.5);
Soulghost marked this conversation as resolved.
Show resolved Hide resolved
let cluster_color = hsv_to_rgb(cluster_color_hsv);
output_color = vec4<f32>(
(1.0 - cluster_overlay_alpha) * output_color.rgb + cluster_overlay_alpha * cluster_color,
output_color.a
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_pbr/src/render/shadows.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ fn cascade_debug_visualization(
) -> vec3<f32> {
let overlay_alpha = 0.95;
let cascade_index = get_cascade_index(light_id, view_z);
let cascade_color = hsv_to_rgb(
let cascade_color_hsv = vec3<f32>(
Soulghost marked this conversation as resolved.
Show resolved Hide resolved
f32(cascade_index) / f32(#{MAX_CASCADES_PER_LIGHT}u + 1u) * PI_2,
1.0,
0.5
);
let cascade_color = hsv_to_rgb(cascade_color_hsv);
return vec3<f32>(
(1.0 - overlay_alpha) * output_color.rgb + overlay_alpha * cascade_color
);
Expand Down