Near Camera Noise in Regular Landscapes

A generated landscape using Geo-ClipMapping or other LOD technique can suffer from an excess of available geometry near to the camera, without any heighmap to support it, giving an interpolated smoothness that is undesirable.

image

The generated triangles near to the camera have been interpolated between two height samples and translate into a perfectly smooth surface.

image

If we sample a Perlin noise generated texture in the vertex shader for nearby locations we can inject some semi random height noise to provide a better experience.

Vertex Shader Fragment

float cameraDistance = length(Param_CameraPosition - worldPosition) ; if(cameraDistance < 500 ) { // Now sample the noise texture to add some variation into the nearby tiles. float4 noiseCoordinates = (float4)0;

// Use any texture coordinate system you want here – in my case its based on a variable called worldPercentile

noiseCoordinates.x = textureCoords.u * 25; noiseCoordinates.y = textureCoords.v * 25; noiseCoordinates.z = 0.0f; noiseCoordinates.w = 0.0f; // First mip map float4 noiseHeight = tex2Dlod(VertexNoiseTextureSampler, noiseCoordinates) ; worldPosition.y += (noiseHeight - 0.5f); }

And heres my noise texture;

VertexShaderNoise

And the result;

image

There are subtle, but present, pertubations in the near field geometry which prevents it now being perfectly smooth. The down-side to this technique is the need to calculate the normals in the shader; but thats no bad thing.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s