Masking texture based on other texture
I'm searching for a way to mask parts of a texture on some objects based on another texture element, but I'm not quite sure how to handle it. Let's say I have several gameobjects with a Sprite and I have another texture that defines what should be visible for the user, how do I accomplish this?
In the above example I'm trying to explain what I mean. Image 1 is the graphical representation of the objects in the game. This is how the game looks at the beginning of the level. Image 2 is the mask of what should be visible. As can be seen is a part in the right side has been deleted Image 3 is how the final product should be, where the part from image 2 that was deleted also should be deleted on the objects visible to the player.
I have tried to search around for a solution on how to do it, but so far the closest I have come is finding this:
http://answers.unity3d.com/questions/732993/is-it-possible-to-create-a-transparent-empty-textu.html
But unfortunately it doesn't seem to work here. I guess I'm doing something wrong, but I have no idea what.
I have created two materials for the game. One of them uses the shader Unlit/Transparent and the second material uses the shader copied from the above link from user tanoshimi. The first material I have used on the sprites seen in Image 1. The second material I have used on the sprite seen in Image 2.
The only thing it does it make the sprite in Image 2 totally invisible.
Any idea what I'm doing wrong here? This shaders and materials are completely new elements for me
Your answer
Follow this Question
Related Questions
Problem with sprite materials/shaders inside a mask 1 Answer
How to create a shader that does not test for z-depth but obeys UI Mask 3 Answers
What is the best approach to mask players vision? 1 Answer
How to load 3d model(.obj) in device by programmatic. 0 Answers
Cut through camera render and display LITERALLY NOTHINGNESS 0 Answers