summaryrefslogtreecommitdiff
path: root/stage/blender/ship.py
diff options
context:
space:
mode:
Diffstat (limited to 'stage/blender/ship.py')
-rw-r--r--stage/blender/ship.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/stage/blender/ship.py b/stage/blender/ship.py
index 0f30d54..8a67673 100644
--- a/stage/blender/ship.py
+++ b/stage/blender/ship.py
@@ -123,6 +123,8 @@ STEP_OBJECTS = {
"hnx02.shuttle.orion",
"hnx02.detail.greeble",
"hnx02.detail.antenna",
+ "hnx02.detail.glow",
+ "hnx02.detail.glass",
],
}
@@ -146,6 +148,8 @@ OBJECT_MATERIAL = {
"hnx02.shuttle.orion": "white",
"hnx02.detail.greeble": "hull",
"hnx02.detail.antenna": "hull",
+ "hnx02.detail.glow": "glow",
+ "hnx02.detail.glass": "glass",
}
@@ -163,7 +167,7 @@ def fail(message, code):
# --------------------------------------------------------------- materials
-def make_material(bpy, name, color, *, metallic=0.0, roughness=0.45):
+def make_material(bpy, name, color, *, metallic=0.0, roughness=0.45, emission=None, emission_strength=0.0):
material = bpy.data.materials.get(name)
if material is not None:
return material
@@ -173,6 +177,9 @@ def make_material(bpy, name, color, *, metallic=0.0, roughness=0.45):
bsdf.inputs["Base Color"].default_value = (*color, 1.0)
bsdf.inputs["Metallic"].default_value = metallic
bsdf.inputs["Roughness"].default_value = roughness
+ if emission is not None:
+ bsdf.inputs["Emission Color"].default_value = (*emission, 1.0)
+ bsdf.inputs["Emission Strength"].default_value = emission_strength
return material
@@ -186,6 +193,10 @@ def build_materials(bpy):
"pv": make_material(bpy, "hnx02.pv", (0.07, 0.10, 0.24), metallic=0.35, roughness=0.28),
"gold": make_material(bpy, "hnx02.gold", (0.82, 0.58, 0.19), metallic=1.0, roughness=0.30),
"copper": make_material(bpy, "hnx02.copper", (0.70, 0.44, 0.19), metallic=1.0, roughness=0.34),
+ "glow": make_material(bpy, "hnx02.glow", (1.0, 0.35, 0.10), metallic=0.0, roughness=0.6,
+ emission=(1.0, 0.42, 0.14), emission_strength=9.0),
+ "glass": make_material(bpy, "hnx02.glass", (0.55, 0.75, 0.95), metallic=0.0, roughness=0.25,
+ emission=(0.55, 0.80, 1.0), emission_strength=4.5),
}
@@ -963,6 +974,30 @@ def b_orion(bm):
bell(bm, base - Vector((0, 0.6, 0)), (0, -1, 0), 1.5, 0.22, 0.68, seg=22, layers=9)
+def b_glow(bm):
+ """Heat glow rings inside the engine bells."""
+ for ex in (-2.4, 2.4):
+ mount = Vector((ex, NOZZLE_MOUNT_Y, 0.0))
+ chamber = mount + Vector((0.0, -1.0, 0.0))
+ throat = chamber + Vector((0.0, -0.9, 0.0))
+ for t in (0.32, 0.58, 0.84):
+ c = throat + Vector((0.0, -4.6 * t, 0.0))
+ r = 0.62 + (2.10 - 0.62) * (t ** 1.7)
+ torus(bm, c, r * 0.90, 0.07, axis=(0, 1, 0), seg=26, rseg=5)
+
+
+def b_glass(bm):
+ """Lit viewports along the hull bands."""
+ p1, p2 = Vector(HULL_P1), Vector(HULL_P2)
+ for band_t, count in ((0.18, 22), (0.46, 26), (0.74, 22)):
+ c0 = p1.lerp(p2, band_t)
+ for k in range(count):
+ a = 2.0 * math.pi * k / count
+ radial = Vector((math.cos(a), 0.0, math.sin(a)))
+ wc = c0 + radial * (HULL_R + 0.18)
+ cyl(bm, wc - radial * 0.02, wc + radial * 0.05, 0.17, seg=10)
+
+
def b_greeble(bm):
"""Organised machinery, cable looms, nav lights, hatch plates."""
p1, p2 = Vector(HULL_P1), Vector(HULL_P2)
@@ -1015,6 +1050,8 @@ BUILDERS = {
"hnx02.shuttle.orion": b_orion,
"hnx02.detail.greeble": b_greeble,
"hnx02.detail.antenna": b_antenna,
+ "hnx02.detail.glow": b_glow,
+ "hnx02.detail.glass": b_glass,
}