Beginning on terrain rendering

posted in The Cuboid Zone
Published February 01, 2015
Advertisement
Terrains are awesome, so therefore I'm trying to mess around with them.

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:

WzvDfSa.jpg

The voxelization for GI:
u6DrgJD.png

The diffuse output which is just a really simple shader that lerps between height and normals:
bCiHLfk.jpg

But in the process I saw this nightmare when voxelizing, not good.
EzV0MwL.png
.

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! smile.png
11 likes 2 comments

Comments

TheChubu

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.
You will soon enough :D
February 13, 2015 03:27 PM
Migi0027

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.
You will soon enough biggrin.png

Most likely! :D

February 13, 2015 08:15 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement