[4.4] Is there an issue with static switch params in shaders?

I’ve noticed that while static switch params will enable/disable the branch inputs in a material instance, the actual shader in the editor doesn’t seem to recompile the switched branch in the editor.

If I enable the desaturation branch of my shader the options for it appear, but the shader itself never performs any desaturation. Using a scalar param and a lerp instead however works fine but isn’t ideal from an optimisation perspective.

Is this a known issue?

Hey Antidamage -

Can you post a look at you material and material instance setup? I am not having any problem in my 4.4.

Thank You

Eric Ketchum

I set up a test (which I hadn’t done yet) and while it crapped out at first after a couple of toggles it actually worked as expected. The shader I originally tried it on is quite large - does it need to generate and cache all of the potential states before it works smoothly?

Hey Antidamage -

Yes, Technically all MIC are just a copy of that whole original shader and the whole shader must be loaded into memory before the shader is registered. Usually this happens close to instantly, but can take a moment if you are dealing with a complicated network.

Thank You

Eric Ketchum

I’m still definitely seeing a problem on larger shaders. I’ve uploaded a sample project here:

If you open the material instance ContentBrowser/CelShaderAnime you’ll see a param group called Saturation. If you enable this branch and set the saturation level to 0, nothing happens, the instruction count goes up but the controls do nothing to the editor viewport. Setting the “Saturation” value to zero SHOULD enable that branch and desaturate the scene.

The switches themselves are located in Shaders/CelShader/CelShader.uasset

Hey Antidamage -

There is currently a known issue with using MIC’s in Post Process Blendables. I will keep you informed as we work on the issue and I have linked this AnswerHub post to our bug report.

Thank You

Eric Ketchum

Excellent, thanks Eric! I’m super keen to see that one fixed!

Hi Eric

How likely is this fix to be in the next release/hotfix?

Hey dude, you marked it as answered again but didn’t respond to the question regardarding when this is likely to be fixed.

Hey Antidamage -

It is listed as TTP#344222 and is assigned and currently open so not immediately but probably not next year either. That is about as precise as I can get.

Thank You

Eric Ketchum

Over a year seems to be a long time to have a bug like that open. Is the issue tracker public? If so, what’s the URL?

No, our bug trackers are not public but I wanted to be able to have a direct reference to the issue in the future. As far as the year goes, I was being hyperbolic, but please understand I have no control over the order of issues that our engineers address.

Thank You

Eric Ketchum

I didn’t expect you had any control over it - I was only after a timeframe as it affects when I’ll do a marketplace submission. If it’s not scheduled for the foreseeable future I’ll stop waiting and go ahead and submit with a workaround in place.