Hello Guest

Author Topic: Backface culling  (Read 3240 times)

stfj

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Backface culling
« on: July 28, 2014, 02:34:14 am »
I notice when I rotate a sprite around to its backside what renders is the sprite in reverse.
Is there any way to turn off this rendering?

I'm working on a card game and I want to have one sprite facing one way for the front of a card, and another sprite facing the other way for the back of the card, so I can flip the card in 3d. The issue is that all of the sprites always draw, and they fight about what order in layer they are. In theory I could just toggle sprite off when I rotate, but that seems really janky. Really I'd just like to have the sprites only draw their front-face.

Thanks so much in advance!

stfj

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Backface culling
« Reply #1 on: July 28, 2014, 02:42:24 am »
oh!
I figured it out.
In case anyone else is interested:

I duplicated the BlendVertexColor shader, renamed it BlendVertexColorCull, removed 'Cull Off' from line 14, and changed the shader title on line 4.

Then I assigned the shader to one sprite, which auto-assigned it to all sprites, and like magic, it works