Loren Schmidt
|
|
« on: September 07, 2010, 12:52:53 AM » |
|
Every so often I get interested in something and just start programming with no real goal in mind. I started playing around with erosion a few days ago. This started as a pure simulation, but I thought it would be a lot more engaging if it were more hands-on. So here is what I ended up with. It's a hokey erosion simulator + landscape generator + landscape doodling toy: http://vacuumflowers.com/temp/landscapeThis isn't quite a game, so feel free to move the topic to wherever it would be most appropriate. Thanks!
|
|
|
Logged
|
|
|
|
increpare
Guest
|
|
« Reply #1 on: September 07, 2010, 01:04:55 AM » |
|
Texturally I quite like it - though it's a bit limited in its variety. Also pretty slow on my laptop (2.4 Ghz macbook)
[ Also, for a second I thought the (upper part of the) first screenshot was a scan of somebody's bottom. ]
|
|
|
Logged
|
|
|
|
Loren Schmidt
|
|
« Reply #2 on: September 07, 2010, 01:26:22 AM » |
|
Yes, it runs rather inefficiently, I'm afraid. The simulation is pretty fast, but the rendering (which I'm sure is by no means optimal) slows things down a lot. You can change the resolution of the landscape with the bracket [] keys. Decreasing the detail a bit might help with the frame rate.
|
|
|
Logged
|
|
|
|
RichMakeGame!
|
|
« Reply #3 on: September 07, 2010, 02:33:23 AM » |
|
pretty fun to doodle about in.. slow for me too (seemed like my browser nearly crashed when I accidentally right clicked on it ) what does 't' do? nice work though, love the rain particles and watching them carve trenches. I didnt get any results which looked like your last 2 images tho, how did you do them
|
|
|
Logged
|
|
|
|
Cagey
|
|
« Reply #4 on: September 07, 2010, 03:43:49 AM » |
|
That is really impressive Sparky. I love it The rendering is really really nice. If you ever need a hand optimising it, i'd love to help out.
|
|
|
Logged
|
|
|
|
chris_b
|
|
« Reply #5 on: September 07, 2010, 06:36:30 AM » |
|
This is great!
It would be nice to have a feature for 2D display of texture and heighmap, so they can be screengrabbed and used elsewhere.
|
|
|
Logged
|
|
|
|
RandyO
|
|
« Reply #6 on: September 07, 2010, 07:23:20 AM » |
|
this is sweet. (slow, but sweet. :-p)
if you could output a grayscale PNG or JPG of this, that would be really cool.
the other thing for me is I would like to see particles last longer so they actually carve more of a path. it seems like they end up creating little divots and then they stick there and then disappear before they have a chance to really spread out and create widespread erosion.
but this is really cool.
|
|
|
Logged
|
|
|
|
Eraser
Guest
|
|
« Reply #7 on: September 07, 2010, 08:24:09 AM » |
|
Runs smooth for me, quite fun to play with too. Erosion and rain seem to have no effect when the entire area is filled with stone, but I didn't leave it running for more than 30 seconds to really see if it was ever going to do something.
|
|
|
Logged
|
|
|
|
Loren Schmidt
|
|
« Reply #8 on: September 07, 2010, 12:14:06 PM » |
|
RedProdukt- steep slopes settle over time (it's easier to see this with the rain off). T toggles this. The second screen shot is a run of the the mountain theme (that's the second button from the top on the right). The third shot is from the mesa theme (which is the third button down). That theme has two variants- click a few times and you'll get the one with little rock spires. On top of that, I added a few craters ("M" for meteors!). Cagey- oh wow. I would love to optimize this. It's the rendering that's slowing it down- I'm currently using a ton of rectangles drawn back to front. It's both slow and restrictive (no orbiting ). chris_b, upriser- You guys are both totally right. I think an export option is in order. It would be easy to have it display a height map + a color map to allow screen capture, but I don't actually know how to save proper .png files from within Flash. I know it can be done, though. upriser- you're absolutely right about the particles not traveling far enough. That really bothers me, actually. The reason for this is that liquid does not pool at all in this simulation. If a stream hits a low point it doesn't fill it up and flow over it, it just gets stuck. MindEraser- Thanks! If I understand you correctly, the explanation is that the water needs an inclined slope to really do anything. If it hits a level surface then it has nowhere to flow.
|
|
« Last Edit: September 07, 2010, 12:36:14 PM by Sparky »
|
Logged
|
|
|
|
|
Loren Schmidt
|
|
« Reply #10 on: September 07, 2010, 12:37:03 PM » |
|
Oh wow, it just uses a displacement filter? That's crazy. It looks really nice, and it allows for rotation. That's totally worth looking into, thanks John.
Edit: Ah, using a BitmapData object as your reference instead of using 2d vectors of data allows rotation, which is awesome.
|
|
« Last Edit: September 07, 2010, 03:00:02 PM by Sparky »
|
Logged
|
|
|
|
Tycho Brahe
|
|
« Reply #11 on: September 08, 2010, 02:19:19 PM » |
|
Wow. this is awesome, especially the valley preset. Also, how about an option to re-size the canvas? and a "dig" tool to complement the "raise" tool?
|
|
|
Logged
|
|
|
|
oyog
|
|
« Reply #12 on: September 08, 2010, 03:02:39 PM » |
|
I dunno if it's quite the way the erosion algorithms in Terragen or World Machine work but it sure is fun to see it in real time.
|
|
« Last Edit: September 08, 2010, 03:08:16 PM by oyog »
|
Logged
|
|
|
|
Loren Schmidt
|
|
« Reply #13 on: September 08, 2010, 06:57:02 PM » |
|
Hello there~ I've decided to turn this into a bit more of a tool, so people can use it for their game development projects and so on. I'd definitely like to add basic file export and a few other useful options. I've got a basic screen capture-friendly export screen in: I'm also in the process of adding in a rendering mode like the one in John's demo: http://wonderfl.net/c/6r8J14113- Thanks. If you'd like a larger (and more processor intensive) canvas, try the brackets []. They change the canvas size. oyog- I should go check those out. I've heard of Terragen, but I didn't know until a few days ago that it had erosion tools in it. I'll check out World Machine as well.
|
|
|
Logged
|
|
|
|
knight
|
|
« Reply #14 on: September 08, 2010, 08:45:02 PM » |
|
Hey Sparky great work! It really reminds me of the landscape in sim city. I don't know if your into sharing technical details but I've been trying to create something similar http://www.swfcabin.com/open/1284004338 but I can't quite get the perspective right and would love to know how you did it. Right now I'm just interpolating between a right side preceptive and a top down perspective. I'm very sorry if you feel this is the wrong place for this question or if you don't want to share code.
|
|
|
Logged
|
|
|
|
Loren Schmidt
|
|
« Reply #15 on: September 08, 2010, 11:31:08 PM » |
|
I got part way through the new rendering mode. This is based on John's approach, by the way. Thanks to him, it supports rotation. I just have to get in the color information from the terrain and do some optimization now. knight- That's really neat. It seems like it runs a lot better than what I'm doing. I'd be happy to talk details and share code. (I'm going to release the source for this, so I totally don't mind sharing code) I'll send you a PM with my contact information (or you can look for me in the IRC channel).
|
|
|
Logged
|
|
|
|
Loren Schmidt
|
|
« Reply #16 on: September 09, 2010, 01:04:40 AM » |
|
This is the new rendering function so far. There are still a few things I need to clean up, like the edges, for instance. I also haven't done any optimization yet. I like a few things about the old rendering function. It has a chunky precision that the new function doesn't have. The old function religiously drew every single texel in the terrain, and they always had perfectly crisp edges. In the new function, the shapes of the texels are distorted by the rotation. The new function has one very very big advantage, though- it makes it so that terrain resolution doesn't impact rendering time much. The terrain being rotated and drawn is just a single BitmapData.draw() call, and isn't affected much by the size of the image.
|
|
|
Logged
|
|
|
|
John Nesky
|
|
« Reply #17 on: September 09, 2010, 09:36:22 AM » |
|
Yes, I had some trouble with jittery rendering too.
If you look back at my demo's wonderfl history (forked from: ...) I solved this by blurring the displacement map. But that doesn't work so well if you have steep slopes relative to the camera angle.
|
|
|
Logged
|
|
|
|
J. R. Hill
|
|
« Reply #18 on: September 09, 2010, 03:31:46 PM » |
|
So how do I win? Seriously though this is pretty neat.
|
|
|
Logged
|
hi
|
|
|
Loren Schmidt
|
|
« Reply #19 on: September 09, 2010, 11:57:37 PM » |
|
Here's the latest build: http://vacuumflowers.com/temp/landscapeThis version has both: - an export screen meant for screen capture (E)
- a save to .png option (S).
I'll add GUI options for saving- it's just temporarily mapped to a key. I also need to design a nice way to handle that. There are a number of layers, and depending on how people are using the data they might have very different needs. Should there be separate buttons for height map, color, illumination, and color + illumination merged? Should it simply combine them all into one image? One thing I'm thinking of doing is having the images in the export screen (E) each act as a save button for each of the maps. JR Hill- You have to find the secret exit! But you have to collect all the hidden stars for 100%.
|
|
|
Logged
|
|
|
|
|