Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ OpenGL Cube Map Perlin Noise to Sphere
    text
    copied!<p>I'm currently working on some Planet Generation mainly for fun and hoping to end up with some kick ass planets. I'm using a Cube which has been mapped into a sphere by normalization. <img src="https://i.stack.imgur.com/gq8hf.jpg" alt="planet terrain and sky"></p> <p>The terrain isn't textured properly yet in this picture. This is just the render from the Heightmap. 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 latitude and longitude that can be used to wrap a spherical heightmap around the terrain. Currently I'm using Cube Mapping. However, this has caused several problems, as you can see: <img src="https://i.stack.imgur.com/9o4AA.jpg" alt="cube-to-sphere mapping problems"> &mdash;where my problem becomes obvious. The problem is due to the fact that the sphere still has the topology of a cube. I have to generate a heightmap for each face. I use Libnoise currently for the heightmap and this is where the big problem starts. I can either export it as a spherical heightmap&mdash;which would be useful if i had a sphere&mdash;or I can use planar heightmaps which must be mapped to all 6 faces. However, due to how the mapping works. I can get 3 faces to line up around the middle and be seamless but the last heightmap won't join to the first as Lib noise uses bounds and creates a grid of coordinates.</p> <p>The sphere is created like so&mdash;</p> <pre><code>for(int i = 0; i &lt; vertices.size(); i++) { glm::vec3 oldVec = vertices[i]; glm::vec3 newVec = glm::normalize(oldVec); vertices[i] = newVec * glm::vec3(500, 500, 500); } </code></pre> <p>The reasoning behind this can be seen <a href="http://mathproofs.blogspot.co.uk/2005/07/mapping-cube-to-sphere.html" rel="nofollow noreferrer">here</a>.</p> <p>However, the structure of the sphere will make it easier to implement lod in the form of a Quad-Ttee later on. Is there anyway I can generate a cube map heightmap with LibNoise? Or is there something I can do to make the sphere be able to use a sphereical heightmap?</p> <p>I figured out how to make it render using Sphere Maps but this isn't going to work when i come to using a quad tree. However, it produces some nice results like:</p> <p><img src="https://i.stack.imgur.com/3e4at.jpg" alt="enter image description here"></p> <p>So, i pretty much i need to know how to tile noise into a cube map. Either with Libnoise or in the vertex shader.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload