Gooch

Gooch shader by Amy Gooch. Inspired by acerola. Gooch shading uses an outline which this shader is lacking, consider using this one I made just for this case. You might also want to set the world environment’s ambient color to black or white.

Shader code
shader_type spatial;
uniform vec3 model_color : source_color;
uniform sampler2D depth : hint_depth_texture;

uniform vec3 warm : source_color;
uniform vec3 cold : source_color;
uniform float cold_strength = 0.0;
uniform float warm_strength = 0.0;
uniform float smoothness = 1.0;

float DotClamped(vec3 a, vec3 b){
	return max(0.0, dot(a, b));
}

void fragment() {
	ALBEDO = model_color;
}

void light() {
	float gooch = (1.0f + dot(LIGHT, NORMAL)) / 2.0;
	gooch *= ATTENUATION;
	
	vec3 kCold = cold.rgb + cold_strength * ALBEDO.rgb;
	vec3 kWarm = warm.rgb + warm_strength * ALBEDO.rgb;
	
	vec3 gooch_diffuse = gooch * kWarm + (1.0 - gooch) * kCold;
	vec3 reflection_dir = reflect(-LIGHT, NORMAL);
	float specular = DotClamped(VIEW, reflection_dir);
	specular = pow(specular, smoothness * 32.0) * 5.0;
	
	DIFFUSE_LIGHT += gooch_diffuse * ATTENUATION;
	SPECULAR_LIGHT += specular * ATTENUATION * LIGHT_COLOR;
}
Tags
gooch, Illustration, npr, stylized, technical
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 wriks

Per object depth-based outline

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments