Basing world coloring works.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
[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"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_wonuc"]
|
||||
noise_type = 0
|
||||
frequency = 0.014
|
||||
fractal_lacunarity = 3.0
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_iklfu"]
|
||||
width = 32
|
||||
height = 32
|
||||
seamless = true
|
||||
seamless_blend_skirt = 0.857
|
||||
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)
|
||||
uv1_triplanar = true
|
||||
texture_filter = 0
|
||||
@@ -0,0 +1,9 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://c60s78p4g17ye"]
|
||||
|
||||
[ext_resource type="Shader" path="res://materials/shader/WorldColoring.gdshader" id="1_ashe5"]
|
||||
[ext_resource type="Texture2D" uid="uid://b2c7rc40v7wfl" path="res://assets/textures/test_world_color_texture.png" id="2_60odu"]
|
||||
|
||||
[resource]
|
||||
render_priority = 1
|
||||
shader = ExtResource("1_ashe5")
|
||||
shader_parameter/world_color_texture = ExtResource("2_60odu")
|
||||
@@ -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.
|
||||
//}
|
||||
Reference in New Issue
Block a user