How to add emissive effects in PBRcustomMaterial

How to generate glowing effect in Fragment_Before_FragColor .
I search pbrBlockFinalColorComposition.fx and find related code:
’ finalColor.rgb += finalEmissive’,
then I seach pbrBlockFinalUnlitComponents.fx and found a variable:
finalEmissive,
but I try to change finalEmissive, the material not glowing.
so I have a question ,how to add glowing effect in Fragment_Before_FragColor

cc @sebavan

I have re edited the question description

I am not sure to understand what you are trying to achieve ? why not simply relying on the glow layer ?

electric1
I upload GIF with the effect show,I create noise and want apply to emissive color
My understand glowing layer depend objects must have emissive property
I’m sorry for my poor English

1 Like

how this is pretty, I am pretty sure @PatrickRyan has a tuto for this ?

@Jeffrey, we do have a tutorial for getting node material to work with the glow layer. Basically, you are using two observables, onBeforeRenderMeshToEffect and onAfterRenderMeshToEffect to prepare your node material. What you need is a switch in your node material to set every pixel that should not glow in the material to black when onBeforeRenderMeshToEffect fires and then set all pixels to the right color for the material when onAfterRenderMeshToEffect fires. This is because the draw call that is the source of the glow layer happens in that step and we only want pixels that glow to have a value other than (0, 0, 0) at that point. So with your material, anything outside of your noise texture needs to be a black pixel in that step, which will create the right glow mask.

You can see a simple example in this demo. Let me know if you have more questions!

2 Likes