0
\$\begingroup\$

I've been trying to get a material (with an image texture) to animate towards a colour mix with transparency, but either I'm attempting something the wrong way, or unable to find the right keyword to find about similar examples.

What I'm trying to accomplish is to make a 3D character blush; I have the face area on it's own material, with textures set, but that's where my problem is. If it was animating between two colours, I would simply use Color.Lerp, but since textures are included, that makes me think I have to somehow have a colour mix option for this.

I've also tried to just use the built-in animator to see if Unity would blend between the colours of two different materials, but after all it turned out to be an instant change on the new keyframe; which leaves me to think so far my only exit could be to manually create several keyframes, and create several materials to get it close to acceptable.

Although my knowledge about it is close to zero, is this after all only possible with a custom fragment shader? I don't know if there's a suitable package, or built-in Unity feature that makes something like this possible, or if at all I'm approaching this problem the right way...

Update: This is the shader I'm using right now, from 魔王. It might be a little confusing since inputs are all abbreviated, so here are some example files that are being used.

Textures

\$\endgroup\$
6
  • \$\begingroup\$ Do you just want to tint the whole texture with a colour? Or do you need to be selective about which parts should be affected (eg. masking just the cheek areas)? \$\endgroup\$ – DMGregory Apr 10 at 21:31
  • \$\begingroup\$ Right now I'm looking to completely add like a 70-80% opacity redness to the face (so on top of it's texture colour), for cheek blushes I have created shape keys in Blender and I can fiddle in Unity to bring those in, but colour blending puzzled me how since shape keys can only be used with mesh morphing, as far as I know, at least. \$\endgroup\$ – ASertacAkkaya Apr 10 at 21:33
  • \$\begingroup\$ Which material/shader are you using for the face currently? There may be an equivalent that allows tinting, or we can walk you through building one. \$\endgroup\$ – DMGregory Apr 10 at 21:35
  • \$\begingroup\$ On a custom toon shader (that I'm not the author of), when I open the .shader file, header comment also says it's been generated with Shader Forge, although I'm not sure how to work on shaders combined with Unity options for colour pick. I only experimented with GLSL before and farthest I went is texture() to obtain image colour data, and multiply it by another vec4 colour value and return the result (for adding tint). \$\endgroup\$ – ASertacAkkaya Apr 10 at 21:43
  • \$\begingroup\$ Hmmm. If that shader doesn't expose a tint colour, then we'll likely need to modify it, but that wilk be challenging without seeing the shader itself. Is that something you can show in your question? \$\endgroup\$ – DMGregory Apr 10 at 22:10
0
\$\begingroup\$

What you ask is can be achieved by various ways i think

such as

Single Material

You can select your character's cheeks and mark them as another material in blender3d(3ds etc.). Then only thing you need to do is use the same texture material with a red color tint.

Vertex Colors

You can paint your character's cheeks with a white vertex color in blender3d(3ds etc.) to mask out the areas which you want to be blushed.Only thing you need to is to take the vertex color and multiply it by the blush tint you choose.(Every other vertex colors must be black in this case)

Decals

This may seem a pushover but it may help in some cases.Just find or create a blurred red dot image and use it as a decal

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.