- Home /
Problem with depth clipping and perspective camera
Hey folks,
I'm making a game with a cut-out animation style. My models are made up of multiple meshes that are arranged with different depths. Things seem to work great in Unity as long as I'm using an orthographic camera. However, as soon as I switch to a perspective camera, Unity renders the meshes in the wrong order.
Here's what the model looks like in Unity at runtime with an orthographic camera (correct):
Here's what it looks like with a perspective camera (incorrect):
And here's what the model looks like in Blender (lets you see how depth is arranged):
I've tried adjusting the near and far clipping planes to fix this, to no avail. I've also tried making the actual distance between the different meshes in the model smaller and larger. Any advice on what to do would be much appreciated...
Thanks!
Answer by boringuser · May 17, 2016 at 04:29 PM
Solved it with this:
camera.transparencySortMode = TransparencySortMode.Orthographic;
:)