Area 2 all rooms preliminary lighting setup, a few with unapplied scale but maybe fine.

This commit is contained in:
Pal
2025-10-07 21:38:27 -07:00
parent 4c5281c852
commit 9ed5f8600c
43 changed files with 3963 additions and 1195 deletions

View File

@@ -1,63 +0,0 @@
shader_type particles;
//this defines how far out the particles will spawn
uniform float particle_diameter = 5.0f;
//input a value that changes over time and can also be a coordinate
//use vec(TIME,0) if you got no coordinates
float rand(vec2 co){
//this will give a pseudorandom value between 0-1
return fract(sin(dot(co.xy ,vec2(23.21,101.83))) * 34759.214);
}
void vertex(){
//this sets all the stuff necesary
//spawn them in a given radius around the emmitor
//set the position to be randomly dispersed in an area
float x_modifier = (rand(vec2(TIME,0))*particle_diameter);
float z_modifier = (rand(vec2(TIME+1f,0))*particle_diameter);
//centers effect
TRANSFORM[3][0] = x_modifier - 0.5f*particle_diameter;
TRANSFORM[3][2] = z_modifier- 0.5f*particle_diameter;
//VELOCITY.y = -rand(vec2(TIME+2f,0));
VELOCITY.y = -1f;
}
//apply a changing wind that changes with time with a noticable variation
VELOCITY.x = 3f*sin(TIME/4f)*sin(TIME)*rand(vec2(float(INDEX),0f));
VELOCITY.z = 3f*cos(TIME/4f)*cos(TIME)*rand(vec2(float(INDEX)+1f,0f));
//gives a consistent rotation that depends on the index
float x_rotation = TIME*rand(vec2(float(INDEX),0f));
float y_rotation = TIME*rand(vec2(float(INDEX)+1f,0f));
float z_rotation = TIME*rand(vec2(float(INDEX)+2f,0f));
//these just rotate the leaf using matrix math
//x rotation
TRANSFORM[1][1] = cos(x_rotation);
TRANSFORM[2][1] = -sin(x_rotation);
TRANSFORM[1][2] = sin(x_rotation);
TRANSFORM[2][2] = cos(x_rotation);
//y rotation
TRANSFORM[0][0] = cos(y_rotation);
TRANSFORM[2][0] = -sin(y_rotation);
TRANSFORM[0][2] = sin(y_rotation);
TRANSFORM[2][2] = cos(y_rotation);
//z rotation
TRANSFORM[0][0] = cos(z_rotation);
TRANSFORM[1][0] = -sin(z_rotation);
TRANSFORM[0][1] = sin(z_rotation);
TRANSFORM[1][1] = cos(z_rotation);
}

View File

@@ -1,46 +1,83 @@
shader_type spatial;
render_mode diffuse_burley, specular_schlick_ggx, blend_mix;
group_uniforms albedo;
uniform vec4 albedo : source_color = vec4(1.0, 1.0, 1.0, 0.0);
uniform sampler2D albedo_texture : source_color, hint_default_white;
uniform float Emission_Power = 1.0;
uniform vec3 Color:source_color;
group_uniforms roughness;
uniform float roughness : hint_range(0.0, 1.0) = 0.15;
uniform sampler2D roughness_texture : hint_roughness_r;
group_uniforms Fresnel;
uniform sampler2D Fresnel_Noise_Texture:source_color;
uniform vec3 Fresnel_Color : source_color;
uniform float Fresnel_Power : hint_range(0.1, 10.0) = 3.0;
group_uniforms normal;
uniform float normal_strength : hint_range(-16.0, 16.0) = 1.0;
uniform sampler2D normal_map : hint_normal;
group_uniforms Lines_Alpha;
uniform sampler2D Line_Texture:source_color;
uniform float Repetitions = 2.0;
uniform float Speed = 1.0;
group_uniforms misc;
uniform vec4 edge_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
group_uniforms Alpha_Fade;
uniform sampler2D Fade_Texture:source_color;
uniform float Fade_Offset = 0.0;
uniform float Fade_Scale = 1.0;
group_uniforms Lines_Color;
uniform sampler2D Color_Line_Texture:source_color;
uniform float Color_Line_Repetitions = 2.0;
uniform float Color_Line_Speed = 1.0;
group_uniforms Vertex_Shift;
uniform sampler2D Vertex_Shift_Texture:source_color;
uniform float Vertex_Shift_Repetitions = 2.0;
uniform float Vertex_Shift_Speed = 1.0;
uniform float Shift_Power = 0.2;
uniform float Shift_X_Mult = 1.0;
uniform float Shift_Z_Mult = 1.0;
varying vec3 Wave_WorldCoords;
void vertex() {
Wave_WorldCoords = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
vec2 uv = UV;
uv.y = Wave_WorldCoords.y;
uv.y = fract(uv.y * Vertex_Shift_Repetitions);
uv.y += fract(TIME * -Vertex_Shift_Speed);
float shift = texture(Vertex_Shift_Texture, uv).r * Shift_Power;
VERTEX.x += shift * Shift_X_Mult;
VERTEX.z += shift * Shift_Z_Mult;
float SchlickFresnel(float u) {
float m = 1.0 - u;
float m2 = m * m;
return m2 * m2 * m;
}
void fragment() {
// calculate fresnel values
float VdotN = dot(VIEW, NORMAL);
float fresnel = clamp(SchlickFresnel(VdotN), 0.0, 1.0);
float Fresnel = pow(1.0 - dot(NORMAL, VIEW), Fresnel_Power);
float Noise_Value = texture(Fresnel_Noise_Texture,UV).r;
float Noise_Fresnel = Fresnel * Noise_Value;
// sample and mix textures
vec4 _albedo = texture(albedo_texture, UV) * albedo;
float _roughness = texture(roughness_texture, UV).r * roughness;
vec3 Final_Color = mix(Color,Fresnel_Color,Noise_Fresnel);
// apply glass look
float a = mix(0.001, 1.0, _albedo.a);
ALPHA = mix(fresnel * edge_color.a, 1.0, a);
ALBEDO = mix(edge_color.rgb * edge_color.a, _albedo.rgb, a);
ROUGHNESS = _roughness;
NORMAL_MAP = texture(normal_map, UV).xyz;
NORMAL_MAP_DEPTH = normal_strength;
vec2 uv = UV;
uv.y = Wave_WorldCoords.y;
uv.y = fract(uv.y * Repetitions);
uv.y += fract(TIME * -Speed);
float Line_Alpha = texture(Line_Texture,uv).a;
// function to compensate specular for alpha blend
// 0.5 * ALPHA^-0.5
SPECULAR = 0.5 * inversesqrt(ALPHA);
}
vec2 uv2 = UV;
uv2.y = Wave_WorldCoords.y;
uv2.y = fract(uv2.y * Color_Line_Repetitions);
uv2.y += fract(TIME * -Color_Line_Speed);
vec3 Line_Color = texture(Color_Line_Texture,uv2).rgb;
Final_Color += Line_Color;
vec2 uv3 = UV;
uv3.y = (Wave_WorldCoords.y + Fade_Offset) * Fade_Scale;
float Fade_Value = texture(Fade_Texture,uv3).a;
ALBEDO = Final_Color;
EMISSION = Final_Color * Emission_Power;
ALPHA = Line_Alpha * Fade_Value;
}