Issue when PrePassRenderer and RenderTargetTexture are used at the same time

Hello,

I’m new here and I don’t really know if my problem is due to a bug or a misunderstanding on my part.

I’m trying to create a new PostProcess using both renderTargetTexture and PrePassRenderer. However, when I use both of them, my renderTargetTexture display the base texture of the scene instead of the the ShaderMaterial result (as if the RendertargetTexture was replaced by something else…)

I didn’t manage to exactly reproduce the problem since I didn’t find how to set the configuration of the PrePassRenderer in a Playground. So, for the example, I applied the SSR postProcess to implicitly set it up instead.

So, here is the playground : https://playground.babylonjs.com/#CHNWS7#17

I’m displaying :

  • only base texture (left)

  • the metallic map (“metallic to texture”) I compute thanks to a RenderTargetTexture (center)

  • the normals I get thanks to GeometryBufferRenderer or PrePassRenderer (right)

When I use the GeometryBufferRenderer it works. But when I use the PrePassRenderer (choose prePass = true, line 282), it doesn’t work: the “metallic to texture” in the inspector is not blue as expected but shows the base color instead.

Notice that when I use the GeometryBufferRenderer and apply the SSR PostProcess the result is the same as using PrePassRenderer.

Is there a known issue about an incompatibility between RenderTargetTexture and PrePassRenderer ?

cc @CraigFeldspar

Hi @Manon,
Looked at your PG and there seems to be an issue with setMaterialForRendering. Prepass seems to ignore that, I’ll look into it.

3 Likes