How To Use Anisotropy (GBufferF) In Custom Shading Model?

Hello! I am working on a custom shading model in UE5, and I’d like to write to GBufferF (Anisotropy + World Tangent), but no matter what I can’t seem to do it. My best guess right now is that the SelectiveOutputMask isn’t getting set right, because there’s a field in there that controls anisotropy (HAS_ANISOTROPY_MASK), but I can’t figure out how to set it correctly (or even how to check it). I followed some code and ended up at a function that determines anisotropy based on FDataDrivenShaderPlatformInfo (line 1535 of HLSLMaterialTranslator.cpp), but I can’t figure out what that function does or how it works or anything. And I might be on completely the wrong track anyways. So if anyone has gotten this working, or has any better guesses as to why it’s not, please help me out.

1 Like

Searching the bUsesAnisoTropy location, I found a location that determines if MSM_DefaultLit, MSM_ClearCoat is used.
So I searched for “MSM_DefaultLit, MSM_ClearCoat” and added the custom shading model name to all the locations found and it worked.