Our current default pseudo-random number generator is BPETER, which internally uses a 2d seed state. Whenever we want to seed it with a 3d value, we need to flatten it somehow. Our current approach is value.xy + value.z as seen in the provided snippet from packages/typegpu-noise/src/generator.ts:
seed3: tgpu.fn([d.vec3f])((value) => {
'use gpu';
seed.$ = value.xy + d.vec2f(value.z);
}),
This results in continuously shifting the domain along the Z axis on a diagonal. This was being observer when generating 3d terrain using the 3d perlin noise utility.
To mitigate this problem, I think we should first create a uniformity test example (as suggested by @aleksanderkatan during lunch 🍕), and try to double-hash.
Our current default pseudo-random number generator is
BPETER, which internally uses a 2d seed state. Whenever we want to seed it with a 3d value, we need to flatten it somehow. Our current approach isvalue.xy + value.zas seen in the provided snippet frompackages/typegpu-noise/src/generator.ts:This results in continuously shifting the domain along the Z axis on a diagonal. This was being observer when generating 3d terrain using the 3d perlin noise utility.
To mitigate this problem, I think we should first create a uniformity test example (as suggested by @aleksanderkatan during lunch 🍕), and try to double-hash.