GodotCity XR/VR Shader

inspired by the movie sincity,

best to be used with a lightsource and roughness set to 0 or clearcoat enabled on the material of the objects you wish to have that red look as seen in the cover image.

 

This shader is supposed to be used mainly in XR/VR, follow the instructions below to get it working in Godot 4 XR/VR

1) add a MeshInstance3D node as a child of the XRCamera3D node

2) select the newly created MeshInstance3D node and under Mesh select type of QuadMesh, change it`s size on x and y to 2m

3) under GeometryInstance3D, click on Material override and create a new ShaderMaterial, now drag and drop the shader into the dropdown

 

Shader code
shader_type spatial;
render_mode unshaded, depth_test_disabled, cull_disabled;


uniform sampler2D screen_texture : hint_screen_texture;
uniform float intensity : hint_range(0.0, 5.0, .01) =  1.0;
uniform float redness : hint_range(0, 1) = 1.0;

void vertex(){
	// needs to be 1.0
	VERTEX *= 1.0;
	// needs to be 1.0
	POSITION = vec4(VERTEX, 1.0);
}

void fragment() {
    vec2 texCoords = SCREEN_UV;
 	vec3 color = texture(screen_texture, SCREEN_UV).rgb;
	float lum = pow(dot(color, vec3(1.0, 0, 0)), 1.2);
 	vec3 red = vec3(color.r * color.g * color.b)/0.1 * lum;

	color = red * intensity;
	if (color.r > redness) {
		color.g = 0.0;
		color.b = 0.0;
	}
	ALBEDO = color;
}
Tags
red, sincity, VR, XR
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 digitaln8m4r3

Noir XR/VR Shader

Related shaders

Toon Shader

Albedo Terrain Mix Shader

Depth Edge Highlights Shader

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments