Skip to content

ripley-on-rails/noisy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

noisy

TODO

Usage

Paint Noise

(require '[noisy.core :refer :all])
(paint2d (murmur-noise) 200 200)

(require '[noisy.core :as c])
(paint1d (murmur-noise) 400 100)

Scale Noise

(paint2d (-> (murmur-noise)
             (floor)
             (scale 10)) 200 200)

... Minecraft anyone?

(paint1d (-> (murmur-noise)
             (floor)
             (scale 10)) 400 100)

Perlin Noise

Generic example

My perlin implementation that uses a murmur based gradient-generator which is currently much slower than the classical perlin implementation:

(paint2d (-> (perlin)
             (scale 10)) 200 200)

Perlin Noise

For the classical, improved perlin noise:

(paint2d (-> (perlin-improved)
             (scale 10)) 200 200)

Perlin Noise

(paint1d (-> (perlin)
             (scale 40)) 400 100)

Close-up

(paint2d (-> (perlin)
             (scale 50)) 200 200)

Close-up

Linear Interpolation (Yikes!)

(paint2d (-> (perlin :curve-fn linear-interpolation)
             (scale 10)) 200 200)

Perlin Noise using linear interpolation... Yikes!

Modifiers

Gradients

(paint2d (-> (perlin :seed 1)
             (scale 20)
             (c/modify (c/gradient Color/BLACK -0.7
                                   c/rgba-interpolation Color/RED 0
                                   c/rgba-interpolation Color/YELLOW 0.7)))
         200 200)

Absolute Value

(paint2d (-> (perlin :seed 1)
             (scale 20)
             c/abs)
         200 200)

Normalisation

(paint2d (-> (perlin :seed 1)
             (scale 20)
             c/abs
             (c/normalize-modifier 0 1))
         200 200)

Invert

(paint2d (-> (perlin :seed 1)
             (scale 20)
             c/abs
             (c/normalize-modifier 0 1)
             c/invert)
         200 200)

Modifier Examples

(paint2d (-> (perlin :seed 1)
             (scale 20)
             (c/normalize-modifier -1 1 0 1)
             (c/modify #(* % %))
             (c/normalize-modifier 0 1))
         200 200)

(paint2d (-> (perlin :seed 1)
             (scale 40)
             (c/modify #(mod % 0.1))
             (c/normalize-modifier 0 0.1))
         200 200)

(paint2d (-> (perlin :seed 1)
             (scale 40)
             (c/modify #(mod % 0.33))
             (c/normalize-modifier 0 0.33)
             (c/invert))
         200 200)

(paint2d (-> (perlin :seed 1)
             (scale 40)
             (c/normalize-modifier -1 1 -5 5)
             (c/modify math/floor)
             (c/normalize-modifier -5 5))
         200 200)

Pixelate for that special retro look:

(paint2d (-> (perlin :seed 1)
             (c/offset 0.5 0.5 0.5)
             (scale 2)
             (floor)
             (scale 10))
         200 200)

Fun with sinus:

(paint2d (-> (perlin :seed 1)
             (scale 40)
             (c/modify #(Math/sin (* % 100))))
         200 200)

(paint2d (-> (perlin :seed 1)
             (scale 80)
             (c/modify #(Math/sin (* % 300))))
         200 200)

(paint2d (-> (perlin :seed 1)
             (scale 40)
             (c/modify #(Math/sin (* % 700))))
         200 200)

(paint2d (-> (perlin :seed 1)
             (scale 40)
             ((fn [s]
                 (fn [& coords]
                     (apply s
                            (+ (first coords)
                                 (Math/sin (* 0.3 (second coords))))
                            (+ (second coords)
                                 (Math/sin (* 0.3 (first coords))))
                            (drop 2 coords))))))
               200 200)

Fractal noise

(paint2d (-> (c/fractal-noise :octaves 3
                              :persistence 3/4
                              :lacunarity 3/2)
             (scale 25))
         200 200)

Combiner Modules

TODO

(paint2d (-> (c/combine-add (-> (perlin :seed 4)
                                (scale 20))
                                (-> (perlin :seed 1)
                                (scale 20)))
                   (c/normalize-modifier -2 2))
               200 200)

Utilities

Grid & File export

(paint2d (-> (perlin)
             (scale 40)) 200 200 :grid 40 :file "grid2d.png")

(paint1d (-> (perlin)
             (scale 40)) 400 100 :grid 40 :file "grid1d.png")

TODOs

  • Add turbulence
  • Add selector modules
  • Structure modules
  • Create wiki
  • Move examples to wiki
  • Code cleanup and structure features and concepts
  • Add caching middleware
  • Add tiling
  • Add paint3d:
    • export depth many images
    • export to animated GIF(?)

License

TODO

Copyright © 2014 Roman Flammer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published