[4.8.1] - Material Re-Entrant Expression Bug

Hey Guys,

I have a function to process a sample for a Material. It is hooked directly into another in my Material causing the “[SM5] Reentrant expression” bug. It is referenced here (Material Function Reentrant Expression error - Rendering - Unreal Engine Forums) by Daniel on the Rendering Team back in September '14 as an issue and to try and find a workaround for the time being. It’s unfortunately very annoying and is looking like it’s going to cause me to break out the expression code and duplicate it twice in my shader leading to a pretty messy material.

What’s the current status update on this issue?

Thanks!

Hi MC -

It looks like the issue is currently still backlogged, but I believe I have a workaround for you that might allow you to keep the Material Function without getting the error. In the Material Functions make sure that an input is assigned in the actual Material into all Function Inputs. This should remove the reentrant error and allow the Material to compile.

If this doesn’t work for you, please post your material layout and function layout (if not already in the engine).

Thank You -

Eric Ketchum

Hey Eric,

Great to hear from you and thanks for jumping in on this one!

Checking project now to see if I didn’t assign all inputs… brb…

Oh my freaking god, it worked! Eric, you are the man buddy and high five.

I had a single input left hanging…

What I’m doing in my game is creating a new Planetary Shader and I’m in the process of implementing O’Neils version of the Atmospheric Scatter sample in the GPU Gems 2 book and wanted to create a way to run through the 2 samples back to back but make it easy to expand down the line.

In my MF_AtmosphericScattering_ProcessSample function, I output the sampled color and also take it in as an input. In the first one since it starts as black had no input and the second I connected it, it went away.

This is awesome as I can get back to finishing the Mie/Rayleigh Scattering and get that rocking!

Thank you so much but I do have a quick question for you bud if you have a second. In the future, maybe in the Material Editor 2.0, but will flow control (ie. loops) be coming in the future?

I can’t seem to find a similar node for the life of me and for something like iterating over multiple samples, this would help out greatly.

Either way, thanks again Eric, way to make this an easy one :slight_smile:

If you can at least add a note to have this maybe upgraded in priority, that would be amazing.

Thanks!