Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to render Sprites Normally?

Discussion in 'General Graphics' started by AQAGA, Jun 18, 2020.

  1. AQAGA

    AQAGA

    Joined:
    Jan 11, 2020
    Posts:
    25
    I have a 3D project with a player, which is a sprite, and a tree, which is also a sprite.
    I want them to sort by Z. If the player is PHYSICALLY IN WORLD SPACE in front of the wall, I want the player to render in front of the wall, I mean who wouldn't want that. If the player is PHYSICALLY IN WORLD SPACE behind the wall, I want the player to render behind the wall.

    In my case, the player doesn't render in front of the wall, unless I set it to higher sorting order, which I don't want because I then must somehow put the player back if I am again behind the wall. Using triggers is cumbersome and there shouldn't be a workaround for this simple thing to do.

    I tried enabling Zwrite on the default sprite shader, but I get weird cutout around the sprite.

    I tried using pivot point sorting, but some parts of the player are above ground and still render behind the sprite if staying in front.

    The only time the sprite renders as it should be is when I copy the same sprite and put it in front.
    What am I missing? This is driving me crazy, I should be working on the game, not on how to sort sprites in 3d space for weeks.

    How do you render a sprite on top of the other, based on the distance to the camera? Apparently unity is rendering them in another strange way
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276