Problems with MaterialAttributes and Custom Output types

Hi, I’m running into a problem when trying to use **MaterialAttributes **with custom output types like ClearCoatBottomNormal, **BentNormal **and TangentOutput. The SetMaterialAttributes and GetMaterialAttributes expressions in the Material Editor allow you to set/get ClearCoatBottomNormal, BentNormal and CustomEye Tangent (which I believe corresponds to ‘TangentOutput’) but they do not appear to work.

As seen in the top half of the attached image, if I use the SetMaterialAttributes expression to set ClearCoatBottomNormal I don’t see the effect of my bottom normal in the material’s final appearance. If however, as seen in the bottom half, I subsequently use the GetMaterialAttributes expression to expose ClearCoatBottomNormal and connect that to the ClearCoatBottomNormal custom output I will see it’s effect in the final appearance.

While this method works, I’d like to avoid it if possible. I’m actually setting ClearCoatBottomNormal (along with all other material attributes) in Material Functions which are embedded in my final Materials. I’m using Python scripting to automate the process of constructing a large number of these materials and have been relying on the single-connection nature of MaterialAttributes to simplify the process. With the apparent limitation described above, I will need to hand-edit each final Material to add and link the GetMaterialattributes and ClearCoatBottomNormal custom output nodes.

For what it’s worth, I’m able to add the GetMaterialAttributes node to my materials via script but I’ve been unable to figure out how to add the ClearCoatBottomNormal attribute (or any attributes) to it as it’s just an array of Guids which (presumably) map to the actual attribute types but which are otherwise unknown to me. Even if I could do this, it still seems to me that just passing ClearCoatBottomNormal via the MaterialAttributes should work.

Possibly I’m misunderstanding something here but any insight or suggestions is appreciated.

I haven’t tried but there is a macro HANDLE_CUSTOM_OUTPUTS_AS_MATERIAL_ATTRIBUTES which may make your first case work. The default value of HANDLE_CUSTOM_OUTPUTS_AS_MATERIAL_ATTRIBUTES is 0. You need to recompile the Unreal Engine from source and change Engine.Build.cs to enable it.