How to get the referenced texture from a material in runtime

I want to get the normal map from a material while I am gaming. I have some considerations, use TSoftObjectPtr, or get the texture from UMaterialInstanceDynamic*. But I am still wondering it works. I want to know if somebody can tell me a method.

You could get it with GetTextureParameterValue if your material is MaterialInstanceConstant or MaterialInstanceDynamic.

However, you have to know the name of your normal texture.

Collect all normal textures:

My Products

Hi YosomiChann,

If you’re using c++ you can use the method “GetUsedTextures”, it’s in UMaterialInstance which UMaterialInstanceDynamic derives from.

Thanks, RecourseDesign. I will check this way.

1 Like

Thank you, Supermative, I will try on this method.

I tried “cast to material instance constant” from “get material”(a material interface) but failed, and no error appeared. do you have any idea?

You have to use material instances.

1 Like

Seems I have to create materials instance for each material I use. I tried to create dynamic material instance and cast to material instance constant, then UE return a warning message. Thanks, I will try one more time.


Anyway, I tried these 2 way. First, I cant get texture parameter values from the dynamic material instance. Second, still failing in cast to material instances.
By the way, why cant I get texture parameter values from the material directly?

  1. The inspected material must be MaterialInstanceConstant or MaterialInstanceDynamic with a parent as MaterialInstanceConstant.

  2. You shouldn’t create dynamic material to inspect textures. It doesn’t help if the material is not an instance.

  1. You must enable textures in the Material instance.

It’s working:


1 Like

Thanks you so much, Supremative!! I think can finally get the Normal map as below: