Midpoint displacement algorithm
Crystal
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
images
.gitignore
README.md
color_ramp.cr
diamond_square.cr
hard.cr
hard1.cr
hard2.cr
hard6.cr
hard6_blocky.cr
midpoint_displacement.cr
normal1-3.cr
shard.lock
shard.yml

README.md

Midpoint Displacement

Weekly Programming Challenge #16

TODO

  • Fix dependencies on local shard versions (raytracer / hacky_isometric / linalg)

Usage

shards install
crystal run --release hard6.cr

Dependencies

Normal mode (1, 2, 3)

Animated gif of the midpoint displacement algorithm

Hard mode (1)

Animated gif of the midpoint displacement algorithm

Hard mode (2)

Animated gif of the midpoint displacement algorithm

Hard mode (3)

TODO

Hard mode (4)

TODO

Hard mode (5)

Already implemented

Hard mode (6)

It seems like finding parameters that produce a nice image is harder than implementing the algorithm

Raytraced terrain generated with the diamond-square algorithm

Phong shading looks much better, but sadly the raytracer is not efficient enough to render images where the exponent is higher...

Raytraced terrain generated with the diamond-square algorithm

Maybe some hacky water will do the trick

Raytraced terrain generated with the diamond-square algorithm

It turned out that my implementation of the roughness parameter was not optimal, here are some images generated with the fixed version (using 0.2, 0.5 and 0.8 as roughness)

Raytraced terrain generated with the diamond-square algorithm Raytraced terrain generated with the diamond-square algorithm Raytraced terrain generated with the diamond-square algorithm

BONUS: A blocky isometric rendering of the terrain

Raytraced terrain generated with the diamond-square algorithm