I didnt really need to change anything in my engine because I really dont see any reason to seperate a mesh from a terrain like many engines do. So using World machine to generate a small section of a terrain, I imported the mesh file and heightmap to generate and displace the terrain. In the process I saw some really weird SSAO errors which I still dont get why:
The voxelization for GI:
The diffuse output which is just a really simple shader that lerps between height and normals:
But in the process I saw this nightmare when voxelizing, not good.
.
The shader if anyone is interested. Really simple.
A simple shader file that the engine parsesshader "Simple Terrain"{ Properties() { info = "A simple terrain shader that lerps between 4 textures"; } // Considered to be global input() { Texture2D tgrass; Texture2D trock; Texture2D tsnow; Texture2D tdarkdirt; } pass(cull = true;) { pixel() { float2 tex = input.positionWS.xz * 2.5f; float3 rock = trock.Sample(ss, tex); float3 grass = tgrass.Sample(ss, tex); float3 snow = tsnow.Sample(ss, tex); float3 dirt = tdarkdirt.Sample(ss, tex); float NormalLerp = saturate( lerp( 0.0f, 1.0f, 1 - dot( input.normalWS, float3( 0.0, 1.3, 0.0 ) ) ) ); float3 fvColor = lerp( lerp(grass, dirt, NormalLerp), lerp(snow, rock, NormalLerp), saturate(input.positionWS.y / 20.0f - 0.5)); output.dffXYZTrA.xyz = fvColor; // Yeah yeah its hackyish... // Sets the specular level to 0.2f SetSpecular((0.2f).xxx); } }}
Thats it, just a bit of progress!