Skip to content

Commit 5efdd4f

Browse files
committed
update overlays
1 parent ee3a03f commit 5efdd4f

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/shaders/editor_functions.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ R"(
2929
// Clip Grid at Boundary
3030
float __b_line = __hmap - __line - fwidth(__box_d);
3131
__grid_mask *= step(abs(__p.x), __b_line) * step(abs(__p.y), __b_line);
32-
vec3 __grid_color = mix(vec3(1.0, 0.1, 0.1), vec3(1.0), float(clamp(get_index_coord(__pixel_pos.xz - 0.5).z + 1, 0, 1)));
32+
vec3 __grid_color = mix(vec3(0.15, 0.01, 0.01), vec3(1.0), float(clamp(get_index_coord(__pixel_pos.xz - 0.5).z + 1, 0, 1)));
3333
ALBEDO = mix(ALBEDO, __grid_mask * __grid_color + __box_mask * vec3(0.0, 0.0, 1.0), max(__grid_mask, __box_mask));
3434
}
3535

src/shaders/overlays.glsl

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@
55

66
R"(
77
//INSERT: OVERLAY_INSTANCER_GRID
8-
// Show region grid
8+
// Show instancer grid
99
{
10-
vec3 __pixel_pos = (INV_VIEW_MATRIX * vec4(VERTEX,1.0)).xyz;
11-
vec3 __camera_pos = INV_VIEW_MATRIX[3].xyz;
12-
float __cell_line = 0.5; // Cell line thickness
13-
__cell_line *= .1*sqrt(length(__camera_pos - __pixel_pos));
14-
#define CELL_SIZE 32
15-
if (mod(__pixel_pos.x * _vertex_density + __cell_line*.5, CELL_SIZE) <= __cell_line ||
16-
mod(__pixel_pos.z * _vertex_density + __cell_line*.5, CELL_SIZE) <= __cell_line ) {
17-
ALBEDO = vec3(.033);
18-
}
10+
vec3 __pixel_pos = (INV_VIEW_MATRIX * vec4(VERTEX, 1.0)).xyz * _vertex_density;
11+
float __line = 0.025 * sqrt(-VERTEX.z);
12+
vec2 __p = __pixel_pos.xz;
13+
// Instancer Grid
14+
#define CELL_SIZE 32.0
15+
vec2 __g = abs(fract((__p + CELL_SIZE * 0.5) / CELL_SIZE) - 0.5) * CELL_SIZE;
16+
float __grid_d = min(__g.x, __g.y);
17+
float __grid_mask = 1.0 - smoothstep(__line - fwidth(__grid_d), __line + fwidth(__grid_d), __grid_d);
18+
// Clip Grid outside regions
19+
__grid_mask *= float(clamp(get_index_coord(__pixel_pos.xz - 0.5).z + 1, 0, 1));
20+
vec3 __grid_color = vec3(0.01);
21+
ALBEDO = mix(ALBEDO, __grid_mask * __grid_color, __grid_mask);
1922
}
2023

2124
//INSERT: OVERLAY_VERTEX_GRID

0 commit comments

Comments
 (0)