Compatibility Vertex Color Fix

fix vertex color in compatibility render

 

Shader code

shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_disabled, diffuse_burley, specular_schlick_ggx;
uniform bool compatibility_mode;

vec4 fromLinear(vec4 linearRGB)
{
    bvec3 cutoff = lessThan(linearRGB.rgb, vec3(0.0031308));
    vec3 higher = vec3(1.055)*pow(linearRGB.rgb, vec3(1.0/2.4)) - vec3(0.055);
    vec3 lower = linearRGB.rgb * vec3(12.92);

    return vec4(mix(higher, lower, cutoff), linearRGB.a);
}

void fragment() {
	if(compatibility_mode){
		ALBEDO = fromLinear(COLOR).xyz;
	}else{
		ALBEDO = COLOR.xyz;
	}


}
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 Theo Lomeu Braga

Triplanar Retro

Related shaders

Decal shader (similar to +Forward Decal… but for Compatibility-mobile)

Decal Shader for 4.3 compatibility renderer + transparency support & no repeat

Vertex Color RGB Material Blender

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments