Jump to content
  • Advertisement
  • entries
    29
  • comments
    99
  • views
    52192

Beginning on terrain rendering

Sign in to follow this  
Migi0027

2831 views

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
Sign in to follow this  


2 Comments


Recommended Comments

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

Share this comment


Link to comment

 

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

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!