@@ -11,7 +11,6 @@ import {
1111} from 'three/addons/controls/TransformControls.js' ;
1212import { color , uniform } from 'three/tsl' ;
1313import * as THREE from 'three/webgpu' ;
14- import tgpu from 'typegpu' ;
1514import * as d from 'typegpu/data' ;
1615import * as std from 'typegpu/std' ;
1716
@@ -151,7 +150,7 @@ const velocityBuffer = t3.instancedArray(count, d.vec3f);
151150
152151// typegpu accessors
153152
154- const comptimeRandom = tgpu [ '~unstable' ] . comptime ( ( ) => Math . random ( ) ) ;
153+ const seed = Math . random ( ) ;
155154
156155const velocityBufferAttributeTA = t3 . fromTSL (
157156 velocityBuffer . node . toAttribute ( ) ,
@@ -174,7 +173,7 @@ const sphericalToVec3 = (phi: number, theta: number) => {
174173const initCompute = t3 . toTSL ( ( ) => {
175174 'use gpu' ;
176175 const instanceIndex = t3 . instanceIndex . $ ;
177- randf . seed ( instanceIndex / count + comptimeRandom ( ) ) ;
176+ randf . seed ( instanceIndex / count + seed ) ;
178177
179178 const basePosition = randf . inUnitCube ( )
180179 . sub ( 0.5 )
@@ -194,7 +193,7 @@ reset();
194193
195194const getParticleMassMultiplier = ( ) => {
196195 'use gpu' ;
197- randf . seed ( t3 . instanceIndex . $ / count + comptimeRandom ( ) ) ;
196+ randf . seed ( t3 . instanceIndex . $ / count + seed ) ;
198197 // in the original example, the values are remapped to [-1/3, 1] instead of [1/4, 1]
199198 const base = 0.25 + randf . sample ( ) * 3 / 4 ;
200199 return base ;
0 commit comments