How to add texture to mesh in runtime?
I create a mesh that can update in runtime using vertex.And i want to change the mesh color in runtime. Firstly i think about change the vertex color,but i don't know to change it. Then,i try to load/create a texture, and add it to the mesh in runtime. So,i used the function SetMaterial(index,material) in the runtime,successfully i loaded material,but i can't add texture to the material.
here is my code reliefMapTexture = ConstructorStatics.TextureFinder.Get(); terrainMaterial = ConstructorStatics.MaterialFinder.Get(); DynamicMaterial = UMaterialInstanceDynamic::Create(terrainMaterial, this); DynamicMaterial->SetTextureParameterValue(FName("flexBaconTex"), reliefMapTexture); RuntimeMesh->SetMaterial(0, DynamicMaterial);
the problem is ,i can just set the material,but can't change the texture. what's the problem?Is there other method to change the mesh color/texture? please help me! thanks!
asked Mar 31 '17 at 01:36 PM in C++ Programming
Follow this question
Once you sign in you will be able to subscribe for any updates here