x


How does Clear Flags on cameras work?

Hi there, I'm new to Unity. I'm working on the Walker Brothers tutorial for creating a 2D mario clone.

I'm a bit confused as to how the Clear Flags field works on a camera. The options are: - Skybox, Solid Color, Depth Only, and Don't Clear

My current scene is just mario, the platform and a few blocks above him.

If I switch to "Skybox", everything is clear and fine, the background cast is a sky. Same thing with "Solid Color".

If I select "Depth Only", objects in the scene begin repeating themselves (for example, walking mario around will leave several frozen copies of him trailing, kind of like a graphics glitch. Is there a term for this?). The same thing happens for "Don't Clear".

Can anyone help explain to me whats going on in laymans terms? I tried reading the manual (http://unity3d.com/support/documentation/Components/class-Camera.html) but I didn't quite get it. Any help in explaining how Clear flags on cameras works is appreciated. Thanks!

more ▼

asked Jun 04 '11 at 10:13 PM

coryl gravatar image

coryl
14 8 10 13

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

1 answer: sort voted first

You would only use Depth Only if you have more than one camera. You can use this for layering cameras, where you use Depth Only on the top camera, so the background areas would have the bottom camera show through. Don't Clear is rarely used for anything. http://unity3d.com/support/documentation/Components/class-Camera.html

more ▼

answered Jun 04 '11 at 10:27 PM

Eric5h5 gravatar image

Eric5h5
81.5k 42 133 529

Hi Eric, thanks for your reply. Can you clarify what a top/bottom camera is? My scene indeed has multiple cameras, one for background (clouds, hills), one for foreground (mario, platform, blocks). The background cameras are using culling mask to filter the layers, and are set to Skybox on Clear Flags.

Jun 04 '11 at 10:37 PM coryl

@coryl: a camera that has a higher depth is on top of a camera with a lower depth. In your case you'd want Depth Only for the top camera, and Skybox for the background camera.

Jun 04 '11 at 10:41 PM Eric5h5

what is the pratical difference between Depth Only and Don't Clear?

Feb 22 '12 at 11:56 AM andresp

The camera docs explain it: http://unity3d.com/support/documentation/Manual/Cameras.html (scroll down a ways).

Feb 22 '12 at 07:20 PM Eric5h5
(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:

x3132
x51

asked: Jun 04 '11 at 10:13 PM

Seen: 3530 times

Last Updated: Feb 22 '12 at 07:20 PM