Search Unity

Question 2D Sprite Sorting in 3D environment?

Discussion in 'Shaders' started by Igotlazy, Jan 9, 2024.

  1. Igotlazy

    Igotlazy

    Joined:
    Jan 15, 2018
    Posts:
    65
    So I'm trying to replicate the visual setup of Cult of the Lamb. Aka, 2D sprites in a 3D world, reactive to 3D lighting and shadows. Camera is fixed from a single direction.


    What is the preferred set up for this? Opaque shader with alpha clip? Transparent shader with alpha clip? Something else?

    Currently I have a transparent shader with alpha clipping, but this causes sorting issues as the camera pans across the screen if the sprites are close together. I tried making the shader opaque, which fixed some of the sorting issues, but my sprite-based characters/props are composed of multiple sprites.



    I was initially using Sorting Groups to handle this layering, but those don't seem to work with opaque shaders, and simply changing the Z value of these segments obviously doesn't sort properly when close to other entities.

    Any tips?