PrePassRenderer cant find how to use it?

https://playground.babylonjs.com/#R0H3IN#1

So I am trying to think of the best way to take an emissive color and put it behind a the mesh that is emitting it while having the mesh take on a look that it has no emission what so ever.

Figured I need to grab a prePass before any post effects are applied, turn off the emissive on the meshes that I want to use the effect on grab that pre pass then in my modified GlowLayer do what I am doing where I subtract the glow data and add the results on top of the prePass.

I just cant find any examples of the PrePassRenderer

It is not really meant to be used outside of yhe internal workflows relying on it at the moment hence the lack of doc :slight_smile:

Let s see if @CraigFeldspar could guide you in using it. ?

I am trying to do it with a RenderTargetTexture, but its giving me trouble so I figured this might be a better way.

hmm maybe I should just use a Scene copy Post Pass?

or you could try to hack in the code of the effect layer for now ?

It does almost this for the glow layer

Yeah looks like I did not understand fully how it adds it back into the scene. Looks like I need to somehow just step in on the timing.

I need to apply make sure the emissive Colors and textures on the material, then do the glow pass which I am correctly subtracting the info out that I need, then I need to take all the emissive colors off the materials prior to the glow being composed back onto the scene.

Just not seeing where in the timing stack I would step in on this.

https://playground.babylonjs.com/#R0H3IN#6

yay!

Kinda got it, now to apply some AA

The effect layers renders exactly only emissive Colors + Textures and there are 2 events onBeforeRenderMeshToEffect and onAfterRenderMeshToEffect where you could swap in/out the emissive info.

then you could probably hack in the compose step (post process blit with blend mode) to do your thing ?

https://playground.babylonjs.com/#R0H3IN#10

here it is cleaned up

1 Like