new chunk
This commit is contained in:
117
Scenes/Chunk_Scene/Chunk/Campagna/Bamboo.gdshader
Normal file
117
Scenes/Chunk_Scene/Chunk/Campagna/Bamboo.gdshader
Normal file
@@ -0,0 +1,117 @@
|
||||
shader_type spatial;
|
||||
|
||||
// AGGIUNTA: cull_disabled (per vedere le foglie da entrambi i lati)
|
||||
// AGGIUNTA: depth_draw_opaque (per garantire che le ombre funzionino bene col taglio alpha)
|
||||
render_mode diffuse_toon, specular_disabled, ambient_light_disabled, cull_disabled, depth_draw_opaque;
|
||||
|
||||
group_uniforms Albedo_Settings;
|
||||
uniform vec4 albedo_color : source_color = vec4(1.0);
|
||||
uniform sampler2D albedo_texture : source_color, filter_nearest;
|
||||
uniform bool use_texture = true;
|
||||
uniform vec2 uv_scale = vec2(1.0, 1.0);
|
||||
uniform float palette_shift_y : hint_range(0.0, 1.0) = 0.0;
|
||||
|
||||
// ---> NUOVO SISTEMA: OPACITY (ALPHA SCISSOR) <---
|
||||
group_uniforms Opacity_Settings;
|
||||
uniform sampler2D opacity_texture : hint_default_white; // Metti qui la tua mappa in bianco e nero
|
||||
uniform float alpha_scissor_threshold : hint_range(0.0, 1.0) = 0.5; // Regola il "taglio" della foglia
|
||||
uniform bool use_albedo_alpha = false; // Spunta se hai fuso l'opacity nel canale Alpha del Base Color
|
||||
|
||||
group_uniforms Height_Gradient;
|
||||
global uniform vec4 global_gradient_color_top;
|
||||
global uniform vec4 global_gradient_color_bot;
|
||||
global uniform float global_gradient_intensity;
|
||||
|
||||
uniform float gradient_start_y = 0.0;
|
||||
uniform float gradient_end_y = 10.0;
|
||||
|
||||
group_uniforms Toon_Lighting;
|
||||
uniform float light_steps : hint_range(1.0, 10.0, 1.0) = 3.0;
|
||||
uniform float step_softness : hint_range(0.01, 1.0) = 0.1;
|
||||
uniform vec4 shadow_color : source_color = vec4(0.4, 0.4, 0.6, 1.0);
|
||||
uniform float shadow_offset : hint_range(-1.0, 1.0) = 0.0;
|
||||
uniform float cast_shadow_strength : hint_range(0.0, 1.0) = 0.6;
|
||||
|
||||
// ---> SISTEMA: GHIBLI DIRECTIONAL GLINT <---
|
||||
group_uniforms Ghibli_Directional_Glint;
|
||||
uniform bool use_ghibli_glint = true;
|
||||
uniform vec4 glint_color : source_color = vec4(1.0, 0.95, 0.85, 1.0);
|
||||
uniform float glint_intensity : hint_range(0.0, 10.0) = 1.0;
|
||||
uniform float glint_sharpness : hint_range(1.0, 128.0) = 32.0;
|
||||
|
||||
group_uniforms Emission_Settings;
|
||||
uniform vec4 emission_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
uniform float emission_energy : hint_range(0.0, 16.0) = 0.0;
|
||||
|
||||
varying float world_y;
|
||||
|
||||
void vertex() {
|
||||
world_y = (MODEL_MATRIX * vec4(VERTEX, 1.0)).y;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 final_uv = (UV * uv_scale) + vec2(0.0, palette_shift_y);
|
||||
vec4 tex = texture(albedo_texture, final_uv);
|
||||
|
||||
vec3 base_color = albedo_color.rgb;
|
||||
if (use_texture) base_color *= tex.rgb;
|
||||
|
||||
// ---> GESTIONE OPACITÀ <---
|
||||
float current_alpha = 1.0;
|
||||
if (use_albedo_alpha) {
|
||||
current_alpha = tex.a; // Usa l'alpha della texture base se combinato
|
||||
} else {
|
||||
vec4 opacity_tex = texture(opacity_texture, final_uv);
|
||||
current_alpha = opacity_tex.r; // Usa la mappa separata
|
||||
}
|
||||
|
||||
ALPHA = current_alpha;
|
||||
ALPHA_SCISSOR_THRESHOLD = alpha_scissor_threshold; // Applica il taglio netto!
|
||||
|
||||
// ---> FIX NORMALI PER LE FOGLIE <---
|
||||
// Dato che usiamo cull_disabled, dobbiamo invertire le normali quando
|
||||
// guardiamo il "retro" della foglia, altrimenti l'illuminazione sarà nera.
|
||||
if (!FRONT_FACING) {
|
||||
NORMAL = -NORMAL;
|
||||
}
|
||||
|
||||
float grad_factor = smoothstep(gradient_start_y, gradient_end_y, world_y);
|
||||
vec3 current_gradient_color = mix(global_gradient_color_bot.rgb, global_gradient_color_top.rgb, grad_factor);
|
||||
base_color = mix(base_color, current_gradient_color, global_gradient_intensity);
|
||||
|
||||
ALBEDO = base_color;
|
||||
EMISSION = emission_color.rgb * emission_energy;
|
||||
}
|
||||
|
||||
void light() {
|
||||
// GESTIONE ATTENUAZIONE E OMBRE (Anti-frittura con dither)
|
||||
float shadow_factor = mix(1.0 - cast_shadow_strength, 1.0, ATTENUATION);
|
||||
float cutoff_mask = smoothstep(0.0, 0.1, ATTENUATION);
|
||||
|
||||
float n_dot_l = dot(NORMAL, LIGHT);
|
||||
|
||||
// Anti-frittura dither
|
||||
float dither = fract(sin(dot(FRAGCOORD.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
||||
float intensity = (clamp(n_dot_l, 0.0, 1.0) * shadow_factor) + (dither - 0.5) * 0.02;
|
||||
|
||||
float raw_step = (intensity + shadow_offset) * light_steps;
|
||||
float lower_step = floor(raw_step);
|
||||
float fract_step = fract(raw_step);
|
||||
float soft_lerp = smoothstep(0.5 - step_softness, 0.5 + step_softness, fract_step);
|
||||
float stepped_intensity = (lower_step + soft_lerp) / light_steps;
|
||||
|
||||
// Colori finali Toon
|
||||
vec3 light_color_final = mix(shadow_color.rgb, vec3(1.1), clamp(stepped_intensity, 0.0, 1.0));
|
||||
DIFFUSE_LIGHT += (light_color_final * LIGHT_COLOR) * cutoff_mask;
|
||||
|
||||
// ---> GHIBLI DIRECTIONAL GLINT (Il segreto dei tetti) <---
|
||||
if (use_ghibli_glint) {
|
||||
float glint_raw = pow(max(0.0, n_dot_l), glint_sharpness);
|
||||
float glint_mask = smoothstep(0.5 - step_softness*0.5, 0.5 + step_softness*0.5, glint_raw);
|
||||
|
||||
glint_mask *= smoothstep(0.0, 0.1, n_dot_l);
|
||||
vec3 extra_sun_glint = glint_mask * glint_color.rgb * LIGHT_COLOR * glint_intensity * ATTENUATION;
|
||||
|
||||
DIFFUSE_LIGHT += extra_sun_glint;
|
||||
}
|
||||
}
|
||||
1
Scenes/Chunk_Scene/Chunk/Campagna/Bamboo.gdshader.uid
Normal file
1
Scenes/Chunk_Scene/Chunk/Campagna/Bamboo.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://deww3s4hramy4
|
||||
641
Scenes/Chunk_Scene/Chunk/Campagna/Chunk_C_L_3.tscn
Normal file
641
Scenes/Chunk_Scene/Chunk/Campagna/Chunk_C_L_3.tscn
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
748
Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_r_2.tscn
Normal file
748
Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_r_2.tscn
Normal file
File diff suppressed because one or more lines are too long
955
Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_r_3.tscn
Normal file
955
Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_r_3.tscn
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
743
Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_t_1_2.tscn
Normal file
743
Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_t_1_2.tscn
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -30,15 +30,23 @@
|
||||
[ext_resource type="Texture2D" uid="uid://bsabg0b27m7uw" path="res://Assets/Textures/Fuji.png" id="14_7j5hj"]
|
||||
[ext_resource type="Texture2D" uid="uid://m06lpixnkjdd" path="res://Assets/Textures/Fuji_1.png" id="15_u10x4"]
|
||||
[ext_resource type="Texture2D" uid="uid://bl08clorvfthf" path="res://Assets/Textures/Fuji_2.png" id="16_l1dl0"]
|
||||
[ext_resource type="PackedScene" uid="uid://birttctl11th8" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_l_1.tscn" id="16_tbvi6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bi12g5nj421jv" path="res://Scenes/Chunk_Scene/Chunk/Foresta/chunk_F_e_1.tscn" id="16_vpybn"]
|
||||
[ext_resource type="PackedScene" uid="uid://dqjmjner67akh" path="res://Scenes/Chunk_Scene/Chunk/Campagna/Chunk_C_L_3.tscn" id="17_4udcq"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://dp5c3nqdvnsv0" path="res://Assets/Test/Demo/flower.res" id="17_kjb07"]
|
||||
[ext_resource type="PackedScene" uid="uid://d12t04rs47jq3" path="res://Scenes/Test/Tree_V1.tscn" id="18_on20a"]
|
||||
[ext_resource type="PackedScene" uid="uid://rtvd3odinnux" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_r_3.tscn" id="18_vj0n5"]
|
||||
[ext_resource type="PackedScene" uid="uid://gpn4jeplrm2n" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_r_2.tscn" id="19_00nhk"]
|
||||
[ext_resource type="Shader" uid="uid://cglb64vpwpgpu" path="res://Shaders/Water2.gdshader" id="19_6k3cw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bp5gnv0noxcpc" path="res://Scenes/Test/Scogliera_Blockout.tscn" id="20_16mw0"]
|
||||
[ext_resource type="PackedScene" uid="uid://badmwcxptjfvo" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_r_1.tscn" id="20_vpybn"]
|
||||
[ext_resource type="PackedScene" uid="uid://r7gp3qvjpehw" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_t_1_1.tscn" id="21_j2rq4"]
|
||||
[ext_resource type="TubeTrailMesh" uid="uid://2wmnftxwg8wt" path="res://Assets/Meshes/Wind.tres" id="21_l1dl0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dk85mk0hapngf" path="res://Assets/Test/rock2.glb" id="21_qdxup"]
|
||||
[ext_resource type="PackedScene" uid="uid://w110nccdhjvt" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_t_1_2.tscn" id="22_eyx0r"]
|
||||
[ext_resource type="Shader" uid="uid://c0dy1aqj1b4q3" path="res://Shaders/trunk_shader.gdshader" id="22_tbvi6"]
|
||||
[ext_resource type="Texture2D" uid="uid://8sdgkykyg5l5" path="res://Assets/Textures/rock_color.png" id="23_4udcq"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3l7mu5ompcb6" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_t_3_1.tscn" id="23_eyx0r"]
|
||||
[ext_resource type="Shader" uid="uid://b164wpqylv5fo" path="res://Shaders/Fog.gdshader" id="23_u10x4"]
|
||||
[ext_resource type="PackedScene" uid="uid://jj15telqu3rp" path="res://Scenes/Test/Grass_Test.tscn" id="24_vj0n5"]
|
||||
[ext_resource type="PackedScene" uid="uid://bioksfn7mydfa" path="res://Assets/Test/Demo/Tree_V2.glb" id="25_00nhk"]
|
||||
@@ -126,7 +134,7 @@ size = Vector2(2, 2)
|
||||
[sub_resource type="Resource" id="Resource_5lko7"]
|
||||
script = ExtResource("11_vpybn")
|
||||
nome_bioma = "Campagna"
|
||||
chunk_disponibili = Array[PackedScene]([ExtResource("13_6k3cw"), ExtResource("35_n33lw")])
|
||||
chunk_disponibili = Array[PackedScene]([ExtResource("13_6k3cw"), ExtResource("35_n33lw"), ExtResource("16_tbvi6"), ExtResource("17_4udcq"), ExtResource("18_vj0n5"), ExtResource("19_00nhk"), ExtResource("20_vpybn"), ExtResource("21_j2rq4"), ExtResource("22_eyx0r"), ExtResource("23_eyx0r")])
|
||||
metadata/_custom_type_script = "uid://c02bewqxt2epg"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_j2rq4"]
|
||||
@@ -877,11 +885,10 @@ transform = Transform3D(0.08715579, -0.91147786, 0.4020097, 0, 0.4035453, 0.9149
|
||||
light_indirect_energy = 0.0
|
||||
light_volumetric_fog_energy = 0.0
|
||||
shadow_enabled = true
|
||||
shadow_bias = 0.055
|
||||
shadow_normal_bias = 0.0
|
||||
shadow_opacity = 0.98
|
||||
shadow_blur = 2.198
|
||||
directional_shadow_fade_start = 0.647
|
||||
shadow_normal_bias = 4.0
|
||||
shadow_opacity = 0.97
|
||||
shadow_blur = 0.5
|
||||
directional_shadow_fade_start = 1.0
|
||||
directional_shadow_max_distance = 200.0
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=395116482]
|
||||
|
||||
Reference in New Issue
Block a user