Question about closed substrate bug UE-358596

The original issue: https://issues.unrealengine.com/issue/UE\-358596

was closed as ‘by design’ which does not make sense. Was this designation because it is unfixable and there just isnt an ‘unfixable’ category? I can not imagine any design in which is is preferable to pay the full cost of something that is being multiplied by 0 after all the effort to introduce per-pixel instruction-culling to substrate. Is this actually ‘by design’ or is is just unfixable?

[Attachment Removed]

Steps to Reproduce
From the orignal post, for reference:

Make a new material and set it to additive.

Make an unlit emissive slab with a lot of expensive logic plugged into it (just so the expense can be easily seen)

Plug unlit emissive slab into the A input of a coverage node.

Plug masking logic into the Weight so you can change how much of the Unlit BSDF slab is seen.

Make a plane in your level and put this material on it. Duplicate it on top of itself a few times to further make the cost obvious.

Have STAT GPU up, and see the cost of the translucency is high, as expected.

Change the coverage mask param to mask out all of the plane so a majority of it has coverage of 0.

Note there is no change in the translucency cost, despite subtrate’s stated ability to early-out shader instructions per-pixel.

[Attachment Removed]

Looking through more docs… is the subtrate ‘Select’ operator basically what i want here? It looks like it is but I’d like to sanity-check before I get my hopes up.

[Attachment Removed]

Hello,

This was a while ago. What I remember:

  • Legacy material do not do any clip/discard/dynamic branch based on opacity. I looked at the generated disassembly: both opacity and emissive are evaluated separately without any test/clip.
  • This is the same for substrate right now.
  • Also coverage is changed on another node, the plan is to leverage dynamic branching to skip part of the Substrate tree but right now it is not directly possible with the current translator (cannot reorder instructions). Clip discard is also useless since we would need to evaluate coverage first and clip first.
  • This can be made possible with the new translator and that is when we can apply this optimisation that is currently planned.
  • Right now there is no regression as compared to legacy.
  • Also if we do a dynamic branch of clip, it will have to account for the blend mode. Add or pre multiplied alpha cannot test opacity for instance. Only blend can.

So right now this is by design and optimisation is planed for the future.

[Attachment Removed]