This commit is contained in:
2026-02-10 06:09:33 +01:00
commit 2fa0d1da53
49 changed files with 1341 additions and 0 deletions

52
Sky/sky_sphere_spinner.gd Normal file
View File

@@ -0,0 +1,52 @@
extends Node3D
@export var base_spin_speed := 0.05 # Slow ambient rotation
@export var beat_boost := 0.2 # How much faster it spins with bass
@export var smoothness := 0.05 # Controls smoothing of the beat signal
@export var music_bus := "MusicBus" # Audio bus with the SpectrumAnalyzer
@onready var analyzer = AudioServer.get_bus_effect_instance(
AudioServer.get_bus_index(music_bus), 0
)
# Reference to your mesh
@onready var mesh: MeshInstance3D = $Sketchfab_model/SphereTest_fbx/RootNode/pSphere1/pSphere1_lambert2_0
var smoothed_bass := 0.0
var mat: Material = null
func _ready() -> void:
if mesh:
# Duplicate the material so its safe to modify
var original_mat = mesh.get_active_material(0)
if original_mat:
mat = original_mat.duplicate()
mesh.set_surface_override_material(0, mat)
else:
push_warning("Mesh has no material!")
else:
push_error("Mesh path is incorrect!")
func _process(delta: float) -> void:
if not analyzer:
return
# Measure low frequencies for the "beat"
var bass = analyzer.get_magnitude_for_frequency_range(20, 200)
var bass_strength = bass.length() * 5.0
# Smooth out the data
smoothed_bass = lerp(smoothed_bass, bass_strength, smoothness)
# Determine final spin speed
var spin_speed = base_spin_speed + smoothed_bass * beat_boost
# Apply slow rotation around Y axis (typical for skyboxes)
rotation.y += spin_speed * delta
# Optionally, adjust shader/material color or parameter
if mat and mat is StandardMaterial3D:
var brightness = 0.6 + smoothed_bass * 0.3
mat.albedo_color = Color(brightness, brightness, brightness)
elif mat and mat is ShaderMaterial:
mat.set_shader_parameter("intensity", 1.0 + smoothed_bass * 0.5)

View File

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

BIN
Sky/sky_sphere_test.glb Normal file

Binary file not shown.

View File

@@ -0,0 +1,42 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://c58bpp6oc5ffy"
path="res://.godot/imported/sky_sphere_test.glb-a13f0a40180ef627fba27ab893bf5c48.scn"
[deps]
source_file="res://Sky/sky_sphere_test.glb"
dest_files=["res://.godot/imported/sky_sphere_test.glb-a13f0a40180ef627fba27ab893bf5c48.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
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=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
gltf/naming_version=2
gltf/embedded_image_handling=1

BIN
Sky/sky_sphere_test_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

View File

@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cdaervqwdwon"
path.s3tc="res://.godot/imported/sky_sphere_test_0.png-d3f1a99dcb68be6ef5feb664efae02b8.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "738f338442a0cab90196205043e2038b"
}
[deps]
source_file="res://Sky/sky_sphere_test_0.png"
dest_files=["res://.godot/imported/sky_sphere_test_0.png-d3f1a99dcb68be6ef5feb664efae02b8.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0