Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
4
Question by spencer lindsay · Nov 17, 2009 at 10:04 PM · terrainspherespherical

Spherical Terrain Object?

Is it possible to create a terrain object from a sphere?

I'm building a "Little Prince" type planet that the game camera rotates around and would love to use the super optimized terrain to build up the exaggerated mountains.

Is there a way to use a quad mesh object as a stand-in for terrain that the terrain tools will work on?

I can build my own mesh, but it will likely be a lot heavier than a terrain object.

This new Q&A site ROCKS, BTW.

Spence.

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

4 Replies

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

Answer by screenhogdotcom · Nov 18, 2009 at 12:50 AM

Terrains are only height maps on planes... there's no spherical support that I'm aware of. Depending on your needs, you may be able to fake something by putting multiple terrain objects together, but you're probably just going to have to model your terrain in a 3D program.

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 spencer lindsay · Nov 18, 2009 at 05:04 AM 0
Share

As I thought. Although,.. with some geeking it should be possible to map Spherically onto a quad mesh sphere and use the same code, no?

$$anonymous$$ost likely,... no.

avatar image robert · Nov 18, 2009 at 03:32 PM 0
Share

That's not really feasible, sorry.

You should just model the planet as a normal mesh. And setup your own radial gravity :]

avatar image
8

Answer by duck · Jan 12, 2010 at 09:57 AM

You can't use unity's terrain engine at all to make spherical terrains, even by putting multiple terrain pieces together. Much of the optimisation done within the terrain engine relies on the terrain being a flat horizontal plane which is deformed upwards only by the heightmap. Same with the trees & grass system, etc - all designed to work on terrain which lies on the X-Z plane. For this reason, the rotation controls in the inspector of the Terrain GameObject have no effect at all.

The most common way of achieving spherical terrain that I've seen is to build your own "CubeSphere" using 6 heightmaps, one for each side of the cube. I've done this before, and I've seen at least two other people on the IRC channel accomplish it.

The technique is essentialy this:

  • Generate 6 heightmaps which seamlessly join in the same way that a skybox joins.
  • Use Unity's mesh building API to build each side of your CubeSphere separately
  • For each side, you need to 'Spheriphy' the grid mesh which makes up the cube's side, and then add on the value from the heightmap for that side. My code for determining the position of a vertex on any given side of the CubeSphere looks like this (x & y is the position within the heightmap for the side):

    // first calculate as if this is the top side float yi = planet.baseHeight + altitude; float xi = ((x / (float)planet.mapMax) - 0.5f); float zi = -((y / (float)planet.mapMax) - 0.5f); Vector3 v = new Vector3(xi, 0.5f, zi); v.Normalize(); v *= yi;

    // rotate according to side orientation switch (side.orientation) { case Planet.Orientation.Top: break;// nothing case Planet.Orientation.Bottom: v = new Vector3(v.x, -v.y, -v.z); break; case Planet.Orientation.Back: v = new Vector3(v.x, -v.z, v.y); break; case Planet.Orientation.Front: v = new Vector3(v.x, v.z, -v.y); break; case Planet.Orientation.Left: v = new Vector3(-v.y, v.x, v.z); break; case Planet.Orientation.Right: v = new Vector3(v.y, -v.x, v.z); break; } position = v;

    Comment
    Add comment · Show 4 · 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 Caiuse · Nov 27, 2010 at 11:09 PM 0
    Share

    @Duck I'm really interested in this method, but I'm completely lost, could you point me some right direction, i have no idea what the code you provide is showing me, is it generating planes then curving them to create a sphere?

    avatar image spencer lindsay · Dec 03, 2010 at 03:53 AM 0
    Share

    Wow. I haven't been back here for a while. I love your programmer solution Duck! Being an artist, it slid right over my pointy head. Ended up modeling it in $$anonymous$$aya and doing a bunch of tricks to keep the poly count down.

    Thanks!

    avatar image cwperkins83 · Dec 06, 2012 at 05:14 PM 0
    Share

    I've been searching for something like this for about a week now with no luck. Is there any chance you could go into more detail on how to accomplish this or post a complete script? $$anonymous$$y game's at a standstill until I figure this out.

    avatar image Calymore · Jun 20, 2013 at 04:37 PM 0
    Share

    hey any video tutorial about this ?

    avatar image
    1

    Answer by ristophonics · Feb 21, 2015 at 11:27 PM

    alt text

    Hey All,

    Had the same problem as described so I went with building my own mesh. I started with a 6 sided cube mesh made in Rhino. I used the Grasshopper plugin to sample height-map values and added the vector amount to each UV on the cube respectively. The result is pretty good but very heavy, which leds into a L.O.D. (level of detail) issue. Not to mention having to code in planetary gravity and player controllers. IE... Planets are custom Assets as far as terrain is concerned. Took me a couple of weeks to figure out 'my' work-around for planet making and I'm still not done. ... never done.. best practice guild for planet creation needed...


    planetexample.jpg (135.5 kB)
    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
    avatar image
    0

    Answer by Usman791 · Sep 14, 2017 at 11:22 AM

    vote here please https://feedback.unity3d.com/suggestions/spherical-terrain-generation

    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

    4 People are following this question.

    avatar image avatar image avatar image avatar image

    Related Questions

    Make a simple tree 1 Answer

    How to create a terrain in a sphere with Perlin Noise 0 Answers

    Generating randomness in a sphere. Only working horizontally. (Image in description) 0 Answers

    Is it possible to generate a high-poly spherical model from a mercator-projection heightmap? 1 Answer

    Generating Heightmaps for a Spherical Terrain 2 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