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 /
This question was closed May 16, 2013 at 02:32 PM by Jazzer008 for the following reason:

I figured it out.

avatar image
0
Question by Jazzer008 · May 15, 2013 at 08:16 PM · terrainspheregenerationplanet

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

Update, Fixed:

So basically I was adding randomly to the previous height, which was the vertex to the left. I needed to grab the vertex from above (one row above) compound it with the left vertex, grab the average and use that. Results as follows:

Very nice

----------------------------------------------------------//

I used to have a random radius chosen for each point on the sphere. Which produced this result.

Patchy

Then I started using a more complex generation system. Or at least the ideas of one. But because of my vertex loop I believe, my sphere terrain's horizontal is out of sync with it's vertical. As seen in this image.

Horizontal Continents

My brain is currently fried, I'm sure it's a fairly simple issue but I didn't want to spend the next 8 hours fooling around. Figured someone would have done all that already. Any thoughts?

PS: I'll add my vertex generation code for inspection. If you've done sphere generation before it would help a lot towards understanding what's going on. My 'more complex terrain generator' is rather brutal and vulgar atm, any tips towards that would be appreciated as well.

 for (i = 0; i < segments+1; i ++){
        for (p = 0; p < (segments * 2)+ 1; p ++){
 
                                                if(Random.Range(0,8) == 2){
                                                    savedRandom += Random.Range(-0.02,0.02);
                                                }else{
                                                    savedRandom += Random.Range(-0.002, 0.002);
                                                }
 
                                                if(savedRandom > 0.02){
                                                    savedRandom = 0.02;
                                                }else if(savedRandom < 0.0){
                                                    savedRandom = 0.0;
                                                }
 
             if ( i == 0 || i == segments || i == 1 || i == segments-1){
                         if( i == 1 || i == segments-1){
                                             verts[ p + (i * ((segments * 2)+ 1 )) ] = new Vector3( posX2[p] * posX[i], posY[i], posY2[p] * posX[i] ) * radius * (1.0 - (savedRandom/2));
                         }else{
                                             verts[ p + (i * ((segments * 2)+ 1 )) ] = new Vector3( posX2[p] * posX[i], posY[i], posY2[p] * posX[i] ) * radius * (1.0 - savedRandom);
                         }
                   if (p != 0){
                                             verts[ p + (i * ((segments * 2)+ 1 )) ] = verts[ 0 + (i * ( (segments * 2) + 1 )) ];
                   }
                   
             }else if ( p == (segments * 2) ){
                                             verts[ p + (i * ((segments * 2)+ 1 )) ] = verts[ 0 + (i * ( (segments * 2) + 1 )) ];
             }else{
 
                                                verts[ p + (i * ((segments * 2)+ 1 )) ] = new Vector3( posX2[p] * posX[i], posY[i], posY2[p] * posX[i] ) * radius * (1.0 - savedRandom);
             }
 }


Comment
Add comment · Show 3
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 randomuser · May 15, 2013 at 11:58 PM 0
Share

Your else statement on line 6 is the same as the if statement above it ... this could be your problem.

avatar image Jazzer008 · May 16, 2013 at 12:55 AM 1
Share

There is an extra decimal place. :P There is no 'problem' with my current code. That code functions perfectly, it's just doesn't perform the right action. I need to change that code or get some new stuff in there.

avatar image randomuser · May 16, 2013 at 12:56 AM 0
Share

AH. Sorry.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Procedural Terrain Generation on a Map the Scale of the Milky Way 2 Answers

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

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

How to generate a complete terrain via Script 0 Answers

Turn-Based Strategy Terrain Generation 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