Blender Masking with sprites in Blender 2.81

Pigfarmer

Member
May 25, 2019
280
684
I'm working on sprite-based cutout animations in Blender with COA-tools and I'm wondering if it's possible to mask out a sprite with another sprite in Blender.

As an example, what I want to achieve is to get the following image to look like pacman on a blue background. So the red triangle would mask out the yellow circle, but not the blue rectangle.

2020-01-28-223421_3840x1080_scrot.png
What I'm ACTUALLY trying to do is partially hide a penetrating penis sprite, and I can't do it convincingly just by adjusting the Z-order of the sprites.
 

Saki_Sliz

Well-Known Member
May 3, 2018
1,403
1,011
There are two ways I think this can be done.

The most common answer people will give you is use the compositor (look into render layers, idk what they are called now) or the video editors to do these effects. but neither you can view in real time.

if you really want to be tricky, you can uv map all the layers and mask, give the shader some number inputs, use the number inputs to drive a Mapping node to control the uv for the moving masking, and then to move the alpha mask inside the shaders, you use a dummy objects position as a driver for the number inputs you proved for the material.

I may go in more depth as needed, but I am at 24 hours with no sleep so I am just going to be brief.
 
  • Like
Reactions: Pigfarmer

Pigfarmer

Member
May 25, 2019
280
684
Alright, so I went with the composition route, because there's some documentation to go by. I got the pacman example to work, but I'm not sure this is the optimal setup so feedback is more than welcome. Now to see if this method is applicable to my actual project.

Note: You have to check Render Properties > Film > Transparent so that the ViewLayers end up with transparent backgrounds in the composition phase.

You don't have permission to view the spoiler content. Log in or register now.

You don't have permission to view the spoiler content. Log in or register now.

You don't have permission to view the spoiler content. Log in or register now.

EDIT: YES! It worked :p It's a bit static but it'll work as a proof of concept. The result is attached as a webm-file.
 
Last edited: