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;
}
thank you very much good ser.