Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Lautaro-Arino · Dec 04, 2013 at 01:39 PM · cameraguingui

Understanding 3d world and GUI camera space

Im quite new to 3D programming. Im using NGUI as well. Ive realized that while i can understand answers to my questions and look up solutions i have a fundamental lack for understanding what the difference is between the 3D world and the 2D gui screen. I dont even know where to start. For example i want to make a Ngui object draggable so i give it the position of the mouse when dragged but the object dissapears far away.

What should i read up on?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by robhuhn · Dec 04, 2013 at 02:32 PM

The screen dimensions are measured in pixels whereas the world measurement is in meters. If you want to convert screen positions to world positions, you need to use a specific camera for the projection - in most cases it's the active camera. E.g. attaching a 3D object in the world to your mouse on the screen depends on the distance from the 3d object to the projecting camera.

For every application that uses graphics, a viewport needs to be defined. The viewport is a rectangular viewing region of the screen where the 3D scene is projected. It is nothing more than mapping the 3 dimensional objects to the 2 dimensional plane.

The following image shows a typical 3D scene with a perspective projection.

alt text

The eye is where the camera is and the viewport is the plane where all the objects found in the view frustum are projected to.

The view frustum is a pyramid with two clipping planes. Objects or parts of objects found outside the frustum, won't be rendered. It is not possible to define a near clipping plane closer to the observer than the viewport.

When the human eye looks at a scene, objects in the distance appear smaller than objects close by. This is called perspective and this is used for 3D games and applications. Perspective projection is the final image rendered onto the viewport with the objects scaled according to their distance from the observation point.

Orthogonal projection on the other hand, ignores the scaling effect and projects objects to the viewport maintaining their original size.

The following diagram shows the orthogonal projection.

alt text

Source: https://code.google.com/p/libgdx/wiki/GraphicsFundamentalsViewport

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hoeloe · Dec 04, 2013 at 04:39 PM 0
Share

A nice explanation here. I feel I should add that the near clipping plane need not be the same as viewport (and indeed this is rarely the case, as it causes z-fighting). The viewport is the plane on which the 3D scene is projected (it essentially acts as the position of the "screen"), while the near clipping plane is a boundary that ensures only objects in front of it are rendered (this prevents objects behind the camera from being drawn). The viewport and near clipping plane should be as close together as possible, but they aren't necessarily identical.

avatar image Lautaro-Arino · Dec 04, 2013 at 05:05 PM 0
Share

Thanks :)

avatar image
0

Answer by GeoBlazer · Dec 04, 2013 at 02:23 PM

If your looking for something to read, maybe you should read the Unity Manual. It covers all the basic stuff you need to know. It helped me too! :)

Unity Manual Link: http://docs.unity3d.com/Documentation/Manual/index.html

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lautaro-Arino · Dec 04, 2013 at 03:39 PM 0
Share

I read sections of it to understand specific things i deal with at the moment. Do you want to recommend me a specific chapter?

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Camera being disabled by any GUI button 2 Answers

Problem making a ruler 1 Answer

It is possible to have a Camera rect on TOP of a GUI 0 Answers

Disabled Camera acts strangely outside of editor (solved) 0 Answers

Camera in Interface 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges