Change the Shading Model/Material on Mobile

Hi,

I’m using a subsurface material (Shading Model: Subsurface) for an object. But since subsurface materials are not supported on mobile/ES2 devices, I want to swap out the material of that object for a simple default lit or unlit emissive material in that case. How do I achieve this?

What I tried so far:

  • The “Feature Level Switch” Node in the material. But this only allows me to change the behavior of the material, not the Shading Model.
  • A Material Instance of the subsurface Material with overridden Shading Model. This would work, but I don’t know how to apply this material depending on the feature level.
  • Using a blueprint to swap the material on all affected meshes to the emissive one. But how do I check for the feature level in a blueprint?
    • I could check the device platform by using the “Get Platform Name” Blueprint Node to check for android/ios devices but I would rather check for the devices feature level, not the generic “it’s an android device” to correctly catch all additional platforms.
    • Using the “Get Rendering Material Quality Level” Blueprint node to check if the Quality is “low” and swap the material depending on that. But the description for this node says that it “cannot be used inside a construction script” and the quality level does not necessarily match the feature level.

Are there any better options? I would like to directly check for subsurface availability and determine the used material depending on that.

Hello slarti,

So I think you have a misunderstanding of what the ‘Feature Level Switch’ node actually does.

It actually handles switching to the appropriate shading model based on the device, and will output the correct and compatible shader properties allowed for that specific shader model.

Utility Expression

Simply using this node on the materials you want to have checked is all that is needed. Unreal will handle the rest of the work. I will warn you that subsurface shading requires opacity, and opacity on mobile devices is incredibly expensive due to hardware limitations.

Let me know if you have further questions.

Thank you,

Hey, thanks for the fast answer, it works. Somehow after I activated the mobile preview the first time, the material was shown as the default grid material. I assumed that since the material was set to subsurface, the complete material would not be rendered in ES2 and tried to swap it out.

But after cleaning the whole project and trying again in the mobile preview mode, it renders correctly in conjunction with the feature level switch, changing some of the input values to the other color pins to better match the missing subsurface feature.

But I have a follow up question. Since a subsurface shading model is not available on ES2, what will the engine decide to use on ES2? I guess it reverts to “Default Lit” and not using the “Subsurface Color” and “Opacity” Pin at all, behaving like a “normal” material?

If so, that would be great since that would automatically disable the expensive opacity on mobile. But what if I want a subsurface Material to not behave like a default lit but an unlit material on ES2? Or what if I want to use an opaque material on low end devices and a translucent material on high end ones?

Have you found an answer to this?

I, too, would like to use an unlit material on ES2 and translucent on DX11, for instance.

Would also love to know if this is possible