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.
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 ?
basically instead of using setMaterialForRendering, you just add a function in the onBeforeRenderObservable of the mesh, which replaces the material of the mesh with what you need (making sure you store the original material)
Then in onAfterRenderObservable you set back the original material
This PR will fix the problem with the prepass renderer:
Regarding the configuration of the prepass renderer, ScreenSpaceReflectionsConfiguration and PrePassEffectConfiguration are not exported as they are not meant to be used by the end user and are really internal classes. You should instead create your own configuration class (see lines 1-7 and 318 in the PG below).
If you want to use the SSR post process when using the geometry buffer renderer (GBR) in your finalPass post process, you should force the SSR post process to use the GBR (pass true for the last parameter of the constructor) as by default it is using the prepass renderer (PPR): using both the GBR and the PPR is not supported.
Here’s the PG with the fixes:
=> will only work as expected for the PPR when the PR is merged.
@tanpopo I don’t think it’s the same problem in your case, as the PR does not fix it. I’m going to have a look.