Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Game Development How to Make a Video Game The Unity Editor and Scene Setup Position the Camera

Ranvir Sahota
Ranvir Sahota
9,844 Points

Near set to 0.03

I understand that near is when camera view begins and far is when it ends. I looked into the unity documentation to find out why near is set 0.03 and I found this: clipping planes also determine how depth buffer precision is distributed over the scene. In general, to get better precision you should move the Near plane as far as possible. I more or less can't undetsand this becuase I don't know what depth buffering is and I did look into what it was but MSDN used technical terms I have yet to understand and other explanations I looked at didn't seem to explain it all too well. So can someone explain to me what depth buffer is and how setting near as close as possible improves the prescision?

1 Answer

Alan Mattanó
PLUS
Alan Mattanó
Courses Plus Student 12,188 Points

What can happen is that far objects can confuse the other in which is draw from far to the front. And when you rotate the camera, the game object superposition can flicker in the distance.

Ther rendering path Is a complex topic, but the game engine rendering is different from a traditional infinite ray from the camera rendering. The real-time rendering put in an order one by one triangle meshes from far to near.

https://docs.unity3d.com/Manual/RenderingPaths.html

More distance to cover, more GPU expensive it will be. You can increase shadow quality and avoid artefacts problems by adding multiple cameras with different clipping planes for a PC development. You can make a fast rendering specific for mobile buy rendering only one camera with a very low distance between clipping planes (and adding, for example, simple fog). Is important to keep the near clipping plane as far as possible. I never notice a quality drop difference between wide (0.01>30.000u) or short (0.3>150u) clipping planes. For debugging artefact and differences you can look how a particular frame is build up by using the particular new Unity tool Frame Debugger:

https://docs.unity3d.com/Manual/FrameDebugger.html

Shadow distance has a much bigger quality impact and influence.

https://docs.unity3d.com/Manual/DirLightShadows.html