Using viewport texture instead of manual rect blending

This commit is contained in:
Martin Felis
2024-01-27 01:15:01 +01:00
parent 4501b19bc4
commit 52e3db3041
8 changed files with 99 additions and 40 deletions
+1 -4
View File
@@ -1,6 +1,4 @@
[gd_resource type="StandardMaterial3D" load_steps=4 format=3 uid="uid://bg3dawo5kkosg"]
[ext_resource type="Material" uid="uid://c60s78p4g17ye" path="res://materials/WorldColoringMaterialPass.tres" id="1_3d3it"]
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://bg3dawo5kkosg"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_wonuc"]
noise_type = 0
@@ -16,7 +14,6 @@ normalize = false
noise = SubResource("FastNoiseLite_wonuc")
[resource]
next_pass = ExtResource("1_3d3it")
albedo_color = Color(0.113725, 0.431373, 0.266667, 0.933333)
albedo_texture = SubResource("NoiseTexture2D_iklfu")
uv1_scale = Vector3(20, 1, 20)
+7 -2
View File
@@ -11,9 +11,14 @@ 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);
vec4 playerColorationColor = 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;
vec3 desaturatedColor = vec3(dot(currentColor.rgb, colorToLuminance) * 0.4) + 0.1 * currentColor.rgb;
ALBEDO = desaturatedColor * (1.0 - playerColorationColor.a) + currentColor.rgb * playerColorationColor.a;
ALBEDO = desaturatedColor * (1.0 - playerColorationColor.a) + (playerColorationColor.rgb * 0.3 + currentColor.rgb * 0.7) * playerColorationColor.a;
}
//void light() {