Add Texture To Material At Point

I would like to allow for some super basic character customization in my game. I would like to be able to choose from different eyes and mouth. The eyes and mouths will just be images/textures. Instead of making a different texture for every permutation (which would be silly), I would like to be able to create a material instance and set the textures of selected eyes and mouth via blueprint.

Can I take the texture as a 2d texture parameter and add the texture at a set x,y that won’t repeat? Of course I’ll need to add eyes, mouth and maybe more. I have tried adding, multiplying, lerping and much more on texture nodes with no luck.

I wasn’t sure if this belongs in Blueprints or Rendering as it is a question regarding materials. I’ve been googling around all night and I’m not sure if I should be using a mask, painting or something completely different.

I am not great with material nodes and I really need to learn more. Thanks so much for the help in advance :).

So I just learned about decals. Is it poor design to use a decal on a character as a feature? I’m only going for a basic cartoon look and I’m not sure if it’s bad practice to do so. I’d much prefer having a dynamic material but I probably won’t be able to accomplish that without a helping hand.

what you want to do first is setup the UVs for the character in whatever modeling program you decide to use. you want to make each editable part have it’s own material. once you do this you can apply a material for each part of the character. your alternative to this would be taking the image you want and adding a vector2 constant that puts it in the position of where you want it on your character but this way involves lots of trial and error.

Thanks for the response! I wanted to take the vector2 route but was unable to accomplish it in a material. I’m not great with anything beyond basic materials and I was unable to find an example of such a material anywhere.

I never considered the UV route to just map different parts of the face. It seems like the “best” solution but I may want to allow the user to move the eyes up/down/closer together. I’m not sure the UV route would let me accomplish that.

I’m playing around with decals on the actor now but I feel like that’s an unnecessary performance hit. It seems to be working.

Ok what you want to do can get pretty complex pretty fast but, here is some answers for you :

  • For the eyes it could make things easier to separate them from the body and give them their own Shader. This ways you could use high resolution texture and you wont have to worry about your mesh UVs. Then making things parametric is pretty easy it should look something like this :

shader : Imgur: The magic of the Internet

Blueprint : Imgur: The magic of the Internet

Now for the mouth its going to be a bit trickier, you will need another texture and then mask the area of the mouth on your UV so that this new texture doesn’t affect the whole body. For the blueprint its the same logic as the eyes, you just change the alternative mouth in blueprint, the base texture and mask doesn’t need to change unless you have very different face textures.

Imgur

Now if you want to actually be able to move the eye and mouth position and then save those new position, you need to look for morph target, but its much more advance.

Hope this helped.

1 Like