C ++ OpenGL Cube Map Perlin Noise to Sphere

I am currently working on the creation of Planet Generation mainly for fun and hope that some planetary back planets will eventually appear. I use a cube that has been converted to a normalization sphere. planet terrain and sky

In this image, the landscape is not yet textured. This is just a height map render. However, this is not my problem. When creating a sphere from a cube, you are left with 6 faces bent to the shape of a sphere. Therefore, I do not have the latitude and longitude that can be used to wrap a spherical height map around the relief. I am currently using Cube Mapping. However, this caused several problems, as you can see: cube-to-sphere mapping problems where my problem becomes apparent. The problem is that the sphere still has a cube topology. I need to create a height map for each person. I am currently using Libnoise for a height map, and this is where the big problem starts. I can either export it as a spherical height map - mdash, which would be useful if I had a sphere, or I can use planar height maps, which should be displayed on all 6 faces. However, due to how mapping works. I can get 3 faces to line up around the middle and be seamless, but the last height map will not join the first because the Lib noise uses borders and creates a grid of coordinates.

A sphere is created like this:

for(int i = 0; i < vertices.size(); i++) { glm::vec3 oldVec = vertices[i]; glm::vec3 newVec = glm::normalize(oldVec); vertices[i] = newVec * glm::vec3(500, 500, 500); } 

The rationale for this can be seen here .

However, the structure of the sphere will simplify the implementation of Lod in the form of Quad-Ttee later. Is there anyway I can create a cube height map with LibNoise? Or is there something I can do to make the sphere use a spherical height map?

I figured out how to render it using Sphere Maps, but that will not work when I come to use the square tree. However, it gives good results, for example:

enter image description here

So, I pretty much need to know how to alternate the noise in a cube map. Either in Libnoise or in the vertex shader.

+4
source share
1 answer

I finally got the job as I thought. To do this, I usually deployed a cube without a cube map or a sphere map. I apply Perlin 3D noise heights as a cube map, but I don’t use UV coordinates, so it doesn’t matter that I did not expand it as a cube map. Then I apply the texture according to the height of the vertex and seems to give excellent results. Maybe I will have problems later, who knows. Here is a picture of what I got now:

enter image description here

PS: This is not the moon, this is the sun. For testing purposes, it is closer, and I do not have the texture of the sun at the moment, so I just used the old texture with a height of gray so that I could see it better. Now the planet is starting to look great.

+1
source

All Articles