How to colour blend between two materials?

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.


How do I set decimal values in 1D blend tree?

I have created a 1D blend tree. It is being used for a 3rd Person Controller.

The blend tree consists of 3 animations:

  1. aim pistol down to the floor
  2. aim pistol at middle of the screen (straight forward)
  3. aim pistol up in the sky

enter image description here

To determine the blend value (which animation should be played), I inspect the current mouse position and convert it a value between 0 (aim low) and 1 (aim high). The middle position would be 0.5. Here is my code:

float f = Input.mousePosition.y / Screen.height;  Debug.Log("Blendval " + f.ToString());// _animator.SetFloat("BlendVal", f); 

I tried to insert these decimal values in the blend tree like this:

enter image description here

However, this doesn’t work. Unity converts my "0.5" to 0. I don’t see why.

I can instead use integers like this:

enter image description here

Why doesn’t Unity allow me to use 0, 0.5 and 1? Why do I have to use "other" values like -1, 0 and 1?

Thank you!

Unity Unable to blend 2D Light renderers

I’ve followed the documentation on Unity regarding 2D lighting. It said to turn on Alpha blending in the options. But this is how it turns out: If Alpha blending is off: when off

If Alpha blending is on: when on

I’m not entirely sure why it’s turning black. These are my settings for the 2D light: settings

I’ve checked my layers, specifically the tile map floor, and it’s on the Default layer. tile map settings

I just want my lights to blend well.

unity : How to control the tile value of a material when extract material from imported game object (fbx, blend etc)

I import .blend (or .fbx) file into unity and i extract the materials. Sometimes the rusult of the material tiling is 5×5 , sometime 1×1. What makes unity decide what tiling value to be used when extracting material ? Can we control it ? i’m confused because normally it’s 1×1 but at some case the material has tiling of 5×5.

Changing execution order of Animator so it can blend with Physics

I’m trying to make an effect that a ragdolled character controlled by an animator also affected by the physics collisions. Similar to this game: Crazy Shopping.

The problem is animator controller overrides every change that happens in the Fixed Update or internal physics update (even when the animator update mode set to Animate physics). enter image description here

I think this can be achieved by some how changing the order of execution of the animator so it can happen before physics update. This way physics can affect the animated object. There are solutions like using a second object which contains the ragdoll and in the LateUpdate you can set the positions and rotations of the animated object which works ok but not the thing in my head.

ActiveRagdoll by MetalCore999 is also a really great work which i would love to learn how it works in behind.

How can i achieve this? i don’t even know if my solution would work properly?

Do you have any suggestion or a different way of thinking. I would really appreciate a road map on this.

Can I attune a circlet of human perfection to my animated skeletons allowing them to blend in and speak?

For those unfamiliar, a Circlet of Human Perfection is a Dungeon of the Mad Mage item that reads:

The Circlet of Human Perfection transforms its attuned wearer into an attractive human of average height and weight. The circlet chooses the physical characteristics of the form, such as age, gender, skin color, hair color, and voice. Except for size, the wearer’s statistics and racial traits don’t change, nor do items worn or carried by the wearer. Removing the circlet ends the effect.

If I allow my skeleton created with Animate Dead to attune to this item will they be able to blend in perfectly? What about their ability to speak?

The language trait for skeleton reads that you can’t speak, but the circlet reads that you gain the voice of a human. Do the racial traits staying the same supersede the gaining of the voice?

Fragmente Shaders shapes no to blend colors

i am trying to create some shapes in a Fragment Shader, i finally got to manage it but unfortunately the colors are being blende each other instead of being places one above another. This is my fragment shader code:

    uniform float time;     uniform vec2 resolution;      float shape(vec2 st, float radius) {         st = vec2(0.5)-st;         float r = length(st)*2.0;         float a = atan(st.y,st.x);         float m = abs(mod(a+time*2.,3.14*2.)-3.14)/3.6;         float f = radius;         f += (sin(a*10.)*.1*pow(m,2.));         return 1.-step(f,r);     }      void main( void ) {          vec3 yellow = vec3(1.0,1.0,.0);         vec3 red = vec3(1.0,0.0,.0);         vec3 blue = vec3(0.0,0.0,1.0);         vec3 pink = vec3(1.0,0.0,1.0);          vec2 st = gl_FragCoord.xy/resolution.xy;         vec3 color = vec3(shape(st,0.8)) * blue;         color += vec3(shape(st - vec2(0.2),0.8)) * yellow;         color += vec3(shape(st - vec2(0.1, 0.0),0.8)) * pink;          gl_FragColor = vec4( color, 1.0 );         gl_FragColor.rgb *= gl_FragColor.a;      } 

I wonder if my mistake is being related to some blending issue or just something i am missing.

This is my shadertoy: