- Home /
Non-Linear Sorting Order of 2D Sprites
Is there any way I could make Sprites A (player), B (background), and C (lighting) such that B is behind A, A is behind C, but C does not appear over B?
I.e., Sprite C should be over the player, while the player is over the background, but I don't want Sprite C to be visible over the background - just when over the player.
Is the effect you are going for a dark background with your player being the light source, illu$$anonymous$$ating the area directly around it?
Well, not quite. Imagine a light source that the player can approach, and a background image which represents far away objects (with heavy parallax). I want the light source to illu$$anonymous$$ate the player (and other "nearby" objects), but not the background.
I think this doesn't classify as a 'sortig order' issue. Of course you can think of it that way (A in front of B, C in front of A but behind B), but I believe this is more of a 'masking' or a shader question. Traditionally you would want to draw the character with a shader that alters the brightness of the character based on another image that stays still relative to the world
When all you've got is a hammer, everything looks like a sprite. :) None of the 2d tutorials mention shaders (or 'masking'?) at all. Where would I go about finding out how to use one in a situation like this?
Your answer
Follow this Question
Related Questions
Adding a Sprite 1 Answer
Sprite with non-constant jitter during constant velocity movement. 2 Answers
How to alternate images in 2d unity 0 Answers
Unity Adds Antialiasing to Texture 2 Answers