Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by jc_lvngstn 1 · May 10, 2010 at 08:53 PM · camerascenespaceplanet

Question about distant objects

Given a space scene where there can be ships of various sizes, and more than one planet.

The ships can be at varying distances. Should I have three cameras?

One for the ships

One for any planet I might possibly approach.

One for distant planets (the planets will be some distance from each other, of course. I would think that you would draw all planets as distant, except the one you are closest to.)

Does this sound like the right approach?

If I have a scene (think an x3 system, or possibly eve) where the ships can be very small (star trek shuttlecraft size) to VERY large (think huge carrier, mile or two long), should I use 4 cameras? One for near ships, one for far, BIG ships, one for near planets..one for far planets....

One other questions...how to handle transitions. Will each object need to handle switching to be drawn by a different camera, based on distance from the player?

Or is that overkill? Anyone with experience with this type of situation have any suggestions?

(Edit: I noticed that Unity's scene view seems to be able to properly draw just about anythin, near or far. How is that?)

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Random Indie · May 25, 2010 at 02:38 AM

The system i'm using right now for this type of thng uses two spaces.

The first space, celestial, has planets, moons, stars etc and all objects are tiny comparison say ships in the editor. It has its own camera that has greater depth than anything else.

I have another layer, local, that contains ships, asteroids, and stations. This layer is like a normal scene for any shooter.

To make everything look right I have the celstial camera move and rotate with the local camer, it rotates the same but moves slower.

This all looks weird in the editor but in game it looks fine. For ships far away I used sprite to represent them.

Doing it this way I can fit an entire 'galaxy' into one scen and just load/unload what is needed locally on the fly.

It sounds weird but it works well. If that didn't make sense I can clear it up.

Oh, lights can be layer specific so you can avoid weirdness by flying by the stars light in world space. When in game it looks like the ship is nowhere near the star.

Comment
Add comment · Show 6 · 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 jc_lvngstn 1 · May 26, 2010 at 10:02 PM 0
Share

Very interesting responses. So, if your ships could approach the planets, and at the same time be distant...how would you handle this?

avatar image Random Indie · May 27, 2010 at 04:07 AM 0
Share

Not sure what you mean. Do you mean that 'in game' you approach a planet but 'in editor' you're far away?

If so, I have it set up so that the celestial camera has control over certain things like colliding with a planet. If it gets to close to a planet then it fires off a warning that you're entering an atmosphere or are getting too close to a planet (if an atmosphere is absent). I haven't decided if I should have the player automatically slow down before a planetary collision or if I should blow up the ship if they get too close.

avatar image Random Indie · May 27, 2010 at 04:08 AM 0
Share

Either way, since the celestial camera and the player have references to eachother it's easy to have one affect the other.

If however you mean 'in editor' the player is close to a planet but 'in game' the plAyer is far away, nothing happens, the ship can fly through planets asthey don't have collider on them, just triggers.

avatar image Random Indie · May 27, 2010 at 04:10 AM 0
Share

I can post a few screenshots tomorrow if you like, might make it more clear as I'm not sure I'm making a tonne of sense at times.

An idea I was toying with is having layer based collisions so thatthe local and celestial objects don't accidentally interact unless I force them to.

avatar image Random Indie · May 27, 2010 at 04:18 AM 0
Share

Something I forgot to mention earlier, the player never gets more than 5000 units away from the origin. If they try, the plAyer is moved back to the origin and the local gameobject (contains everything close by) is move the same amount and direction, that way floating point errors don't show up near the player. For instance, if a station is at 0 when the player hits 5000, the player goes to 0 and the station goes to -5000. I don't really care about physics errors far from the player because they won't be seen.

Show more comments
avatar image
1

Answer by Chris Masterton · May 10, 2010 at 10:28 PM

I don't think this will give you the results you think it will. The final composite image is going to have no depth consistency. The player wont know the difference between a near and a far ship.

Is this problem because ships & planets that are far away are not drawing at all? Or are drawing so small they can't be seen? Either way, when objects are too far away to be represented by geometry you can use a 2d icon/sprite instead.

You may be able to put this into the LOD of the model (not sure, havent done this in Unity but in other systems you can) - so when its really far away it switches to the sprite. Otherwise you will need to do the switch manually.

For example say you have your camera and a ship in your scene. The dashes are representing distance from the camera to the object.

c---->Full 3D Ship
c--------->Lower polygon 3D Ship
c--------------->Distance of the far clip plane, nothing is drawn beyond here
c------------------------>Ship will not be drawn, its passed the clip.

In the last case, thats when you want to swap the 3d model of the ship with a small 2d sprite. That will give the user something to click on/view.

c---->Full 3D Ship
c--------->Lower polygon 3D Ship
c--------------->Distance of the far clip plane
c->Far away ship drawn as a camera facing sprite/billboard/icon.

(Unity's scene viewer (if I remember correctly) has an incredibly long far clip plane, which you probably don't have setup for the game camera. If this is the case then objects that are past the clip plane will not be drawn at all. Its better for performance to have as short a far clip plane as possible.)

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 jc_lvngstn 1 · May 10, 2010 at 10:35 PM 0
Share

So for planets, or a sun which are far away, I'd just need to use sprites for them until they get close enough? Would someone normally use render to texture to generate this image?

avatar image jc_lvngstn 1 · May 10, 2010 at 10:50 PM 0
Share

Please ignore the previous comment/question, it really is a seperate issue. But, regarding your response, my concern is that if my primary camera far plane is too close, large ships in the distance won't draw correctly (there will be a loss of Z precision), or at all. But, I'm used to using the default camera, with a far plane of 1000. I might be able to bump it to 10000, increase my near plane, and still have plenty of precision for all of my ships.

avatar image
0

Answer by equalsequals · May 24, 2010 at 11:55 PM

Last summer my team and I put together a game where the bulk of it took place in space.

My personal preference for building space scenes is to have a very deep far clipping plane and to actually take the planets and bake them into the sky box. If you're in space, you're most likely not going to be close enough to planets to be zooming by them as it just doesn't look realistic. Therefore baking stuff like that into the sky box is actually quite beneficial to performance and realism.

Cheers,

==

Comment
Add comment · 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

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

No one has followed this question yet.

Related Questions

How to make first-person work in zero-G with planets? 1 Answer

Would anyone mind telling me about memory size of blank camera built in APK? 0 Answers

(CLOSED) Plane Failing to Render When Camera is Switched Until Scene is Reloaded?! 0 Answers

Can I use Real Scale Space Objects With Colliders? 1 Answer

Character Camera Movement/ShooterGameCamera On planet with Faux 0 Answers


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