Premier commit

This commit is contained in:
2026-09-01 22:41:37 +02:00
commit 7cff988739
133 changed files with 6412 additions and 0 deletions
@@ -0,0 +1,61 @@
shader_type spatial;
render_mode unshaded, depth_draw_never, cull_disabled;
uniform float width = 15.0;
uniform float height = 15.0;
uniform float density = 5.0;
uniform float line_thickness = 0.1;
uniform vec4 line_color : source_color = vec4( 0.2, 1.0, 1.0, 1.0 );
uniform sampler2D depth_texture : source_color, hint_depth_texture;
uniform vec4 color1: source_color = vec4(1,1,1,.1);
uniform vec4 color2: source_color = vec4(1,1,1,1);
uniform float threshold = .2;
uniform float fresnel_sharpness = 1.0;
uniform float fresnel_factor = 1.0;
float hex_cells( vec2 uv )
{
float x = uv.x * width * density;
float y = mod( floor(x), 2.0 ) * 0.5 + ( uv.y * height ) * density;
vec2 base_chip = abs( vec2( 0.5 ) - mod( vec2( x, y ), 1.0 ) );
return abs( max( base_chip.x * 1.5 + base_chip.y, base_chip.y * 2.0 ) - 1.0 );
}
void fragment( )
{
float depth = texture(depth_texture, SCREEN_UV).x;
//vec3 ndc = vec3(SCREEN_UV, depth) * 2.0 - 1.0;
vec3 ndc = vec3(SCREEN_UV * 2.0 - 1.0, depth);
vec4 view = INV_PROJECTION_MATRIX * vec4(ndc, 1.0);
view.xyz /= view.w;
float linear_depth = -view.z;
float object_depth = FRAGCOORD.z;
//vec3 object_ndc = vec3(SCREEN_UV, object_depth) * 2.0 - 1.0;
vec3 object_ndc = vec3(SCREEN_UV * 2.0 - 1.0, object_depth);
vec4 object_view = INV_PROJECTION_MATRIX * vec4(object_ndc, 1.0);
object_view.xyz /= object_view.w;
float linear_object_depth = -object_view.z;
float fresnel = pow(1.0 - dot(VIEW, NORMAL), fresnel_sharpness) * fresnel_factor;
if (linear_depth - linear_object_depth > threshold) {
float hex = hex_cells( UV );
vec4 final_color = mix(
color1,
line_color,
float( hex < line_thickness )
);
ALBEDO = final_color.rgb;
ALPHA = final_color.a+(fresnel);
}
else {
ALBEDO = color2.rgb;
ALPHA = color2.a+fresnel;
}
}
@@ -0,0 +1 @@
uid://bdveg7wa4kl6y
+35
View File
@@ -0,0 +1,35 @@
shader_type spatial;
render_mode unshaded;
uniform sampler2D sky_texture : source_color;
uniform bool lock_aspect = false;
uniform float aspect_ratio = 1.3333333;
uniform vec2 fov = vec2(180.0, 90.0);
uniform ivec2 tiling = ivec2(1, 1);
uniform vec2 offset = vec2(0.0, 0.0);
// XY offset, ZW tiling
varying vec4 bg_coords;
void vertex() {
// Camera YX rotation per Basis.get_euler source code
float y = atan(VIEW_MATRIX[0][2], VIEW_MATRIX[2][2]);
float x = asin(VIEW_MATRIX[1][2]);
// Map rotation to screen space
bg_coords.xy = vec2(y * -0.5, x) / PI;
bg_coords.y += 0.5;
bg_coords.w = fov.y / 180.0;
bg_coords.z = !lock_aspect ? fov.x / 360.0 : VIEWPORT_SIZE.x / (VIEWPORT_SIZE.y * aspect_ratio) * bg_coords.w;
// Keep background centered vertically when FOV changes
bg_coords.y *= bg_coords.w > 1.0 ? 0.0 : 1.0 - bg_coords.w;
}
void fragment() {
vec2 uv_offset = vec2(-offset.x, offset.y);
vec2 uv = (SCREEN_UV + uv_offset) * bg_coords.zw + bg_coords.xy;
uv *= vec2(tiling);
ALBEDO = texture(sky_texture, uv).rgb;
}
@@ -0,0 +1 @@
uid://dm5226jwt11ae