Its possible to rtt with post processing/shaders?

If im not mistaken, rtt happens in the render loop and the shaders (post processing) after the render loop is finished. so technically it seems its “impossible” to rtt after we applied shader efffects or post processing.

Is there any trick/workaround to get rtt with shader/post processing effects?

Actually no, post processing is part of the render loop. Any shader can be rendered into a render target instead to the screen. Technically, it’s just a different kind of framebuffer.

1 Like

If simple posteffect then can add it in material shader

1 Like

Some more context regarding this suggestion: Simple stuff like a grayscale effect can actually be inlined e.g. via onBeforeCompile(). However, this does not work when information from adjacent fragments are required e.g. for a blur effect. In this case, the application needs real post-processing.

However, regarding the question of the OP, this is a bit off-topic.

1 Like

thank you for the reply,
i found that in the EffectComposer settings, there is renderTarget1, and if i take the texture of it, i can see the shader changes also. thank you leading me to that.

now i have a little problem. it keeps updating in real time. i what to get static texture.
tried to copy the texture into variable to get static texture.but “renderTarget1.texture.clone()” doesnt work.

tried to play with copyFramebufferToTexture, that doesnt work also. im sure its simple stuff but… :slight_smile:

can you help me? this what im doing, i put ‘if’ condition in animate function, if i press a keyboard it enters into the ‘if’ condition to capture the texture into variable ‘temp’, and apply it to some material (called “mrt”):

if(flag){
    

    // renderer.setRenderTarget(renderTarget);
    // renderer.render(scene, camera);
    // renderer.setRenderTarget(null);


	//temp= renderTarget.texture.clone() // <--- doesnt work
	temp= renderTarget.texture
	mrt.map = temp

    flag = 0
}

Just for clarification. This does not work since it does not clone the underlying framebuffer. If you just want to use the render target’s data as a texture, there is not need for cloning/copying. It should be sufficient to assign the texture of the render target to a map property like you already do.

Do you think you can demonstrate the issue with a live example?

1 Like

i solved the problem by changing the composer itself with new one (while rendering) and the old coposer assigned to global variable so the texture will remain static there and i can use it for latter .

maybe its stupid doing so but well it works…

by the way if i wasnt clear,by static texture what i mean when i use OrbitControls to orbit around, and project the texture to a plane, the texture on the plane needs to be the same and not update in real time.

if i get into trouble with this approach i will share jsfiddle code ofcourse…

thanks :innocent:

1 Like