Hello everyone. I am working on a Unity application that will create procedurally generated planets. The way I'm planning to do it is to create 6 planes (or a cube), apply Perlin's noise heightmap to them (plus some soil and hydraulic erosion algorithms) and then map my new cube to a sphere - http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html .
The problem is - I believe cannot simply use Unity's heightmap tool to apply my heightmaps, since it only works with surfaces that are facing up. Could someone more experienced with Unity help me out with this one? Is it possible to apply my heightmaps to all 6 faces of the cube?
On the unity site in the resourse section there is a resource for procedural generation (or sone such wording). look into the CrumpleMesh script. Doesn't involve terrain at all but might be worth your time.
Thanks mate, I believe you've pushed me in the right direction. There's a script called HeightmapGenerator that perhaps could be repurposed to apply heightmaps to all sides of a cube. I think I'm gonna re-write it in c# and see if I can modify it for my needs.
Answer by palmerm
Oct 27, 2012 at 02:58 PM
Texture2D.GetPixel is a neat little function that will grab the pixel value of an image (i.e. height value).
This is what you need:
Thanks for the answer, although it's not really the thing I had a problem with ;) . Actually, I don't even store the heightmap in the file format. I keep it as a two-dimensional array, run some erosion algorithms on it and then feed it to the heightmap generation script.
The problem I do have at the moment is cube spherization. I have created six planes, applied some heightmaps to them, arranged them in a cube and tried applying the math that's been explained in the link I have posted above. Unfortunately, I get some weird transformations (or none at all). I'll have to test it a little bit more, but if you could point me to working script that does the same thing, that would help me a lot.
PS: here's a great paper that's helped me with my work if somebody's interested - http://web.mit.edu/cesium/Public/terrain.pdf
Answer by ristophonics
Oct 10, 2014 at 05:36 AM
First off I think we need a planet generation thread. If I've totally missed it apologies. I am also looking to create a planet mapped from a cubemap that I can apply erosion too. The best resource I have found so far is http://acko.net/blog/making-worlds-1-of-spheres-and-cubes
The solution I have used as a beginner programmer is to generate a mesh using Rhino with Grasshopper, Wilbur and Photoshop. The color on the height map file below show seams appearing on the cubemap. I translate the 'triangular' portions of the mapping to create a new map where all the previous seams are now 'seamless.' (top right color squares). This allows me to create a non generative mapping that I will next run erosion on. The erosion treated heightmap is 'translated' via the photoshop mapping (which is pixel for pixel accurate) to ensure their are no seams on the planet. This result is below. This does not address LOD issues yet but can. >>>>>
Super programmer person...please help all of us simplify our many processes =) thank you
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
13 People are following this question.
Images are, in fact, upside down on standard objects?
How to make a wall inpassible
Mapping a cube to a sphere
Sphere clipping in cube
How do I cause the collision of one object affect the movement of another object?