0
\$\begingroup\$

I'm trying to give a card game the look as if you play at a table. The effect I'm aiming for looks like this

Board Image

The camera used is just a perspective angled camera.

Camera

The card is a mesh with a 0.02 thickness and has a sprite renderer at the back and front. The backimage is placed at 0.01 and the front image at -0.01, they work well and the card feels good enough. But if I add more elements on top, they are visibile through the back. The mesh is disabled to better see the 3 Sprites, the crystal is a different one from the first image (and not some weird perspective)

Front, side and back view:

FrontSide Back

They are layered like this

enter image description here

And all 3 Sprites are imported the same, have the same sprite renderer settings and Order in the layer.

enter image description here

The question is:

Why is the crystal visible from the back and how do I fix this?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Sprites are sorted by their center point, so if the center point of a sprite in the corner happens to be closer to the camera than the center point of the card backing, it will sort in front. You might want to use a Canvas for this - then you can control the layering through canvas hierarchy order, without stacking up z offsets. \$\endgroup\$
    – DMGregory
    May 7 at 18:13
  • \$\begingroup\$ If I use a world space canvas for it, won't I still have the same problem that elements lower in the hierachy are just going over the others? If I rotate the card, the element would now be displayed fully on top (so it either displays the front or back) \$\endgroup\$
    – Zibelas
    May 7 at 20:00
  • \$\begingroup\$ I found a solution thanks to the sorting order. Adding a sorting group to the CardFront and all was working as it should. Now the Crystals are taking the center point from the front card. Since the back and front are same size, there will never be a conflict as long as the camera is not in the middle of the card. Writing an answer if no further bugs are happening \$\endgroup\$
    – Zibelas
    May 7 at 20:21

0

You must log in to answer this question.

Browse other questions tagged .