Hi,
I’m trying to implement Tessendorfs FFT water simulation.
So I need to render at least 3 procedural textures:
- waves spectrum
- waves spectrum time
- heightmap (+normal map, …)
The second texture is dependant on the first, and the third texture is dependant on the second.
I am using CustomProceduralTextures.
How can I manually control the order the textures are rendered?
I tried setting the refreshrate to -1 and calling ‘render’ on each of the textures in ‘onRender’.
But then I get the following error:
proceduralTexture.ts:618
Uncaught TypeError: Cannot read properties of null (reading ‘setFloat’) at CustomProceduralTexture.render
code sample:
onSceneReady
this.philipsSpectrumTexture = new CustomProceduralTexture(“philipsSpectrumTexture”, process.env.PUBLIC_URL + “/proceduralTextures/philipsSpectrum”, 256, scene);
this.fourierAmplitubesTexture = new CustomProceduralTexture(“fourierAmplitubesTexture”, process.env.PUBLIC_URL + “/proceduralTextures/fourierAmplitubes”, 256, scene);
this.heightmapTexture = new CustomProceduralTexture(“heightmapTexture”, process.env.PUBLIC_URL + “/proceduralTextures/heightmap”, 256, scene);
onRender:
this.philipsSpectrumTexture.render();
this.fourierAmplitubesTexture.setTexture(“philipsSpectrumTexture”, this.philipsSpectrumTexture);
this.fourierAmplitubesTexture.setFloat(“t”, time.t * 0.001);
this.fourierAmplitubesTexture.render();
this.heightmapTexture.setTexture(“fourierAmplitubesTexture”, this.fourierAmplitubesTexture);
this.heightmapTexture.render();