Download

How to setup Multiple Materials for one Mesh for access in c++ code

I’m having troubles grasping how they did this in the ShooterGame example… I even ran it in Debug mode to see how they did it…
What Im having troubles working out is how to have more then (1) diffuse texture for the main material and then access it in C++.
I posted here as it seems to be in the base Material / Material Function setup. What I can’t see is if there is a specific flag I need
to set on each (diffuse) texture to have the base code load up all my Textures into the array as they do here in the Example:



	// create material instance for setting team colors (3rd person view)
	for (int32 iMat = 0; iMat < Mesh->GetNumMaterials(); iMat++)
	{
		MeshMIDs.Add(Mesh->CreateAndSetMaterialInstanceDynamic(iMat));
	}


My textures are very simple, just a Diffuse/Specular/Normal so I just use
Coordinates->Sample->Dif
Coordinates->Sample->Spec
Coordinates->Sample->Norm

I have looked in-depth at all the sample blueprints and materials/textures, but have drawn a blank on how to setup
my own Material and extra textures to get auto loaded up by this same setup. I already have a model with multiple diffuse textures,
I would just like to access them from the mesh list of texures so I can easily change a model’s texture on loading it into game.
Basically I want it to load all the textures for this model into MeshMIDs just like the example does, but I don’t see how they Identified
the extra texture so it loads it up with the model.

What I have tried is Creating simple Material function using the Dif setup with an output
so…

Corp_Base : (Function)
TexCoord->TexSample->OutputResult

Corp_Mat : (Material)
Corp_Base(result)->Dif
TexCoord->TexSample->Spec
TexCoord->TexSample->Norm

This works fine for that material and loads into the MeshMIDs, but I have no idea what to do with the other Diffuse textures
so it will load those in as well :slight_smile:

cheers