ProceduralTexture setTexture itself

Does anyone know how to send the contents of a texture to itself? Something like this:

const imageTexture = new ProceduralTexture('image', 512, 'image', scene, null, false, false);
imageTexture.setTexture('sameTexture', imageTexture);

(it fails with “Feedback loop formed between Framebuffer and active Texture.”)

May be there is a solution with RenderTargetTexture ? But I don’t know how to do it right :frowning:

You can’t because of the feedback loop :smiley:
you have to use an intermediate texture to store it (The good idea is to use a PassPostProcess to duplicate it on the GPU)

1 Like

seems like I did it, but do not think it’s in an optimal way :cold_sweat:

https://playground.babylonjs.com/#3PN6DH

any suggestions how to improve it? BTW did not figured out how to use PassPostProcess :weary:

1 Like

Hm but why not use customMaterial and use method addUniform(‘diffuseTexture’, ‘sampler2D’), or perhaps use shaderMaterial…proceduraltexture has been there for a while not sure if it’s still being maintained
:slightly_smiling_face:
Cheers!