3
2012
Diamond Square Algorithm
Converted Diamond Square Algorithm / random midpoint displacement fractal from Processing (original by “Justin Seyster”) to Unity C#.
*See also related forum topic.
Release#1:
– Color32 array with SetPixels32() (instead of plotting each pixel at a time..)
– Replaced “/2” with “*0.5f” (supposed to be bit better??)
Ideas:
– Try to make some terrain height maps? Or just directly displace vertices from the function..?
– Does it work in 3D?
– Use it for drawing clouds? Minecraft map?
– What if you adjust parameters each frame, how it looks animated?
– Use as a shader? Someone has made one here, who would convert to unity..?
– Mix colors with previous layer..?
– LookUpTables?
Webplayer:
nothing to see..it just generates a texture as in screenshot..
Download source:
DiamondSquareAlgorithm1.unityPackage
Or donatebuy source:
0.5 eur [digishop id=”14″] (download link comes to your email)
Includes: Example scene, c# source
—
Image#2: texture size: 2048×2048, filtermode.Point,
—
Image#3: deep profiler report (should try to put the colors in array..instead of using single setpixels..also could try using ints? and replace divisions with multipliers?)
Small update: using array & setpixels, bit faster..
—
Image#4: greyscale..heightmaps..
—
Image#5 (Terrain with nicer colors.. the grid’ding is quite visible in larger terrains..)
Related Posts
12 Comments + Add Comment
Leave a comment
Recent posts
- MotionVector Effect: Object “disappears” when paused
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
Recent Comments
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on
This is amazing!Can’t wait for the source
Hello!How do i download it?I have installed the toolbar and have java enabled and still says that UnityCoder.com Toolbar must be installed & Javascript enabled! (and these links are personal, use the toolbar to access downloads) yada yada
^ link fixed!
I also was not able to download – after installing shitty toolbar
Chrome has problems with the downloads..
(It might work better now, link doesnt open in a new window anymore)
Sorry for calling your toolbar shitty. You are an awesome programmer. I was just frustrated.
no problems, havent yet found other solutions for offering free downloads.. (actually google ads are better than the toolbar already)
generic lattice noise algorithm:
http://www.codeproject.com/Articles/785084/A-generic-lattice-noise-algorithm-an-evolution-of
I suppose this is not a “Dianmond-Squere” Algorithm because it looks so linear and “griddy”.
It looks like a two dimensional “Midpoint-Displacement”. You need to do two steps first create all squares then diamonds
Wonderful! You just saved me a few hours of work, thanks a lot!
How did you generate the greyscale height map?
I think the colors were just set to 0-1 for each (R, G, B), so it becomes grayscale,
in the terrain colors image, there is some added if’s to set different colors based on the value (like if height is 0.5, then use grass color..)