Finally had time to play with Unity, for sure missing breakpoints in this baby but still I quickly slapped together a runtime terrain generation algorithm based on Olsen, yesterday and today.
Still working on the procedural texture placement and a few other bits and bobs. Then maybe I’ll add particle cloud flyoff from the highest peaks once I’ve added the snow generation and so on.
What I’d like to see in the Unity Terrain object is some control over the individual shaders. Basically like the “textures” but just a stack for materials, I’d rather not have to implement that myself if possible. Also more API access and documentation. If UT needs to change the API in the future then just create new hooks at the end of the libraries and rename the previous ones as Old, or Ex or something, the old callback will continue to function while keeping a new one in place, then ditch out anything older than 1 whole number version.
Also a warning for others, the function TerrainData::GetSteepness(float x,float y) has swapped arguments, i.e. it’s y,x rather than x,y. I’m hoping that’s not to deter use.
From here I’m going to be in general improving it, adding a vignette/mask texture slot to create islands out of it, more texture work (how do you create new alpha layers via scripting?). Then on to the dynamic object placement.
Yes, you can do almost anything to the terrain at run time.
Looks nice. Though I’m personally not a fan of reinventing the wheel and would always generate my terrain and textures in an existing 3rd party tool instead of trying to come up with all that code myself.
@Tom - Thanks. Ah, but you see I needed a better wheel!
In this case I didn’t find anything suitable. I need “infinite” playable terrains built relatively fast in-game at true run-time and on demand, so having a only a few hand-built beforehand and imported is really out of the question. Bear in mind that run-time doesn’t mean when Unity GUI is running but rather when the game itself is running. That takes most unity gui plugins out of the picture, it also needs to be pretty speedy, no-one wants to wait around for that long!
@ChrisBolton - Thanks. Sorry nope, I frequent CGTalk and CGHub but that’s about it.
Great work! May I make a suggestion though; would it be possible to do this, but only to a select portion of the terrain? I was thinking of something along the lines of using a paint selection brush, and applying the algorithim to the selected region? Great work, just a suggestion for future versions.