Parameters
Name | Type | Description |
---|---|---|
position | vec3<f32> | 3D position to transform. |
cellSize | vec3<f32> | Size of each repetition cell. |
warpAmount | f32 | Amount of warping to apply. |
warpScale | f32 | Scale of the warping effect. |
seed | f32 | Random seed for warping. |
Returns
vec3<f32>repeated position.
Dependencies
WGSL Code
//! requires warpNoise3Dfn sdfDomainRepeat(position: vec3<f32>, cellSize: vec3<f32>, warpAmount: f32, warpScale: f32, seed: f32) -> vec3<f32> {// Calculate warping for positionlet warp = warpNoise3D(position * warpScale, seed) * warpAmount;// Apply warping to positionlet warpedPos = position + warp;// Calculate repetitionreturn warpedPos - cellSize * round(warpedPos / cellSize);}