Noir XR/VR Shader

a black & white shader

 

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;

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);
	float brightness = (color.r * color.g * color.b)/0.1;
	vec3 grayScale = vec3(brightness, brightness, brightness);
	color = grayScale;
	ALBEDO = color.rgb * lum;
}
Tags
black and white, Mono, Noir, 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

GodotCity XR/VR Shader

Related shaders

Toon Shader

Albedo Terrain Mix Shader

Depth Edge Highlights Shader

Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
someone
someone
10 months ago

thank you very much good ser.