Lumen - Material Pass Replace Node

Having played with Lumen and the material editor for a while this morning, it sorely stood out to me that Lumen does not use any of the existing Switch/Replace nodes in the Material Editor, nor does it have its own.
Currently, if one would want an emissive surface to be 1 intensity on-screen, but 1000 intensity for Lumen, that’s not possible, while it’d be an incredibly useful control to have for artistic direction.

1 Like

On ue5-main there’s a LUMEN_CARD_CAPTURE define, so you can do something like this in a custom node:

#if LUMEN_CARD_CAPTURE
return InputA; 
#else
return InputB;
#endif
8 Likes

I’m a total novice with custom nodes but I tried your idea with, what I think, is correct syntax.
Getting and ‘Undeclared Identifier’ for ‘LUMEN_CARD_CAPTURE’.

Would you be up for playing around with this for a min and seeing if you can get your idea working?
I know there’s a few posts that have already requested this feature, so at least a few people would be grateful.

Thanks in advance

1 Like

What Phyronnaz put in his post is the exact syntax you want in your custom code block. Hashtags and all. You don’t want to create a regular 'ole branch, you want to define a switch, hence the hashtags and endif.
On top of that, keep in mind that it only works on ue5-main. If you’re using the launcher build (ue5-ea) it won’t work.

Thanks, I would never have known that. I’m just using the EA build from the launcher as you might have guessed.

cant get it to work. the emissive just goes away entirely if i pipe a 0 into the other input. if u use higher numbers the gi is there again in either input.
anyone else get it going?

much appreciated if anyone posts

This doen’t work.

I’m very happy to report this is working in UE 5.1 (preview, at least)

I would recommend to use the Ray Tracing Quality Replace Node for this: Hardware Ray Tracing Tips and Tricks in Unreal Engine | Unreal Engine 5.0 Documentation. Keep in mind that this won’t affect screen space traces, as those trace and hit what you see on the screen.

Ive been struggling for days to figure out how to hide the emissive object and keep the light from it. I’m not sure how to get from the code listed above to the custom node “LumenReplace.” Is there some kind of custom node I enter that code into? Would love some help so I can get this working! Thank you!

Yes, that is using the “Custom” node.

Hi, does anyone have an example of how to set up this custom node so it disables the lighting from emissive materials? I’m struggling to get it working.

1 Like

For those who don’t know how to make a custom node:

#if LUMEN_CARD_CAPTURE
return Lumen; 
#else
return Default;
#endif
  • Add Default and Lumen to the Inputs Array.
  • Give it a custom Description, So it doesn’t say “Custom”
  • It should look like this now. You’re done!
7 Likes

Thank you for your detailed explanation.
I managed to implement this Custom Node without errors, trying to make it use two different values on the Emissive multiplier, for Lumen and Default (0.01 and 1, respectively).
Basically, I tried to almost disable emissiveness for Lumen. Unfortunately, in my case, there doesn’t seem to make any difference on the material. The value it uses is still the Default (1) and it ends up contributing to the Lumen GI scene, which was not intended.

Could I be doing something wrong? Is there a way to remove the emissiveness contribution of the material on the Lumen GI? Or is impossible to have a flat-color, fully-unlit material with a Lumen scene? Thank you.

1 Like

Did you disable screen traces? This node only effects the raytraced version of Lumen, so it is not compatible with Lumens screen traces GI.

1 Like

Thanks for your input!
No, I did not disable screens traces. I did not realise this node was meant just for the raytraced part of Lumen. I might experiment with that later, although I suspect that won’t solve the problem entirely, since I need my scene to work with both RTX and non-RTX hardware, while mantaining a strong visual coherence throughout.

In the meantime, I seem to have found a satisfactory workaround for my problem, which I’ll leave here, just in case it becomes useful to anyone.

My issue was that whenever I dimmed the lighting on my scene (i.e. ‘night mode’) the lower spectrum of the Auto-Exposure would kick in, thus creating a disproportionately strong glow around any emissive/unlit material that I had on some widget or tool/technical objects. That glow would also spill into Lumen GI, creating a ‘Point Light’ effect on, for instance, a 3D mouse cursor sphere. That was not intended, artistically.

What I ended up doing was using a View Property node set to Pre-Exposure, on all my Unlit/Emissive materials. Multiplying its ‘InvProperty’ output by the Emissive factor of the Material, what I get is a kind of constant Emissiveness appearance, even when the Exposure values change radically, effectively cancelling out the exaggerated and unwanted ‘glow’ that I mentioned above.

Mind you, I did not reach this solution all by myself, I found it on this page, where it is explained nicely:

Cheers!

1 Like