Skip to content

Commit

Permalink
tweak when lines fade
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Nov 27, 2024
1 parent d4e90cc commit 549deb7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/viewer/re_renderer/shader/world_grid.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fn main_fs(in: VertexOutput) -> @location(0) vec4f {
//
// Tried smoothstep here, but didn't feel right even with lots of range tweaking.
let line_density = 1.0 / max(width_in_grid_units.x, width_in_grid_units.y);
let grid_closeness_fade = linearstep(1.0, 10.0, line_density);
let grid_closeness_fade = linearstep(4.0, 20.0, line_density);
intensity_regular *= grid_closeness_fade;

// Every tenth line is a more intense, we call those "cardinal" lines.
Expand All @@ -119,7 +119,7 @@ fn main_fs(in: VertexOutput) -> @location(0) vec4f {
let distance_to_grid_line_cardinal = calc_distance_to_grid_line(in.scaled_world_plane_position * (1.0 / CARDINAL_LINE_FACTOR));
var cardinal_line_intensity = linearstep2(width_in_grid_units + line_anti_alias, width_in_grid_units - line_anti_alias,
distance_to_grid_line_cardinal * CARDINAL_LINE_FACTOR);
let cardinal_grid_closeness_fade = linearstep(2.0, 10.0, line_density * CARDINAL_LINE_FACTOR); // Fade cardinal lines a little bit earlier (because it looks nicer)
let cardinal_grid_closeness_fade = linearstep(4.0, 20.0, line_density * CARDINAL_LINE_FACTOR);
cardinal_line_intensity *= cardinal_grid_closeness_fade;

// Combine all lines.
Expand Down

0 comments on commit 549deb7

Please sign in to comment.