[Unity] Procedural Planets (E01 the sphere)
Why Stack Overflow recommends it
Stack Overflow users cite it as the source of the cube-to-sphere mesh technique they are adapting, and they link it when asking about seams, projection, clicking regions on a globe, and mesh bugs.
Recommended by 0 people across 0 different months, 2019 to 2022.
What it is
The first episode of Sebastian Lague's Unity series on procedural planets. It builds a sphere by creating a cube with six subdivided faces, normalizing the vertices onto a sphere, and sets up the project that later episodes extend with noise and shading.
What people said
Cites Anonymous · 2019-03 · Stack Overflow · on “Unity3D: Clicking on a specific regions of an object”
I'm making a project for my university course. I want to create a globe with clickable cities (just a few) that will change the scene upon clicking. I've been following this tutorial, [this video] , on how to create my own sphere. It uses a coordinate system. So far, I have only found tutorials on how to make an entire object clickable, but I want to make a certain region of an object clickable, possibly using the coordinates that were used in the tutorial I am using. Thank you.
Cites filgas08 · 2020-08 · Stack Overflow · on “CS0161 C# '': not all code paths return a value”
I am getting this error: CS0161 C# '': not all code paths return a value. (I am using this videos if it can help you: [this video] , [LINK] , I am tring to use landmass color instead of gradient in planet) here is the code: public Texture2D TextureFromHeightMap(float[,] heightMap) { int width = heightMap.GetLength(0); int height = heightMap.GetLength(1); Texture2D texture = new Texture2D(width, height); Color[] colourMap = new Color[shapeSettings.planetRadius * shapeSettings.planetRadius]; for (int y = 0; y < minMax.Max; y++) { for (int x = 0; x < shapeSettings.planetRadius; x++) { for (int i = 0; i < y; i++) { colourMap[y * width + x] = Color.Lerp(Color.black, Color.white, heightMap[x, y]); } }
Cites Deamonpog · 2021-10 · Stack Overflow · on “Why cube mesh becomes a plane when in high resolution?”
I use the following code to generate a Cube as a single mesh. My purpose is to generate a sphere from it by normalizing as I have shown in the commented line (I just have to do that to all those statements in the following lines). The problem here is that the mesh changes from a cube to a flat plane as I keep increasing the resolution (parameter given as public int resolution ). (This code was inspired by this video [this video] . But I am using the technique in my own way as given by the following code, so that I can generate a single mesh instead of a combination of 6 meshes, this is required for my work) [code=CSharp] using System.Collections; using System.Collections.Generic; using UnityEngin
Cites Don Andre · 2022-04 · Stack Overflow · on “Projecting triangle onto a sphere”
I'm looking to build a spherical mesh out of equilateral triangles. I've calculated the points of the triangle and managed to create a flat mesh out of them. I'm now stuck on how to translate these points from a flat surface onto a sphere [LINK] My goal is to achieve something similar to the result from this video [this video] . Where the creator does something close to what I'm trying to do by projecting points from a plane onto a sphere. [LINK] I've tried looking for "projecting triangle onto a sphere" results online but I've not managed to find anything that would bring me closer to a solution.
Cites Johannes R. · 2022-10 · Stack Overflow · on “How do I get rid of seams in my procedural asteroid generator?”
I am coding a procedural asteroid generator in Unity using a custom mesh. The main idea is taken from this [this video] YouTube series, where you basically create your own cube with six evenly sub-divided sites, then normalize the vertices and apply a noise function. So far so good. The problem appears to be a visible seam at the edges of the cube. Here is a screenshot: [LINK] I already figured out, that this comes from a bad normals calculation because normals can not be calculated properly for edge vertices. I tried to solve this by just making my original mesh two vertices bigger in each dimension, then running the RecalculateNormals function on this mesh, and then trying to get rid of the add