Overworld Work, NPC Shaded, Unused Files Placed in New Folder
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,244 +0,0 @@
|
||||
shader_type spatial;
|
||||
render_mode world_vertex_coords, cull_disabled;
|
||||
|
||||
uniform sampler2D screen : hint_screen_texture, filter_linear_mipmap_anisotropic, repeat_disable;
|
||||
group_uniforms colours;
|
||||
uniform vec3 surfacecolour : source_color;
|
||||
uniform vec3 volumecolour : source_color;
|
||||
|
||||
group_uniforms material;
|
||||
uniform float AirIOR = 1.0;
|
||||
uniform float IOR = 1.33;
|
||||
|
||||
group_uniforms textures;
|
||||
uniform vec2 sampler1speed = vec2(0.02, 0.0);
|
||||
uniform vec2 sampler2speed = vec2(0.0, 0.02);
|
||||
uniform float samplermix : hint_range(0.0, 1.0, 0.1) = 0.5;
|
||||
uniform vec2 samplerscale = vec2(0.1);
|
||||
uniform sampler2D normal1tex : filter_linear_mipmap_anisotropic, hint_normal;
|
||||
uniform sampler2D normal2tex : filter_linear_mipmap_anisotropic, hint_normal;
|
||||
uniform float normalstrength : hint_range(0.0, 5.0, 0.01) = 1.0;
|
||||
uniform sampler2D height1tex : filter_linear_mipmap_anisotropic;
|
||||
uniform sampler2D height2tex : filter_linear_mipmap_anisotropic;
|
||||
uniform float heightstrength : hint_range(0.0, 5.0, 0.01) = 0.12;
|
||||
uniform sampler2D edge1tex : filter_linear_mipmap_anisotropic;
|
||||
uniform sampler2D edge2tex : filter_linear_mipmap_anisotropic;
|
||||
|
||||
varying vec2 position;
|
||||
varying vec3 wposition;
|
||||
|
||||
group_uniforms refraction;
|
||||
|
||||
uniform float refrationamount : hint_range(0.0, 1.0, 0.01);
|
||||
uniform bool fog_underwater;
|
||||
|
||||
group_uniforms edge;
|
||||
|
||||
uniform float edge_size : hint_range(0.01, 0.5, 0.01) = 0.1;
|
||||
uniform bool foam_or_fade = false;
|
||||
|
||||
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap, repeat_disable;
|
||||
|
||||
group_uniforms screen_space_reflection;
|
||||
|
||||
uniform float far_clip = 50.0;
|
||||
uniform int steps : hint_range(64, 1024, 16) = 512;
|
||||
uniform float ssr_screen_fade : hint_range(0.01, 0.5, 0.01) = 0.05;
|
||||
|
||||
float schlickfresnel(float ior1, float ior2, vec3 view, vec3 norm) {
|
||||
float incident = dot(view, norm);
|
||||
float reflectance = pow(((ior2 - ior1)/(ior2 + ior1)), 2.0);
|
||||
float fresnelincident = reflectance + (1.0 - reflectance) * pow(1.0 - cos(incident), 5.0);
|
||||
return(fresnelincident / incident);
|
||||
}
|
||||
|
||||
void vertex() {
|
||||
position = VERTEX.xz;
|
||||
UV = VERTEX.xz * samplerscale + (sampler1speed * TIME);
|
||||
UV2 = VERTEX.xz * samplerscale + (sampler2speed * TIME);
|
||||
float height = mix(texture(height1tex, UV),texture(height2tex, UV2),samplermix).x;
|
||||
VERTEX.y += (height - 0.5) * heightstrength;
|
||||
wposition = VERTEX;
|
||||
// Called for every vertex the material is visible on.
|
||||
}
|
||||
|
||||
float snells_window(vec3 normal, vec3 view, float ior) {
|
||||
float cos_theta = dot(normal, view);
|
||||
return step(sqrt(1.0 - cos_theta * cos_theta) * ior, 1.0);
|
||||
}
|
||||
|
||||
float linear_depth(float nonlinear_depth, mat4 inv_projection_matrix) {
|
||||
return 1.0 / (nonlinear_depth * inv_projection_matrix[2].w + inv_projection_matrix[3].w);
|
||||
}
|
||||
|
||||
float nonlinear_depth(float linear_depth, mat4 inv_projection_matrix) {
|
||||
return (1.0 / linear_depth - inv_projection_matrix[3].w) / inv_projection_matrix[2].w;
|
||||
}
|
||||
|
||||
vec2 view2uv(vec3 position_view_space, mat4 proj_m)
|
||||
{
|
||||
vec4 position_clip_space = proj_m * vec4(position_view_space.xyz, 1.0);
|
||||
vec2 position_ndc = position_clip_space.xy / position_clip_space.w;
|
||||
return position_ndc.xy * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
float remap(float x, float min1, float max1, float min2, float max2) {
|
||||
return ((x - min1) / (max1 - min1) + min2) * (max2 - min2);
|
||||
}
|
||||
float remap1(float x, float min1, float max1) {
|
||||
return (x - min1) / (max1 - min1);
|
||||
}
|
||||
|
||||
float edge_fade(vec2 uv, float size) {
|
||||
float x1 = clamp(remap1(uv.x, 0.0, size), 0.0, 1.0);
|
||||
float x2 = clamp(remap1(uv.x, 1.0, 1.0 - size), 0.0, 1.0);
|
||||
float y1 = clamp(remap1(uv.y, 0.0, size), 0.0, 1.0);
|
||||
float y2 = clamp(remap1(uv.y, 1.0, 1.0 - size), 0.0, 1.0);
|
||||
return x1*x2*y1*y2;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
|
||||
vec3 onorm = NORMAL;
|
||||
|
||||
vec2 normmap = mix(texture(normal1tex, UV),texture(normal2tex, UV2),samplermix).xy;
|
||||
NORMAL += TANGENT * (normmap.x - 0.5) * normalstrength;
|
||||
NORMAL += BINORMAL * (normmap.y - 0.5) * normalstrength;
|
||||
|
||||
vec3 wnorm = (vec4(NORMAL, 0.0) * VIEW_MATRIX).xyz;
|
||||
vec3 wview = (vec4(VIEW, 0.0) * VIEW_MATRIX).xyz;
|
||||
if (FRONT_FACING) {
|
||||
|
||||
ROUGHNESS = 0.0;
|
||||
METALLIC = 1.0;
|
||||
SPECULAR = 0.0;
|
||||
|
||||
float fres = schlickfresnel(AirIOR, IOR, VIEW, NORMAL);
|
||||
ALBEDO = surfacecolour * fres;
|
||||
|
||||
// REFRACTION
|
||||
|
||||
float lineardepth = linear_depth(texture(DEPTH_TEXTURE, SCREEN_UV).r, INV_PROJECTION_MATRIX);
|
||||
float selfdepth = -VERTEX.z;
|
||||
float depth_diff = lineardepth - selfdepth;
|
||||
vec3 tanx = BINORMAL * (normmap.x - 0.5) * normalstrength;
|
||||
vec3 tany = TANGENT * (normmap.y - 0.5) * normalstrength;
|
||||
vec2 refracted_uv = SCREEN_UV + (tanx + tany).xy * refrationamount * depth_diff / lineardepth;
|
||||
float newdepth = linear_depth(texture(DEPTH_TEXTURE, refracted_uv).r, INV_PROJECTION_MATRIX);
|
||||
//float selfdepth = 1.0/(1.0 + 2.0 * distance(wposition, CAMERA_POSITION_WORLD));
|
||||
vec3 newvolcolour = mix(volumecolour, vec3(1.0), clamp(1.0 / (depth_diff * 1.0), 0.0, 1.0));
|
||||
EMISSION = newvolcolour * texture(screen, refracted_uv).rgb;
|
||||
|
||||
if (newdepth < selfdepth) {
|
||||
EMISSION = newvolcolour * texture(screen, SCREEN_UV).rgb;
|
||||
}
|
||||
|
||||
// SSR
|
||||
|
||||
vec3 reflected = -reflect(VIEW, NORMAL);
|
||||
vec3 pos = VERTEX;
|
||||
int curstep = 0;
|
||||
bool finished = false;
|
||||
vec2 uv;
|
||||
float currentdepth;
|
||||
while (curstep < steps) {
|
||||
float step_scale = float(curstep + 1) / float(steps);
|
||||
float step_dist = step_scale * step_scale * far_clip;
|
||||
pos += reflected * step_dist;
|
||||
curstep += 1;
|
||||
currentdepth = -pos.z;
|
||||
uv = view2uv(pos, PROJECTION_MATRIX);
|
||||
if (!(uv.x < 1.0 && uv.y < 1.0 && uv.x > 0.0 && uv.y > 0.0)) {
|
||||
break;
|
||||
}
|
||||
float testdepth = linear_depth(texture(DEPTH_TEXTURE, uv).r, INV_PROJECTION_MATRIX);
|
||||
if (testdepth < currentdepth) {
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (finished && currentdepth < far_clip * 0.99) {
|
||||
ALBEDO *= 1.0 - edge_fade(uv, ssr_screen_fade);
|
||||
METALLIC *= 1.0 - edge_fade(uv, ssr_screen_fade);
|
||||
EMISSION += texture(screen, uv).xyz * schlickfresnel(1.0, 1.33, VIEW, NORMAL) * edge_fade(uv, ssr_screen_fade);
|
||||
}
|
||||
|
||||
// EDGE EFFECT
|
||||
|
||||
float distfromedge = depth_diff * dot(normalize(NORMAL), normalize(-VERTEX)) / VIEW.z;
|
||||
if (distfromedge < edge_size) {
|
||||
distfromedge /= edge_size;
|
||||
if (foam_or_fade) {
|
||||
ALPHA = distfromedge;
|
||||
} else {
|
||||
float edgetex = mix(texture(edge1tex, UV).r, texture(edge2tex, UV2).r, samplermix);
|
||||
if (edgetex > distfromedge) {
|
||||
ALBEDO = vec3(1.0);
|
||||
ROUGHNESS = 1.0;
|
||||
METALLIC = 1.0;
|
||||
EMISSION = vec3(0.0);
|
||||
NORMAL = onorm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// SNELLS WINDOW
|
||||
float window = snells_window(wnorm, wview, IOR);
|
||||
|
||||
if (window > 0.5) {
|
||||
ROUGHNESS = 1.0;
|
||||
METALLIC = 1.0;
|
||||
ALBEDO = vec3(0.0);
|
||||
SPECULAR = 0.0;
|
||||
float linear_depth = 1.0 / (texture(DEPTH_TEXTURE, SCREEN_UV).r * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
|
||||
float selfdepth = 1.0 / (FRAGCOORD.z * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
|
||||
float depth_diff = linear_depth - selfdepth;
|
||||
vec3 tanx = BINORMAL * (normmap.x - 0.5) * normalstrength;
|
||||
vec3 tany = TANGENT * (normmap.y - 0.5) * normalstrength;
|
||||
float newdepth = 1.0 / (texture(DEPTH_TEXTURE, SCREEN_UV + (tanx + tany).xy * refrationamount).r * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
|
||||
//float selfdepth = 1.0/(1.0 + 2.0 * distance(wposition, CAMERA_POSITION_WORLD));
|
||||
vec3 newvolcolour = mix(volumecolour, vec3(1.0), clamp(1.0 / (selfdepth * 1.0), 0.0, 1.0));
|
||||
if (!fog_underwater) {
|
||||
newvolcolour = vec3(1.0);
|
||||
}
|
||||
EMISSION = newvolcolour * texture(screen, SCREEN_UV + (tanx + tany).xy * refrationamount).rgb;
|
||||
} else {
|
||||
ALBEDO = surfacecolour;
|
||||
ROUGHNESS = 0.0;
|
||||
METALLIC = 1.0;
|
||||
|
||||
// SSR
|
||||
|
||||
vec3 reflected = -reflect(VIEW, NORMAL);
|
||||
vec3 pos = VERTEX;
|
||||
int curstep = 0;
|
||||
bool finished = false;
|
||||
vec2 uv;
|
||||
float currentdepth;
|
||||
while (curstep < steps) {
|
||||
float step_scale = float(curstep + 1) / float(steps);
|
||||
float step_dist = step_scale * step_scale * far_clip;
|
||||
pos += reflected * step_dist;
|
||||
curstep += 1;
|
||||
currentdepth = -pos.z;
|
||||
uv = view2uv(pos, PROJECTION_MATRIX);
|
||||
if (!(uv.x < 1.0 && uv.y < 1.0 && uv.x > 0.0 && uv.y > 0.0)) {
|
||||
break;
|
||||
}
|
||||
float testdepth = linear_depth(texture(DEPTH_TEXTURE, uv).r, INV_PROJECTION_MATRIX);
|
||||
if (testdepth < currentdepth) {
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (finished && currentdepth < far_clip * 0.99) {
|
||||
ALBEDO *= 1.0 - edge_fade(uv, ssr_screen_fade);
|
||||
METALLIC *= 1.0 - edge_fade(uv, ssr_screen_fade);
|
||||
EMISSION += texture(screen, uv).xyz * schlickfresnel(1.0, 1.33, VIEW, NORMAL) * edge_fade(uv, ssr_screen_fade);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://yagva4an6w2
|
||||
@@ -17,7 +17,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://dicwnhepupj5a" path="res://src/map/overworld/Models/Overworld_CLOUD_RINGS_OUTTER_33.png" id="15_8isf0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bs8a3hyubf521" path="res://src/map/overworld/Models/Overworld_makeshift_skybox_Cloudscape 3.png" id="16_8nnl3"]
|
||||
[ext_resource type="Shader" uid="uid://blrcjqdo7emhs" path="res://src/map/overworld/Models/water.gdshader" id="17_b53dq"]
|
||||
[ext_resource type="Shader" uid="uid://yagva4an6w2" path="res://src/map/overworld/Overworld Water.gdshader" id="17_q2pi3"]
|
||||
[ext_resource type="Shader" uid="uid://yagva4an6w2" path="res://src/map/map shaders/Overworld Water.gdshader" id="17_q2pi3"]
|
||||
[ext_resource type="Texture2D" uid="uid://cchqagfhsko0r" path="res://src/map/overworld/Models/Overworld_optimized_Pass 1_A1_eyeblock.png" id="18_r86sn"]
|
||||
[ext_resource type="Texture2D" uid="uid://bkly85kkv2gjs" path="res://src/map/overworld/Models/Overworld_optimized_Pass 1_concrete_0025_color_1k.jpg" id="19_0u0mt"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgx3b275abnwg" path="res://src/map/overworld/Models/Overworld_optimized_Pass 1_OW_Worked-Stone-Outside.png" id="20_4rcfa"]
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,86 +0,0 @@
|
||||
shader_type spatial;
|
||||
render_mode unshaded, depth_draw_never, cull_disabled;
|
||||
|
||||
uniform float noise_scale = 11.24;
|
||||
uniform float speed = 0.16;
|
||||
uniform float darkness_amount = 9.155;
|
||||
uniform float detail = 0.23;
|
||||
uniform float concentration = 0.0;
|
||||
uniform float amount = 0.12;
|
||||
uniform float bloom = 2.0;
|
||||
uniform float alpha = 8.0;
|
||||
uniform vec3 cloud_tint : source_color = vec3(1.0, 1.0, 1.0);
|
||||
uniform float edge_fade = -0.035;
|
||||
|
||||
uniform mat2 rotation_matrix = mat2(vec2(1.6, 1.2), vec2(-1.2, 1.6));
|
||||
|
||||
// --- Noise Functions ---
|
||||
vec2 hash(vec2 p) {
|
||||
p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));
|
||||
return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);
|
||||
}
|
||||
|
||||
float noise(vec2 p) {
|
||||
const float K1 = 0.366025404;
|
||||
const float K2 = 0.211324865;
|
||||
vec2 i = floor(p + (p.x + p.y) * K1);
|
||||
vec2 a = p - i + (i.x + i.y) * K2;
|
||||
vec2 o = (a.x > a.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
||||
vec2 b = a - o + K2;
|
||||
vec2 c = a - 1.0 + 2.0 * K2;
|
||||
vec3 h = max(0.5 - vec3(dot(a,a), dot(b,b), dot(c,c)), 0.0);
|
||||
vec3 n = h * h * h * h * vec3(dot(a, hash(i + 0.0)), dot(b, hash(i + o)), dot(c, hash(i + 1.0)));
|
||||
return dot(n, vec3(70.0));
|
||||
}
|
||||
|
||||
float fbm(vec2 n) {
|
||||
float total = 0.0;
|
||||
float amplitude = 0.1;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
total += noise(n) * amplitude;
|
||||
n = rotation_matrix * n;
|
||||
amplitude *= 0.4;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
// --- Main Fragment ---
|
||||
void fragment() {
|
||||
vec2 uv = UV;
|
||||
|
||||
// Animate clouds
|
||||
float time = TIME * (speed / 10.0);
|
||||
float q = fbm(uv * noise_scale * 0.5);
|
||||
|
||||
float r = 0.0;
|
||||
vec2 tuv = uv * noise_scale + q - time;
|
||||
float weight = 0.8;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
r += abs(weight * noise(tuv));
|
||||
tuv = rotation_matrix * tuv + time;
|
||||
weight *= 0.7;
|
||||
}
|
||||
|
||||
float f = 0.0;
|
||||
tuv = uv * noise_scale + q - time;
|
||||
weight = 0.7;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
f += weight * noise(tuv);
|
||||
tuv = rotation_matrix * tuv + time;
|
||||
weight *= 0.6;
|
||||
}
|
||||
|
||||
f *= r + f;
|
||||
|
||||
vec3 cloud_color = clamp(cloud_tint * (darkness_amount * detail * f), 0.0, 1.0) * bloom;
|
||||
|
||||
float cloud_strength = amount + alpha * f * r;
|
||||
cloud_strength = clamp(cloud_strength, 0.0, 1.0);
|
||||
|
||||
// --- Edge fade ---
|
||||
float edge_dist = distance(uv, vec2(0.5));
|
||||
float fade = smoothstep(edge_fade, 0.5, edge_dist);
|
||||
|
||||
ALBEDO = cloud_color;
|
||||
ALPHA = cloud_strength * (1.0 - fade) + concentration;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://b7cri8j6ev4bi
|
||||
Binary file not shown.
@@ -1,60 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://cvyi6iyeg5bmm"
|
||||
path="res://.godot/imported/block.blend-1f5384908d93f77089fae16111405003.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/map/overworld/block.blend"
|
||||
dest_files=["res://.godot/imported/block.blend-1f5384908d93f77089fae16111405003.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={
|
||||
"materials": {
|
||||
"Material": {
|
||||
"use_external/enabled": true,
|
||||
"use_external/path": "res://src/map/overworld/Textures/ruins2.tres"
|
||||
}
|
||||
}
|
||||
}
|
||||
blender/nodes/visible=0
|
||||
blender/nodes/active_collection_only=false
|
||||
blender/nodes/punctual_lights=true
|
||||
blender/nodes/cameras=true
|
||||
blender/nodes/custom_properties=true
|
||||
blender/nodes/modifiers=1
|
||||
blender/meshes/colors=false
|
||||
blender/meshes/uvs=true
|
||||
blender/meshes/normals=true
|
||||
blender/meshes/export_geometry_nodes_instances=false
|
||||
blender/meshes/tangents=true
|
||||
blender/meshes/skins=2
|
||||
blender/meshes/export_bones_deforming_mesh_only=false
|
||||
blender/materials/unpack_enabled=true
|
||||
blender/materials/export_materials=1
|
||||
blender/animation/limit_playback=true
|
||||
blender/animation/always_sample=true
|
||||
blender/animation/group_tracks=true
|
||||
Reference in New Issue
Block a user