mikera / clisk

The Clojure Image Synthesis Kit
281 stars 13 forks source link

Possible to set a seed value? #10

Open Folcon opened 10 years ago

Folcon commented 10 years ago

Would it be possible to add the ability to set or pass an optional seed for the noise generators?

mikera commented 10 years ago

Sounds like a sensible enhancement. Happy to accept a PR for this!

Otherwise I'll add it when I next get round to revamping this part of the code base

Folcon commented 10 years ago

First I'm trying to work out if I can use this to generate 2d terrain a la libtcod heightmaps >_<...

Been reading your blog so this has been useful for creating a starting point with voronoi

(show (v+ voronoi-function (scale 0.2 (rgb-from-hsl [noise 0.8 noise]))))

v voronoi

(show (render-lit (v+ vnoise (scale 0.2 (rgb-from-hsl [noise 0.8 noise]))) (v* 6 plasma)))

v vnoise

or

(show (render-lit (v- vnoise (scale 0.2 (rgb-from-hsl [noise 0.8 noise]))) (v* 6 plasma)))

v- vnoise

But still getting to grips with it, changing the way it behaves and how to go about doing things like simulating rain erosion or placing hills and mountains :)...

Kudo's for this though, the lib is pretty fun to use, if I work out how to do some of this, I'll see if I can write up a tutorial or something!

mikera commented 10 years ago

Cool, glad you are making some fine creations with it!

I found that multiplying a plasma with some other noisy function (e.g. another plasma with a different scale/offset) is pretty good for heightmaps.

mikera commented 10 years ago

Also did you find the heightmap example in clisk/samples/gallery.clj?

Folcon commented 10 years ago

Actually I didn't thanks! I assume you mean the :fractal-landscape? Also wow, I've also been looking over your other repo's, I'll probably be trying out the orculje and looking over alchemy in my quest to build my own roguelike :)...

mikera commented 10 years ago

Yep that's the one. Should be fairly easy to customise with other terms etc. And you can remove the render-lit if you just want the colours.

Have fun with Orculje etc.! I'm still maintaining/patching these from time to time, if you see anything you particularly want to enhance then let me know (or PRs welcome!)