x


Multiple cameras, view distances, and the depth buffer

[Unity iPhone Advanced 1.6]

Was curious if there is a solution to this issue, though I have a feeling it is simply a precision limitation of the depth buffer.

We have a scene with 3 cameras, one for rendering the landscape (600 farclip), one for rendering the characters (300 farclip) and one for rendering details (350 farclip). The issue is that sometimes the terrain draws over the lower part of the character and detail models; if I change the farclip for the terrain to around 300 it all renders just fine.

Is there anyway around this?

more ▼

asked Feb 22 '10 at 05:25 PM

Shawn gravatar image

Shawn
323 5 6 13

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

If you have different near/far values for the camera (or camera's don't have exact same position) you can't share the depth buffer so you have to set the clear flags to Depth only it for every camera.

more ▼

answered Feb 23 '10 at 04:28 AM

Jaap Kreijkamp gravatar image

Jaap Kreijkamp
6.4k 20 26 70

Thanks Jaap this is what I was thinking but hoped it was not the case. We had hoped to use different ranges for cameras to draw things like characters at a shorter distance than the terrain but obvious they still need to interact with the depth buffer correctly. Since this is not the case we will just need to reduce our overall range and set all cameras to the same range.

Feb 23 '10 at 05:17 PM Shawn
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3001
x336
x26

asked: Feb 22 '10 at 05:25 PM

Seen: 2898 times

Last Updated: Feb 22 '10 at 05:25 PM