new battery model with shaders

This commit is contained in:
Nikolai Fesenko
2025-08-16 01:05:24 +02:00
parent d7a9dc76dc
commit f323ae8d3d
25 changed files with 3967 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,53 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://ctkd5m6b0sbwu"
path="res://.godot/imported/Battery.blend-e6f43aa3ab206a6c91aef12725d95285.scn"
[deps]
source_file="res://Blends/Battery/Battery.blend"
dest_files=["res://.godot/imported/Battery.blend-e6f43aa3ab206a6c91aef12725d95285.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={}
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

Binary file not shown.

View File

@@ -0,0 +1,52 @@
# Blender 4.5.1 LTS MTL File: 'Battery.blend'
# www.blender.org
newmtl buttons
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800308 0.072378 0.092298
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
newmtl fuse
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.013768 0.000000 0.800189
Ks 0.500000 0.500000 0.500000
Ke 5.000000 5.000000 5.000000
Ni 1.500000
d 1.000000
illum 2
newmtl glass
Ns 360.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl handle
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800876 0.064643 0.042197
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
newmtl metal
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.177094 0.177094 0.177094
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 3

3546
Blends/Battery/Battery.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://cvgyv0qygl2g2"
path="res://.godot/imported/Battery.obj-1a31bf9ab8ab1fa286f56e7897c47336.mesh"
[deps]
files=["res://.godot/imported/Battery.obj-1a31bf9ab8ab1fa286f56e7897c47336.mesh"]
source_file="res://Blends/Battery/Battery.obj"
dest_files=["res://.godot/imported/Battery.obj-1a31bf9ab8ab1fa286f56e7897c47336.mesh", "res://.godot/imported/Battery.obj-1a31bf9ab8ab1fa286f56e7897c47336.mesh"]
[params]
generate_tangents=true
generate_lods=true
generate_shadow_mesh=true
generate_lightmap_uv2=false
generate_lightmap_uv2_texel_size=0.2
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
force_disable_mesh_compression=false

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bj51qjpaab1ls"
path.s3tc="res://.godot/imported/glass_color.png-2c1f2466ab9805c46b0f5b65a97fabf8.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Blends/Battery/glass_color.png"
dest_files=["res://.godot/imported/glass_color.png-2c1f2466ab9805c46b0f5b65a97fabf8.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c1jvi1yg7hrir"
path.s3tc="res://.godot/imported/glass_normal.png-d0c924a1e6631848692cad2510535f7f.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Blends/Battery/glass_normal.png"
dest_files=["res://.godot/imported/glass_normal.png-d0c924a1e6631848692cad2510535f7f.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://Blends/Battery/glass_normal.png"
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bp0wjmpltefe"
path.s3tc="res://.godot/imported/meta_color.png-e11a36fc6cf0e461c4fefb1072264798.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Blends/Battery/meta_color.png"
dest_files=["res://.godot/imported/meta_color.png-e11a36fc6cf0e461c4fefb1072264798.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
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/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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bo3m6u0wvb208"
path.s3tc="res://.godot/imported/metal_normal.png-42d9a69064ee5f3b6ff53cc3181cb54c.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Blends/Battery/metal_normal.png"
dest_files=["res://.godot/imported/metal_normal.png-42d9a69064ee5f3b6ff53cc3181cb54c.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://Blends/Battery/metal_normal.png"
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

View File

@@ -0,0 +1,65 @@
[gd_scene load_steps=18 format=3 uid="uid://wr21rggawosn"]
[ext_resource type="Script" uid="uid://c61rr6to3q566" path="res://Scripts/build_object.gd" id="1_c0yqx"]
[ext_resource type="ArrayMesh" uid="uid://cvgyv0qygl2g2" path="res://Blends/Battery/Battery.obj" id="1_lt2ya"]
[ext_resource type="Shader" uid="uid://bfv6ckihralab" path="res://Shaders/build_transparent.gdshader" id="2_pigwg"]
[ext_resource type="Texture2D" uid="uid://bp0wjmpltefe" path="res://Blends/Battery/meta_color.png" id="2_teewy"]
[ext_resource type="Texture2D" uid="uid://c1jvi1yg7hrir" path="res://Blends/Battery/glass_normal.png" id="3_c0yqx"]
[ext_resource type="Shader" uid="uid://derm5u32om74e" path="res://Shaders/battery_button.gdshader" id="4_pigwg"]
[ext_resource type="Shader" uid="uid://csc12sk3jp67" path="res://Shaders/battery_handle.gdshader" id="5_6tv3k"]
[ext_resource type="Shader" uid="uid://xn2eixgmefs8" path="res://Shaders/battery_glass.gdshader" id="6_b5dta"]
[ext_resource type="Shader" uid="uid://4m7bv5x2pfnr" path="res://Shaders/Fuse.gdshader" id="7_hr37j"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_6tv3k"]
render_priority = 0
shader = ExtResource("2_pigwg")
shader_parameter/color = Vector3(0, 0, 0)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_byy4f"]
albedo_texture = ExtResource("2_teewy")
metallic = 1.0
roughness = 0.5
normal_enabled = true
normal_scale = 0.27
normal_texture = ExtResource("3_c0yqx")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3e286"]
render_priority = 0
shader = ExtResource("4_pigwg")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_5xoxg"]
render_priority = 0
shader = ExtResource("5_6tv3k")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wr5rf"]
render_priority = 0
shader = ExtResource("6_b5dta")
shader_parameter/normal = ExtResource("3_c0yqx")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_8a881"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_fdnlq"]
noise = SubResource("FastNoiseLite_8a881")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hnq8j"]
render_priority = 0
shader = ExtResource("7_hr37j")
shader_parameter/noise = SubResource("NoiseTexture2D_fdnlq")
[node name="Battery" type="Node3D" node_paths=PackedStringArray("meshInstance")]
script = ExtResource("1_c0yqx")
meshInstance = NodePath("Battery")
preview_shader = SubResource("ShaderMaterial_6tv3k")
[node name="Battery" type="MeshInstance3D" parent="."]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, -1.9615, 0)
mesh = ExtResource("1_lt2ya")
surface_material_override/0 = SubResource("StandardMaterial3D_byy4f")
surface_material_override/1 = SubResource("ShaderMaterial_3e286")
surface_material_override/2 = SubResource("ShaderMaterial_5xoxg")
surface_material_override/3 = SubResource("ShaderMaterial_wr5rf")
surface_material_override/4 = SubResource("ShaderMaterial_hnq8j")
surface_material_override/5 = SubResource("StandardMaterial3D_byy4f")
surface_material_override/6 = SubResource("ShaderMaterial_wr5rf")
surface_material_override/7 = SubResource("ShaderMaterial_hnq8j")
surface_material_override/8 = SubResource("StandardMaterial3D_byy4f")

View File

@@ -69,5 +69,13 @@ text = "Pot"
script = ExtResource("1_yp16r")
id = 1
[node name="ButtonCreatePot2" type="Button" parent="Panel2/HBoxContainer"]
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
text = "Battery"
script = ExtResource("1_yp16r")
id = 2
[connection signal="pressed" from="Panel2/HBoxContainer/ButtonCreateBed" to="Panel2/HBoxContainer/ButtonCreateBed" method="_on_pressed"]
[connection signal="pressed" from="Panel2/HBoxContainer/ButtonCreatePot" to="Panel2/HBoxContainer/ButtonCreatePot" method="_on_pressed"]
[connection signal="pressed" from="Panel2/HBoxContainer/ButtonCreatePot2" to="Panel2/HBoxContainer/ButtonCreatePot2" method="_on_pressed"]

View File

@@ -2,6 +2,7 @@ extends Node
@onready var DoubleBeds = preload("res://Scenes/Prefabs/DoubleBeds.tscn")
@onready var Pot = preload("res://Scenes/Prefabs/Pot.tscn")
@onready var Battery = preload("res://Scenes/Prefabs/Battery.tscn")
signal build_object_selected
@@ -23,6 +24,8 @@ func get_preview_object():
selected_object = DoubleBeds
1:
selected_object = Pot
2:
selected_object = Battery
return selected_object

22
Shaders/Fuse.gdshader Normal file
View File

@@ -0,0 +1,22 @@
shader_type spatial;
uniform sampler2D noise;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
//ALBEDO = vec3(0.000275,0.0,0.665027);
EMISSION = vec3(0.0,0.0,1.0);
if( TIME < 1800.0 ) {
ALBEDO = texture(noise,UV + TIME / 5.0).rgb;
}
else {
ALBEDO = texture(noise,UV - TIME).rgb;
}
}
//void light() {
// // Called for every pixel for every light affecting the material.
// // Uncomment to replace the default light processing function with this one.
//}

View File

@@ -0,0 +1 @@
uid://4m7bv5x2pfnr

View File

@@ -0,0 +1,15 @@
shader_type spatial;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
ALBEDO = vec3(1.0,0.0,0.0);
EMISSION = vec3(1.0,0.0,0.0);
}
//void light() {
// // Called for every pixel for every light affecting the material.
// // Uncomment to replace the default light processing function with this one.
//}

View File

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

View File

@@ -0,0 +1,17 @@
shader_type spatial;
uniform sampler2D normal;
uniform sampler2D color;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
ALBEDO = vec3(0.1,0.1,0.1);
NORMAL = texture(normal,UV).rgb;
ALPHA = 0.4;
}
//void light() {
// // Called for every pixel for every light affecting the material.
// // Uncomment to replace the default light processing function with this one.
//}

View File

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

View File

@@ -0,0 +1,17 @@
shader_type spatial;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
ALBEDO = vec3(0.5,0.5,0.5);
METALLIC = 1.0;
ROUGHNESS = 0.3;
}
//void light() {
// // Called for every pixel for every light affecting the material.
// // Uncomment to replace the default light processing function with this one.
//}

View File

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