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.
Thanks.
You could get it with GetTextureParameterValue if your material is MaterialInstanceConstant or MaterialInstanceDynamic.
However, you have to know the name of your normal texture.
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.
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?
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?
-
The inspected material must be MaterialInstanceConstant or MaterialInstanceDynamic with a parent as MaterialInstanceConstant.
-
You shouldn’t create dynamic material to inspect textures. It doesn’t help if the material is not an instance.
- You must enable textures in the Material instance.
It’s working: