x


Applying heightmap to a cube (creating procedural planets)

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?

more ▼

asked Oct 06, 2012 at 05:03 PM

barker_s gravatar image

barker_s
98 8 9 12

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.

http://unity3d.com/support/resources/example-projects/procedural-examples

Oct 06, 2012 at 10:43 PM ScottW

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.

Oct 06, 2012 at 11:40 PM barker_s
(comments are locked)
10|3000 characters needed characters left

2 answers: sort oldest

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:

Texture2D.GetPixel

more ▼

answered Oct 27, 2012 at 02:58 PM

palmerm gravatar image

palmerm
1

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

Oct 27, 2012 at 05:12 PM barker_s
(comments are locked)
10|3000 characters needed characters left

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

[1]: /storage/temp/33474-cubemapprocess1.jp

cubemapprocess1.jpg (178.5 kB)
more ▼

answered Oct 10 at 05:36 AM

ristophonics gravatar image

ristophonics
1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x453
x353
x144

asked: Oct 06, 2012 at 05:03 PM

Seen: 2560 times

Last Updated: Oct 10 at 05:36 AM