Add realistic cockpit surface textures

This commit is contained in:
chindit committed 2026-10-03 09:30:56 +02:00
1 parent 5455ae7928
commit 0b79bf9b82
8 files changed
+160 -23

No files matched your search

@@ -1,14 +1,23 @@
class_name CockpitMaterialPalette
extends RefCounted
const NAVAL_STEEL_TEXTURE_PATH := (
"res://game/presentation/cockpit/assets/naval_painted_steel_albedo.png"
)
const GAUGE_FACE_TEXTURE_PATH := (
"res://game/presentation/cockpit/assets/analog_gauge_face_albedo.png"
)
var painted_steel: Material
var dark_steel: Material
var overhead_steel: StandardMaterial3D
var brass: Material
var copper: Material
var rubber: Material
var ivory: Material
var gauge_face: StandardMaterial3D
var gauge_glass: StandardMaterial3D
var needle_paint: StandardMaterial3D
var warm_emission: StandardMaterial3D
var red_emission: StandardMaterial3D
func _init() -> void:
@@ -26,6 +35,13 @@ func _init() -> void:
0.44,
0.08
)
overhead_steel = _textured_material(
_load_texture(NAVAL_STEEL_TEXTURE_PATH),
Color(0.64, 0.69, 0.68),
0.64,
0.56,
Vector3(1.6, 1.6, 1.6)
)
brass = _weathered_material(
Color(0.28, 0.18, 0.045),
Color(0.08, 0.16, 0.13),
@@ -41,9 +57,15 @@ func _init() -> void:
0.12
)
rubber = _plain_material(Color(0.012, 0.018, 0.018), 0.0, 0.92)
ivory = _plain_material(Color(0.72, 0.69, 0.56), 0.05, 0.63)
gauge_face = _textured_material(
_load_texture(GAUGE_FACE_TEXTURE_PATH),
Color(0.78, 0.74, 0.64),
0.02,
0.72
)
gauge_glass = _glass_material()
needle_paint = _plain_material(Color(0.68, 0.055, 0.022), 0.12, 0.44)
warm_emission = _emissive_material(Color(0.96, 0.52, 0.18), 2.4)
red_emission = _emissive_material(Color(0.92, 0.055, 0.025), 3.6)
func _weathered_material(
@@ -110,6 +132,41 @@ func _plain_material(
return material
func _textured_material(
texture: Texture2D,
tint: Color,
metallic: float,
roughness: float,
uv_scale: Vector3 = Vector3.ONE
) -> StandardMaterial3D:
var material := StandardMaterial3D.new()
material.albedo_color = tint
material.albedo_texture = texture
material.metallic = metallic
material.roughness = roughness
material.uv1_scale = uv_scale
material.texture_filter = BaseMaterial3D.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC
return material
func _load_texture(resource_path: String) -> ImageTexture:
var image := Image.load_from_file(resource_path)
if image == null or image.is_empty():
push_error("Unable to load cockpit texture: %s" % resource_path)
return null
return ImageTexture.create_from_image(image)
func _glass_material() -> StandardMaterial3D:
var material := StandardMaterial3D.new()
material.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
material.albedo_color = Color(0.42, 0.68, 0.66, 0.13)
material.metallic = 0.12
material.roughness = 0.08
material.cull_mode = BaseMaterial3D.CULL_DISABLED
return material
func _emissive_material(color: Color, energy: float) -> StandardMaterial3D:
var material := StandardMaterial3D.new()
material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED