Skip to content

Commit 17a01b6

Browse files
committed
Update checker-board pattern
1 parent 50d96c3 commit 17a01b6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/typegpu-docs/src/content/examples/rendering/ray-marching/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const Shape = d.struct({
3131
});
3232

3333
const checkerBoard = tgpu.fn([d.vec2f], d.f32)((uv) => {
34-
const suv = std.floor(std.mul(20, uv));
35-
return suv.x + suv.y - 2 * std.floor((suv.x + suv.y) * 0.5);
34+
const fuv = std.floor(uv);
35+
return std.abs(fuv.x + fuv.y) % 2;
3636
});
3737

3838
const smoothShapeUnion = tgpu.fn([Shape, Shape, d.f32], Shape)((a, b, k) => {
@@ -103,7 +103,7 @@ const getSceneDist = tgpu.fn([d.vec3f], Shape)((p) => {
103103
color: std.mix(
104104
d.vec3f(1),
105105
d.vec3f(0.2),
106-
checkerBoard(std.mul(p.xz, 0.1)),
106+
checkerBoard(std.mul(p.xz, 2)),
107107
),
108108
});
109109

114 KB
Loading

0 commit comments

Comments
 (0)