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 parallax planes array

Cheap caustics

Cheap water shader

Related shaders

View-Matcap Based Fake Vertex Lighting

Fake Interior Shader

Cheap caustics

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments