This weekend, I experimented with Gaia, RTP, DirectX11 Grass, SpeedTrees, Scion Post FX, Amplify Motion, Sonic Ether’s AO, Realistic Water, etc. mostly to learn about making good looking Terrain for (primarily single-player campaign in) Snowman Scuffle.
For my levels, I’m using Unity Terrain as the ground. It’s overkill for the tiny arenas but for the potential campaign levels, I feel it ought to make most sense. I say ought because that’s pending performance acceptability.
Gaia is one of several terrain-building assets I’ve bought (while on sale 😉 ) in anticipation of this. It’s got great reviews and seemed to have a quick learning curve *and* be able to tailor its results to the shapes I’m picturing so I thought I’d start with that.
I’ve previously used the Uber shader with its DX11 tesselation options for some simple-mesh floors and walls and know it produces amazing results so hoped its ancestor-sibling — RTP v3 — would be as good for Terrain.
I’ve long wanted to play with DX11 vertex generation for things like grass but knew it would take me down a scarily long rabbit hole so decided to jump-start with the excellent DirectX 11 Grass Shader.
Generating some initial terrain with Gaia was great. Simple and easy. As I write this, I’m just about to try my hand at manual stamp use to make something more specific to my needs but I suspect that’ll be smooth and easy too. Yep — was easy!
Next, configuring RTP for Terrain. It’s super-powerful but its documentation is tricky (big and somewhat assuming) and the flow is also tricky. Don’t let that put you off — it’s great, just have a good supply of coffee beforehand 😉 I’ll write about some of the options I fiddled with later (TODO).
Next I added DirectX 11 Grass Shader. I’ve not used it before. Will I use it in SnwScf? Not sure — it’d be super-cool to place it on terrain ‘under’ my voxel snow and have it pop-up when all snow is removed. That’d require writing from snow to a texture map. Viable but yet another thing, y’know! Anyway, this is a learning experiment so for now, I deicded to throw it in there! Wow. Initially it appeared everywhere out to some arbitrary draw distance. (Detailed instructions on fixing this below since people on the forum thread seem to have difficulty here.) A bit of investigating revealed it took a map of heights to draw. Getting said map also took some investigating so I’ve noted that at the bottom as well.
DirectX11 Grass shader feedback
A couple of ideas for the grass shader’s fidelity & performance improvements (that I fedback on the forum)…
A little background for those not familiar:
Since the grass shader is a vertex shader, it requires all the geometry for whatever surface you wish to show the grass upon. For terrain, that means duplicating your terrain and swapping the grass shader in for the Custom Material. Right, on to my feedback…
1: Reducing load and mucky shadows
I notice that the duplicated terrain renders beyond the furthest fade distance(s). A nice option would be whether to return single verticies *at all* for values beyond the max fade distance(s). When one does the “duplciate terrain & swap Material” trick, if you enable shadow-casting on the grass terrain, it produces yucky patches in the distance where ‘Y-fighting’ is occurring. With this new option, it wouldn’t. Until then, one can ameliorate by moving the grass terrain down (y:-0.1) but (a) you’re wasting [CG]PU and (b) it still causes some of the effect in the far far distance.
2: Reducing popping
Regarding ‘popping’, in addition to the pixel accuracy change mentioned in the docs, also increase the “Base Map Dist.” value. I set it to the “Grass Fade End” value. In fact here are the values I used that seemed to work well (pending realisitc performance analysis) …
Good DirectX11 Grass settings for use with Terrain
For other users, here’s what I found to work well (so far):
- BaseMapDist: 120
- Tree & Detail Objects: False (don’t need since you already have the orignal terrain)
- Remove the collider (you’ve got one on the original terrain)
- DX11 Grass:
- LOD Start: 10
- LOD End: 50
- Max LOD: 5
- Grass Fade Start: 50
- Grass Fade End: 120
- Min Height: 0
How to get the Colour map from the Terrain
Here’s my flow:
- use this script to get the splat map.
(Note: Gaia has this facility and more in its Utilities too! Either export Texture Splatmap as before *or* Grass Splatmap — this latter would require a slightly different workflow but allows varying foliage types!)
- pull it into Gimp (or whatever layer-capable drawing program)
- extracted the green channel (whichever happens to your grass terrain layer)
- Use channel selector to turn channel to ‘selection’
- Create a new layer
- Colour white over the whole image (with that selection set).
Since the selection keeps an ‘alpha’ like value, your ‘full white’ colouring comes out as levels of white.
- Export as PNG and bring into Unity.
- Set as DX11 Grass Color Map.
Obviously if you’re using multiple grass types, you’ll need to tweak but I’m sure the same process will work.
Final Gaia notes for Snowman Scuffle
Here are some notes for future me on what I’ll likely need to do when using Gaia with my game!
Configure different terrain textures. Likely need to do in both (a) Gaia and (b) its spawner rules (specifically the Coverage Texture Spawner) so that it (a) configures the Terrain correctly and (b) places correctly. Started work on this — it’s kind’a hard to work with. This seems a weakness in Gaia. Might try TerrainComposer v2 which makes *this* part easier but probably makes other things harder(?)
Similarly, I’ll probably need to reconfigure many of the spawners to give distributions I desire for my levels. That’s ‘designing’ when using Gaia!
If using the ‘circle of stones/whatever’ idea, could probably build a Gaia spawner for just that!
Right, time to try out Terrain Compser v2 to see how that compares!