Cheap terrain with fake normal map or POM

For mountains distant views, or land under vegetation.

the shape is obtained from the camera view and the texture tex_form.

Shader code
shader_type spatial;
render_mode specular_schlick_ggx, cull_back, async_visible;

uniform sampler2D tex_color: hint_albedo;
uniform sampler2D tex_form : hint_black;
uniform float tile_color: hint_range( 1.0, 16.0, 0.1 ) = 4.0;
uniform float tile_form : hint_range( 1.0, 16.0, 0.1 ) = 2.0;
uniform float form : hint_range( -0.1, 0.1, 0.01 ) = 0.05;
uniform float deep_light : hint_range( 0.0, 0.9, 0.1 ) = 0.1;

//Terrain
void fragment() {
	float form_read = texture(tex_form, UV * tile_form).r;
	float UV_form_x = UV.x * tile_color;
	float UV_form_y = UV.y * tile_color- CAMERA_MATRIX[1].y * CAMERA_MATRIX[1].z * (clamp(form_read, deep_light, 1.0)) * form;
	vec2 UV_form = vec2(UV_form_x, UV_form_y );
	vec3 tex_color_read = texture(tex_color,UV_form).rgb;

	ALBEDO =  tex_color_read * (clamp(form_read, deep_light, 1.0));
}
Tags
mountain, normal map, POM, terrain
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from WaltGD

Cheap caustics

Cheap water shader

Related shaders

Fake Interior Shader

Simple, cheap stylized tree shader

Cheap water shader

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments