Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (113)
games submitted by our members
Games in WIP (562)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Code Request: Heightmap generator  (Read 3790 times)
0 Members and 1 Guest are viewing this topic.
Offline gregorypierce

Senior Member




I come upon thee like the blue screen of death....


« Posted 2003-10-03 14:57:05 »

Hi folks,

Some of you know about the project I'm working on and right now I'm trying to see if anyone out there can shave some time off my development by sharing a heightmap generator. I don't particularly need it for a 3D scene since I'm looking to wrap these textures around spheres (for planets) so the only thing I'm trying to do is make sure there are no seems.

To date I've been trying to use Bryce and similar to produce these maps and while that's nice for putting together one-zee two-zee types, I need to be able to generate hundreds of planet textures - so if anyone has that or a pointer to some, lemme know.

Thanks!

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline princec

JGO Kernel


Medals: 376
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2003-10-03 15:28:03 »

This may sound silly but what's wrong with Math.random() and a little convolution filter to smooth things out a bit?

Failing that I've got some Perlin noise code in the SPGL somewhere I used for my terrain demo thing.

Cas Smiley

Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #2 - Posted 2003-10-03 16:05:43 »

I have the following heightmap generators, one using Midpoint displacement, one using Fault Fractal, and one using Particle disposition. I also have a combiner that allows the + - * of multiple heightmaps. Let me know if that interests you

see http://www.mojomonkeycoding.com/images/jme/HeightMaps.jpg
and
http://www.mojomonkeycoding.com/images/jme/Combiner.jpg
for a screenshot of the results.

And math random is a poor choice because it is far too chaotic to look natural, even after filtering. You'd never get smooth mountains and hills with pure random.

Don't send a man to do a monkey's work.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Markus_Persson

JGO Wizard


Medals: 15
Projects: 19


Mojang Specifications


« Reply #3 - Posted 2003-10-03 17:25:19 »

I wrote a hydraulic erosion simulation a while back.. Basically, it starts off with a plain midpoint displacement map (what wurm currently uses, btw), adds water to all nodes, then lets the water run downhill while transporting some "mass" (height).

Click to Play


I'd rather not post the code as I never really did get it to work properly. Wink

Play Minecraft!
Offline hawkwind

Junior Member




Java games rock!


« Reply #4 - Posted 2003-10-03 19:51:59 »

post it...post it...my attempts at erosion bite....I would be very interested
Offline Markus_Persson

JGO Wizard


Medals: 15
Projects: 19


Mojang Specifications


« Reply #5 - Posted 2003-10-03 21:00:37 »

Hm, I looked around for a while, and it seems the finished erosion classes missed my (infrequent) backups, so they're lost in the bitbucket.

However, a class called "Erosion" is still included in the wurm source (that we now have a proper cvs for), and upon closer examination, that turned out to be one of the first versions of it. It's wrong in a lot of ways (I even think it explodes instead of going stable), and there's no actual ERODING in it yet, but here you go: Eroder.java
(Yes, I renamed it. And it's not commented. And actually not as ugly as it could be)

Basically, you want to move some data from the ground ValueMap into the dissolved one unless dissolved/water exceed a certain threshold. If it does, move it the other way instead.
Then make the moveWater method move some dissolved ground as well as water (in pretty much the same way), add rain and evaporation, and run it for a few thousand passes.


Oh, and make sure you never end up with negative values of ground, dissolved or water. That's a Bad Thing.

Play Minecraft!
Offline Java Cool Dude

Senior Member




Java forever


« Reply #6 - Posted 2003-10-05 22:37:41 »

Got few things for ya

Displacement map done in software
Offline gregorypierce

Senior Member




I come upon thee like the blue screen of death....


« Reply #7 - Posted 2003-10-06 19:50:40 »

Quote
This may sound silly but what's wrong with Math.random() and a little convolution filter to smooth things out a bit?

Failing that I've got some Perlin noise code in the SPGL somewhere I used for my terrain demo thing.

Cas Smiley



Unfortunately planets don't look that random. I'm looking some something that generates relatively 'natural' heightmaps. The Bryce folks had gotten pretty good at coming up with algos for that - but their work is not publicly available.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline princec

JGO Kernel


Medals: 376
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2003-10-06 19:52:53 »

Well, try that Perlin noise generator in SPGL. It's fairly simple. Perlin noise can be tweaked in various ways to make it look different.

Cas Smiley

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #9 - Posted 2003-10-06 20:23:43 »

Aye, layered perlin noise does work well for natural looking heightmaps. The best way i've found is in a kinda fractal way - take several layers of perlin noise with increasing frequency and blend them together with decreasing weights.

The weights and layers tend to need some careful tweeking, but i've found that 3 or 4 layers is all thats needed. Other than that you can get some ideas from the paper Ken Perlin wrote on it. Things like the crease from adding sin etc. seem to work well for underwater / low errosion landscapes.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (15 views)
2014-09-12 09:08:26

Norakomi (45 views)
2014-09-10 13:57:51

TehJavaDev (57 views)
2014-09-10 06:39:09

Tekkerue (26 views)
2014-09-09 02:24:56

mitcheeb (49 views)
2014-09-08 06:06:29

BurntPizza (33 views)
2014-09-07 01:13:42

Longarmx (19 views)
2014-09-07 01:12:14

Longarmx (22 views)
2014-09-07 01:11:22

Longarmx (21 views)
2014-09-07 01:10:19

mitcheeb (30 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!