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
0
Question by doug__ · Sep 10, 2015 at 05:38 AM · camerarenderingrendertotexture

How would you render a seemlessly wrapping scene?

What I'm trying to achieve:

A 3D flying game in which there is a map, but if you fly off one end of the map, you appear at the other end and continue.

Now, technically achieving this is quite trivial; check player position, and if they fall outside the bounds, teleport them to the other side of the map.

The problem:

From the players perspective this sucks.

You fly to the end of the map and see an empty gray void beyond it... and when you try to fly into it you're magically teleported.

What you want is to somehow render the 'other side' of the scene to the player, so the transition appears seemless.

The question is, how do you do that?

Approaches I've already tried:

1) Mirroring the actual scene

Totally a non-starter. Everything is wrong with this, it requires you to have multiple copies (up to 8) of all the content in the scene, mirrored in real time. This is not a solution.

2) A series of giant quads on the edge that render the 'other side' to the texture.

Works well, but you need many many cameras along each edge that render the scene in realtime to the quads.

Seems like you should be able to dynamically control which of these is active at any time, but if you stand right on the border and look down it you have to render many many of these quads.

Super. Slow.

3) Dynamically place a render-to-texture quad in front of the player camera that shows the 'other side'.

This solution is ideal, but it seems impossible to get the edges of the quad to be 'seemless'; it appears as a floating window into the otherwise empty void with obvious edges.

Remember that you must render both the 'local' area and the 'other side' when you hit the 'edge' of the scene.


So, any ideas?

I almost feel like the solution to this is like some kind of magical sky box shader, but I have no idea how I would write it...

Comment
Add comment · Show 2
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 getyour411 · Sep 10, 2015 at 07:35 AM 0
Share

Depending on your requirements, a cheap fix could be to surround the land with water, scaled quite large and when you hit the invisible edge on one side teleport player to the other

avatar image troien · Sep 10, 2015 at 09:14 AM 0
Share

You mean like a real 3D world right, in which you can fly in all directions (x, y and z)?

The only thing I can think of would be working with 2 camera's.

The first camera is at the position of the airplane. this camera his clipping planes can be anything and clear flags set to depth only.

The second camera is a child of the first camera and is placed behind the first camera (the distance equal to the width/heigt/depth of the level). The important thing here is that the clipping planes are set manually. The near clipping plane should be placed depending on the airplane's forward distance to the edge of the level. If the distance is high, the near clipping plane will be equal to the far clipping plane, if the distance is short, the near clipping plane will be closer to the first camera's clipping plane.

You should abviously make sure that the second camera does not render the back of the airplane, and for consistency, I think it would be best if both far clipping planes are equal to each other, or perhaps even better, the distance between the near and far clipping planes of boh cameras combined shouldn't change over time.

Clear flags of the second camera can be skybox and the first camera should render on top of the second camera.

Once you reach the end, teleport the airplane to the other side and make sure you update the clipping planes accordingly. Basicallly before teleporting, almost everything is rendered by camera2 and after teleporting everything should be rendered by camera 1 again.

I haven't tested anything like this yet, so it could be flawed... But I think it might work as I see no reason why it shouldn't. The only problems I can see is when there are other airplanes flying on the edge of the level so that half of the model is outside it. The part that is outside the level then could get clipped.


EDIT:

Now that I think about it, this does cause some problems. Forget the parenting of the camera's :D you would have to claculate the position of the second camera in a different way, so that it is always on the other side of the map and mirroring the rotation of the first camera otherwise you could get a weird effect if flying towards the edge under an angle...

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by astorga · Sep 10, 2015 at 01:15 PM

I would suggest you to do the teleport thing, but away from the end of the world, so the player would not see the "void".

You can also repeat the world. Just use a prefab. Also, you probably won't need more than 4 instances of the world at the same time (worst case is in the corners of the world, unless your world is small enough), so you should reposition world instances accordingly.

Also, don't let the player go too far from the origin (and I mean really far) because rendering issues will occur.

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

29 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Need some help with portal rendering 2 Answers

Unity - Render XR game objects onto processed camera image 0 Answers

Best way to have a camera only see certain objects? 1 Answer

What happened to my camera? 0 Answers

Camera Rendering Skewed Until Transform Adjusted 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