I’m terrible at Maths and therefore not very good at knowing which function of a mix node to use.
I’ve made this procedural mouth, and I want to be able to control whether the tongue appears in front of or behind the teeth…
I’ve probably got the current mix nodes set up incorrectly, so please feel free to rewrite the entire thing. The main question is why is the tongue always appearing behind the teeth? Which node is deciding that? I’ve tried switching inputs on everything. I’ve tried using the tongue color ramp as a mask instead with a screen node, but I don’t know enough about the full functions of mix nodes. Please help!
*Ignore the brick texture and multiply node in the Teeth T group. That’s just to make lines on the teeth if needed.
The teeth color is white and the tongue color is pink. The rightmost Color Add node add these two colors, but with the “Clamp Result” option ticked, anything above white is clipped. This is why the tongue never appears in front of the teeth.
To fix the problem, do the following:
Remove the culprit node.
Add a Color Mix node and connect the output of the remaining Color Add node to the Factor input. To A, connect the output of the Tongue frame. To B, connect the ouput of the remaining Color Add node.
Repeat 2 but switch A and B.
Add a Color Add node to the right of the newly added Color Mix nodes. Connect their outputs to A and B. Set the Factor to 1 and untick “Clamp Result”.
Add a Color Mix node to the right. To A, connect the result of step 2. To B, connect the result of step 4. The Factor input decides if the tongue appears in front of the teeth or not. Set to 0, the tongue is behind the teeth. Set to 1, the tongue is in front of the teeth.
When set to 1 on the final Mix node, the tongue is not completely opaque. This is why I’d enabled those “clamp results”. I had no idea what it does, but it seemed to make the colours more opaque, which is why I used it. If I’ve misread your instructions, please let me know.
If I’ve followed your guide incorrectly, please let me know. This is doing the same thing as my earlier attempts and the suggestion from Akikun, the tongue is not opaque…
Here’s the file if it helps. 2D mouths test upload.blend (1.9 MB)
*There’s a Weld modifier on the mouth mesh. That’s from a different test I was doing, so you can just ignore/remove that.
That’s weird, it should work. I’m going to take a look at the blend file and investigate.
Edit:
In the list of steps I wrote, I made a mistake in step 4 (the other steps are correct). Here is the correction.
Add a Math Greater Than node, take the output of step 3 and connect it to the top input of the math node. Set the value of the bottom input to 0.
Add a Color Mix node to the right of the math node. Connect the output of the math node to the Factor socket. To A, connect the result of step 2. To B, connect the result of step 3.
Finally, connect the output of the newly added Color Mix node to the B input of the Color Mix node added in step 5.