I'm new to unity but not new to game development. In my OpenGL ES 2.0 (mobile) games I create a vertex array of all my "sprites" and stuff it in a VBO. Then draw them as I need them one at a time, back to front, and turning on and off depth test and blending as I go to build my scene. Probably not super efficient (as maybe batch drawing) but I get 60fps on modern devices.
This particular scene has a "paper" background, writing ON that paper (same Z depth), then 3d objects over top of that. The 3d objects cast shadows on to the paper. (I can post a screenshot if necessary.)
To accomplish this I render my shadow map of any object that casts shadows. Then render my scene with a shadow shader on the paper, not on the stuff that's on the paper, but then back on for the 3d objects floating above or sitting on the paper.
Now I'm switching to Unity3D and porting this working game over.
I'm having 2 problems that I can't figure out.
- Being new to unity I brought in my sprite sheets and set them "Advanced" but as sprites and sliced them up with the Sprite Editor. But the Sprite Renderer doesn't have checkboxes for Casting or Receiving shadows. Are sprites only for 2d games with no shadows and lighting? Do I have to switch to all Mesh Quads and use the mesh renderer and manually handle all my "sprites"?
- In Unity with the paper and all the stuff that is drawn on the paper at the same Z I'm having depth issues. In my OpenGL version I do
glDisable(GL_DEPTH_TEST);and enable blending, draw the "ink" stuff, and then re-enable depth and draw the rest of the 3d scene. In Unity I can't figure out how to turn off depth or to get blending to work. Since the ink has to be drawn ON the paper and thing drawn over that I can't use a different camera.