Basing world coloring works.

This commit is contained in:
Martin Felis
2024-01-27 00:05:04 +01:00
parent 00d3088e21
commit 4501b19bc4
16 changed files with 318 additions and 51 deletions
+22
View File
@@ -0,0 +1,22 @@
shader_type spatial;
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
uniform sampler2D world_color_texture : hint_default_black, repeat_disable;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
vec4 projected_coords = INV_VIEW_MATRIX * vec4(VERTEX, 1.0);
vec4 currentColor = textureLod(screen_texture, SCREEN_UV, 0.0);
vec4 worldColor = textureLod(world_color_texture, projected_coords.xz * 0.01 + vec2(0.5), 0.0);
vec3 colorToLuminance = vec3(0.2126, 0.7152, 0.0722);
ALBEDO = vec3(dot(currentColor.rgb, colorToLuminance) * 0.4) + 0.2 * currentColor.rgb + 0.4 * worldColor.rgb;
}
//void light() {
// Called for every pixel for every light affecting the material.
// Uncomment to replace the default light processing function with this one.
//}