Blending two material on one mesh controlled by depth

Hi ,
I wanted to have two material .

mat1 =color red ; mat2 =color blue ;

Apply on a single mesh called “mesh1”. The distance between the camera and the mesh is “1”.

If mesh1 is close from the camera (0.1 - 0.4 ) mesh1 is red .
If mesh1 is far from the camera (0.6 - 1 ) mesh1 is blue .
During the transition (0,41-0,59) the depth control the transition the color of the object will be a gradient from red to blue .

Im looking for any help : article, example close to it , documentation and of course a solution ^^

thanks in advance :slight_smile:

Provided an answer at stackoverflow:

1 Like

thank you again here ^^

1 Like