Pride

A shader to turn your Plane mesh into a pride flag! Works best if the mesh is subdivided (the shader includes a “wave” effect) and has an aspect ratio 2:1.

Currently supports 4 versions (represented by `flag_type`):

* Pride (“rainbow flag”)

* Trans

* Asexual

* Progressive pride

Shader code
shader_type spatial;
render_mode unshaded;

uniform int flag_type : hint_range(0, 3);

void vertex() {
	VERTEX.y = 0.05 * sin(VERTEX.x * 4.0 + TIME * 3.0);
}

vec3 color_pride(vec2 uv) {
	if (uv.y < 1.0/6.0) {
		return vec3(237.0/255.0, 34.0/255.0, 37.0/255.0);
	}
	else if (1.0/6.0 < uv.y && uv.y < 2.0/6.0) {
		return vec3(249.0/255.0, 150.0/255.0, 33.0/255.0);
	}
	else if (2.0/6.0 < uv.y && uv.y < 3.0/6.0) {
		return vec3(241.0/255.0, 234.0/255.0, 26.0/255.0);
	}
	else if (3.0/6.0 < uv.y && uv.y < 4.0/6.0) {
		return vec3(12.0/255.0, 155.0/255.0, 73.0/255.0);
	}
	else if (4.0/6.0 < uv.y && uv.y < 5.0/6.0) {
		return vec3(57.0/255.0, 84.0/255.0, 165.0/255.0);
	}
	else {
		return vec3(147.0/255.0, 40.0/255.0, 142.0/255.0);
	}
}

vec3 color_trans(vec2 uv) {
	if (uv.y < 1.0/5.0 || uv.y > 4.0/5.0) {
		return vec3(91.0/255.0, 206.0/255.0, 250.0/255.0);
	}
	else if (uv.y < 2.0/5.0 || uv.y > 3.0/5.0) {
		return vec3(245.0/255.0, 168.0/255.0, 184.0/255.0);
	} else {
		return vec3(1);
	}
	return vec3(1,1,0);
}

vec3 color_asexual(vec2 uv) {
	if (uv.y < 1.0/4.0) {
		return vec3(0);
	} else if (1.0/4.0 < uv.y && uv.y < 2.0/4.0) {
		return vec3(162.0/255.0, 162.0/255.0, 162.0/255.0);
	} else if (2.0/4.0 < uv.y && uv.y < 3.0/4.0) {
		return vec3(1.0);
	} else {
		return vec3(127.0/255.0, 1.0/255.0, 127.0/255.0);
	}
}

vec3 color_progressive(vec2 uv) {
	vec3 color = vec3(0.0);
	if (uv.y < 1.0/6.0) {
		color = vec3(237.0/255.0, 34.0/255.0, 37.0/255.0);
	}
	else if (1.0/6.0 < uv.y && uv.y < 2.0/6.0) {
		color = vec3(249.0/255.0, 150.0/255.0, 33.0/255.0);
	}
	else if (2.0/6.0 < uv.y && uv.y < 3.0/6.0) {
		color = vec3(241.0/255.0, 234.0/255.0, 26.0/255.0);
	}
	else if (3.0/6.0 < uv.y && uv.y < 4.0/6.0) {
		color = vec3(12.0/255.0, 155.0/255.0, 73.0/255.0);
	}
	else if (4.0/6.0 < uv.y && uv.y < 5.0/6.0) {
		color = vec3(57.0/255.0, 84.0/255.0, 165.0/255.0);
	}
	else {
		color = vec3(147.0/255.0, 40.0/255.0, 142.0/255.0);
	}
	if (uv.y > -0.25 + 2.0 * uv.x && uv.y < 1.25 -2.0 * uv.x) {
		color = vec3(0);
	}
	if (uv.y > -0.125 + 2.0 * uv.x && uv.y < 1.125 -2.0 * uv.x) {
		color = vec3(104.0/255.0, 54.0/255.0, 3.0/255.0);
	}
	if (uv.y > 0.0 + 2.0 * uv.x && uv.y < 1.0 -2.0 * uv.x) {
		color = vec3(91.0/255.0, 206.0/255.0, 250.0/255.0);
	}
	if (uv.y > 0.125 + 2.0 * uv.x && uv.y < 0.875 -2.0 * uv.x) {
		color = vec3(245.0/255.0, 168.0/255.0, 184.0/255.0);
	}
	if (uv.y > 0.25 + 2.0 * uv.x && uv.y < 0.75 -2.0 * uv.x) {
		color = vec3(1.0);
	}
	
	return color;
}

void fragment() {
	vec3 color = vec3(0);
	switch(flag_type) {
		case 0:
			color = color_pride(UV);
			break;
		case 1:
			color = color_trans(UV);
			break;
		case 2:
			color = color_asexual(UV);
			break;
		case 3:
			color = color_progressive(UV);
			break;
	}
	ALBEDO = color;
}
Tags
flag, lgbtq+, pride
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 miskatonicstudio

Engine flame

Frosted glass

Hexagon pattern

Subscribe
Notify of
guest

19 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
admin
Admin
1 year ago

There’s been a lot of disrespectful behavior in this comment section. At Godot Shaders we do not tolerate that. We are all a part of a great community where we help and support each other no matter our differences. Let’s be civilized!

Anti-abuse
Anti-abuse
1 year ago
Reply to  admin

It’s literally an intersectional discriminatory hate-flag.

punch all nazis
punch all nazis
9 months ago
Reply to  Anti-abuse

@anti-abuse
fuck off nazi

anti-commie
anti-commie
7 months ago

ok gr00m3r

fuq LGBT
fuq LGBT
7 months ago

fuk off groomer

LGBT pride worldwide
LGBT pride worldwide
7 months ago
Reply to  fuq LGBT

^ angry bigot

shader
shader
1 month ago
Reply to  admin

there is to genders male and female … do not try change the system and who is againts me is mother fucker gay

Pumpkin2d
2 years ago

Love it 🌈

Alexandria P.
Alexandria P.
1 year ago

This is awesome :3

snesmocha
1 year ago

bro, this is probably the least optimized shader in the entire godot shader site…

cringefinder99
cringefinder99
1 year ago

no u

dingyspy
dingyspy
1 year ago
Reply to  cringefinder99

you

dupadupa13
dupadupa13
1 year ago

hate it

Anti-abuse
Anti-abuse
1 year ago

ok grewmer

this machine kills fascists
this machine kills fascists
6 months ago
Reply to  Anti-abuse

Have you considered not being a worthless fascist? It’s pretty chill + people would actually like you rather than pretend to like you.

anonym_3513
anonym_3513
19 days ago

Oh my goodness. You labeled a person a fascist because of “ok”. It’s fucked up.

not_a_nazi
not_a_nazi
1 year ago

Are you going to allow a Nazi flag too?

fuq LGBT
fuq LGBT
7 months ago

groomer flag

LGBT pride worldwide
LGBT pride worldwide
7 months ago
Reply to  fuq LGBT

Why lie? Why be hateful? What’s wrong in your life?