Quick Example Fresnel Outline

A quick example of using the fresnel as an outline if you don’t want to use a post-processing shader.

Shader code
shader_type spatial;

// Higher values are smaller width.
uniform float outline_width : hint_range(0.0, 10.0, 0.1) = 5.0;

uniform vec4 base_color : source_color = vec4(1.0);

float fresnel(float amount, vec3 normal, vec3 view)
	return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0 )), amount);

void fragment()
	float basic_fresnel = fresnel(outline_width, NORMAL, VIEW);
	basic_fresnel = step(0.5, basic_fresnel); //0.5 magic number seems to give the most intuitive control
	ALBEDO = base_color.rgb - basic_fresnel;
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 Watt Interactive

Sci-Fi Scanner Pulse (Godot 4 update)

Sci-Fi Scanner Pulse (Godot 3.5)

X-ray Vision Effect

Related shaders

Decal Example

Texture mix example

Low Poly Fresnel

Notify of

Inline Feedbacks
View all comments