initial commit

This commit is contained in:
pennyrigate 2025-08-04 00:39:07 -04:00
commit cffda6e18e
58 changed files with 10952 additions and 0 deletions

View file

@ -0,0 +1,121 @@
[gd_scene load_steps=15 format=3 uid="uid://cpw3h80y7gl2o"]
[ext_resource type="Texture2D" uid="uid://xhjx1xkwj7xt" path="res://Thumbnail.png" id="1_mesaj"]
[ext_resource type="Shader" path="res://psx_camera/psx_camera_shader.gdshader" id="1_nv63b"]
[ext_resource type="Script" path="res://psx_camera/fly_camera.gd" id="3_4w045"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_lialc"]
[sub_resource type="Sky" id="Sky_n7fr2"]
sky_material = SubResource("ProceduralSkyMaterial_lialc")
[sub_resource type="Environment" id="Environment_nd8w7"]
background_mode = 2
sky = SubResource("Sky_n7fr2")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ndpt6"]
albedo_color = Color(0.423529, 0.423529, 0.423529, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ji24u"]
albedo_color = Color(1, 0.341176, 0.227451, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_on2fo"]
albedo_color = Color(0.439216, 0.905882, 0.411765, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_daf8o"]
albedo_color = Color(0.129412, 0.337255, 0.6, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_r7yvx"]
albedo_texture = ExtResource("1_mesaj")
[sub_resource type="PlaneMesh" id="PlaneMesh_7lkts"]
size = Vector2(40, 40)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2rap5"]
render_priority = 0
shader = ExtResource("1_nv63b")
shader_parameter/enable_fog = true
shader_parameter/fog_color = Color(0.729412, 0.729412, 0.729412, 1)
shader_parameter/noise_color = null
shader_parameter/fog_distance = 100.0
shader_parameter/fog_fade_range = 50.0
shader_parameter/enable_noise = false
shader_parameter/noise_time_fac = 4.0
shader_parameter/enable_color_limitation = true
shader_parameter/color_levels = 32
shader_parameter/enable_dithering = false
shader_parameter/dither_strength = 0.3
[sub_resource type="QuadMesh" id="QuadMesh_afu2w"]
material = SubResource("ShaderMaterial_2rap5")
flip_faces = true
size = Vector2(2, 2)
[node name="CameraExample" type="Node3D"]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_nd8w7")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="WorldEnvironment"]
transform = Transform3D(-0.5, -0.866025, 0, -0.433013, 0.25, 0.866025, -0.75, 0.433013, -0.5, 0, 0, 0)
[node name="Ground" type="CSGBox3D" parent="."]
size = Vector3(100, 0.5, 100)
material = SubResource("StandardMaterial3D_ndpt6")
[node name="CSGBox3D" type="CSGBox3D" parent="Ground"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -23.0747, 4.39386, -20.6396)
size = Vector3(2, 10, 2)
material = SubResource("StandardMaterial3D_ji24u")
[node name="CSGBox3D2" type="CSGBox3D" parent="Ground"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -24.1164, 2.76483, 1.43046)
size = Vector3(2, 10, 2)
material = SubResource("StandardMaterial3D_ji24u")
[node name="CSGBox3D3" type="CSGBox3D" parent="Ground"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -29.5345, 2.76483, -11.7604)
size = Vector3(2, 10, 2)
material = SubResource("StandardMaterial3D_ji24u")
[node name="CSGBox3D4" type="CSGBox3D" parent="Ground"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.7025, 2.76483, -17.091)
size = Vector3(2, 10, 2)
material = SubResource("StandardMaterial3D_ji24u")
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Ground"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.94478, 2.21119, 0.607769)
radius = 1.634
height = 9.699
material = SubResource("StandardMaterial3D_on2fo")
[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="Ground"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14.715, 4.30806, -17.2889)
radius = 1.634
height = 9.699
material = SubResource("StandardMaterial3D_on2fo")
[node name="CSGCylinder3D3" type="CSGCylinder3D" parent="Ground"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.9614, 4.30806, 13.0696)
radius = 1.634
height = 9.699
material = SubResource("StandardMaterial3D_on2fo")
[node name="CSGBox3D5" type="CSGBox3D" parent="Ground"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 16.0303, 2.07957, 4.96235)
size = Vector3(4, 4, 4)
material = SubResource("StandardMaterial3D_daf8o")
[node name="CSGBox3D6" type="MeshInstance3D" parent="Ground"]
transform = Transform3D(-1, -8.74228e-08, -4.37114e-08, 4.37114e-08, 1.91069e-15, -1, 8.74228e-08, -1, 1.91069e-15, 40.0303, 19.6051, 33.7786)
material_override = SubResource("StandardMaterial3D_r7yvx")
mesh = SubResource("PlaneMesh_7lkts")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(0.565125, 0, 0.825005, 0, 1, 0, -0.825005, 0, 0.565125, 21.597, 19.8935, 18.5922)
script = ExtResource("3_4w045")
max_speed = 100.0
[node name="PSXMesh" type="MeshInstance3D" parent="Camera3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0763102, 0, -0.55748)
mesh = SubResource("QuadMesh_afu2w")

47
psx_camera/fly_camera.gd Normal file
View file

@ -0,0 +1,47 @@
extends Camera3D
@export_range(0, 10, 0.01) var sensitivity : float = 3
@export_range(0, 1000, 0.1) var default_velocity : float = 5
@export_range(0, 10, 0.01) var speed_scale : float = 1.17
@export_range(1, 100, 0.1) var boost_speed_multiplier : float = 3.0
@export var max_speed : float = 1000
@export var min_speed : float = 0.2
@onready var _velocity = default_velocity
func _input(event):
if not current:
return
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
if event is InputEventMouseMotion:
rotation.y -= event.relative.x / 1000 * sensitivity
rotation.x -= event.relative.y / 1000 * sensitivity
rotation.x = clamp(rotation.x, PI/-2, PI/2)
if event is InputEventMouseButton:
match event.button_index:
MOUSE_BUTTON_RIGHT:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED if event.pressed else Input.MOUSE_MODE_VISIBLE)
MOUSE_BUTTON_WHEEL_UP: # increase fly velocity
_velocity = clamp(_velocity * speed_scale, min_speed, max_speed)
MOUSE_BUTTON_WHEEL_DOWN: # decrease fly velocity
_velocity = clamp(_velocity / speed_scale, min_speed, max_speed)
if event is InputEventKey:
if event.pressed and event.keycode == KEY_ESCAPE:
get_tree().quit()
func _process(delta):
if not current:
return
var direction = Vector3(
float(Input.is_physical_key_pressed(KEY_D)) - float(Input.is_physical_key_pressed(KEY_A)),
float(Input.is_physical_key_pressed(KEY_E)) - float(Input.is_physical_key_pressed(KEY_Q)),
float(Input.is_physical_key_pressed(KEY_S)) - float(Input.is_physical_key_pressed(KEY_W))
).normalized()
if Input.is_physical_key_pressed(KEY_SHIFT): # boost
translate(direction * _velocity * delta * boost_speed_multiplier)
else:
translate(direction * _velocity * delta)

View file

@ -0,0 +1 @@
uid://drcrxbadq7j2s

View file

@ -0,0 +1,80 @@
shader_type spatial;
render_mode cull_disabled, unshaded;
uniform sampler2D depth_texture : source_color, hint_depth_texture;
uniform sampler2D screen_texture : source_color, hint_screen_texture, repeat_disable, filter_nearest;
uniform bool enable_fog = true;
uniform vec3 fog_color : source_color;
uniform vec3 noise_color : source_color;
uniform float fog_distance : hint_range(1, 6000) = 100;
uniform float fog_fade_range : hint_range(1, 6000) = 50;
uniform bool enable_noise = true;
uniform float noise_time_fac : hint_range(0.1, 10) = 4;
uniform bool enable_color_limitation = true;
uniform int color_levels : hint_range(2, 256) = 32;
uniform bool enable_dithering = true;
uniform float dither_strength : hint_range(0.0, 1.0) = 0.3;
float hashOld12(vec2 p){
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453 + (TIME / noise_time_fac)) ;
}
vec3 color_mix(vec3 a, vec3 b, float f ){
f = clamp(abs(f), 0,1);
float invf = 1.0 - f;
return (a*f) + (b*invf);
}
vec3 quantize_color(vec3 color, int levels) {
float quantizer = float(levels - 1);
return floor(color * quantizer + 0.5) / quantizer;
}
float dither(vec2 position, float brightness) {
int x = int(mod(position.x, 4.0));
int y = int(mod(position.y, 4.0));
int index = x + y * 4;
float dithering[16] = float[](
0.0, 0.5, 0.125, 0.625,
0.75, 0.25, 0.875, 0.375,
0.1875, 0.6875, 0.0625, 0.5625,
0.9375, 0.4375, 1.0, 0.8125
);
float threshold = dithering[index];
return brightness < threshold ? 0.0 : 1.0;
}
void vertex() {
POSITION = vec4(VERTEX.xy, 1.0, 1.0);
}
void fragment(){
vec3 screen_color = texture(screen_texture, SCREEN_UV).rgb;
vec2 screen_coords = SCREEN_UV * 2.0 - 1.0;
float depth = texture(depth_texture, SCREEN_UV).x;
vec3 ndc = vec3(screen_coords, depth);
vec4 view = INV_PROJECTION_MATRIX * vec4(ndc, 1.0);
view.xyz /= view.w;
float linear_depth = -view.z;
float depth_mask_inv = clamp((linear_depth - (fog_distance - fog_fade_range)) / fog_fade_range, 0.0, 1.0);
vec3 final_color = screen_color;
if (enable_noise){
vec3 twocolornoise = color_mix(fog_color, noise_color, hashOld12(screen_coords));
final_color = color_mix(twocolornoise, final_color, depth_mask_inv);
}
if (enable_fog){
final_color = color_mix(fog_color, final_color, depth_mask_inv);
}
if (enable_color_limitation){
final_color = quantize_color(final_color, color_levels);
}
if (enable_dithering){
float brightness = dot(final_color, vec3(0.3, 0.59, 0.11));
brightness += dither_strength * (dither(FRAGCOORD.xy, brightness) - 0.5);
final_color *= (1.0 + dither_strength * (dither(FRAGCOORD.xy, brightness) - 0.5));
}
ALBEDO = final_color;
}

View file

@ -0,0 +1 @@
uid://c1ws5xtabtopc