Order of RTT gathering / rendering

Currently, we have this order for the steps related to RTT gathering:

public static readonly STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 0;
public static readonly STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;
public static readonly STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 2;
public static readonly STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;

Any reason why SHADOWGENERATOR is before DEPTHRENDERER? I would need my depth renderer to be generated before the shadow generators :slight_smile:

I guess my question is more: is it possible to inject my depth renderer in the RTT list anywhere I want (like in the first position)?

I could do in scene.onBeforeRenderObservable something like:

(scene as any)._renderTargets.push(myrtt)

because at this point _renderTargets is still empty, but it’s quite ugly (_renderTargets is private)…

I think I can’t use scene.customRenderTargets because the list of active meshes used for the rendering will be the one from the previous frame as _evaluateActiveMeshes() is called later in the scene rendering process…

custom is not meant to be used internally it is more entitled to be here for the users, I think it is safe to move the order for depth before shadows.

The order was quite arbitrary as there was no dependency until now.

Cool, going to update the PR then!

2 Likes