Architect-Prime commited on
Commit
eabbda3
·
verified ·
1 Parent(s): c40b4e6

Upload scripts/lane21_hull.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/lane21_hull.py +131 -0
scripts/lane21_hull.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Lane 21: Zero-Class-Vessel-Hull-20098 — hydrogen-electric freighter showcase.
2
+ Key visual: ship hull side-profile silhouette with deck + superstructure.
3
+ """
4
+ import sys, os
5
+ sys.path.insert(0, os.path.dirname(__file__))
6
+ from render_protocol import (
7
+ clean_scene, setup_world, render_2x, W2X, H2X, WIRE_COLOR,
8
+ )
9
+ import bpy, math
10
+
11
+ OUT_2X = "/Users/Zer0pa/ZPE/ZPE-Animation-Workspace/blender-proto/lane21_hull_2x.png"
12
+ OUT_FINAL = "/Users/Zer0pa/ZPE/ZPE-Animation-Workspace/final-572x534/key-visuals/lane21_Hull-20098.png"
13
+
14
+ scene = clean_scene()
15
+
16
+ def curve_from(name, pts, cyclic=False, depth=0.025):
17
+ cd = bpy.data.curves.new(name, type='CURVE'); cd.dimensions = '3D'
18
+ sp = cd.splines.new('POLY')
19
+ if cyclic: sp.use_cyclic_u = True
20
+ sp.points.add(len(pts) - 1)
21
+ for i, p in enumerate(pts):
22
+ sp.points[i].co = (*p, 1.0)
23
+ cd.bevel_depth = depth
24
+ obj = bpy.data.objects.new(name, cd); scene.collection.objects.link(obj)
25
+ return obj
26
+
27
+ mat = bpy.data.materials.new("M"); mat.use_nodes = True
28
+ nt = mat.node_tree
29
+ for n in list(nt.nodes): nt.nodes.remove(n)
30
+ out = nt.nodes.new("ShaderNodeOutputMaterial")
31
+ emi = nt.nodes.new("ShaderNodeEmission")
32
+ emi.inputs["Color"].default_value = WIRE_COLOR
33
+ emi.inputs["Strength"].default_value = 3.0
34
+ nt.links.new(emi.outputs[0], out.inputs[0])
35
+
36
+ # Hull side profile (closed curve)
37
+ # Side view: hull below waterline (curved bottom), deck above (horizontal)
38
+ # Length L=4.0, depth D=0.8
39
+ L = 4.0
40
+ D_BELOW = 0.55 # below waterline
41
+ D_ABOVE = 0.25 # deck height above waterline
42
+
43
+ # Hull outline (closed, side view facing camera)
44
+ # Build clockwise from stern-top
45
+ hull_pts = [
46
+ (-L/2, 0, D_ABOVE), # stern top
47
+ ( L/2 * 0.95, 0, D_ABOVE), # bow top (slight slope up at bow)
48
+ ( L/2, 0, D_ABOVE * 0.5), # bow flare
49
+ ( L/2 - 0.30, 0, -D_BELOW * 0.30), # forward foot of bow
50
+ ( L/2 - 0.50, 0, -D_BELOW * 0.70), # below bow
51
+ ( L/2 - 1.30, 0, -D_BELOW), # mid-hull bottom
52
+ (-L/2 + 1.30, 0, -D_BELOW), # aft mid-hull bottom
53
+ (-L/2 + 0.50, 0, -D_BELOW * 0.70), # aft tapered up
54
+ (-L/2 + 0.20, 0, -D_BELOW * 0.30),
55
+ (-L/2, 0, 0.0), # stern bottom
56
+ ]
57
+ hull = curve_from("Hull", hull_pts, cyclic=True, depth=0.025)
58
+ hull.data.materials.append(mat)
59
+
60
+ # Waterline (horizontal dashed-ish line — we use a thin solid line across)
61
+ wl = curve_from("WL", [(-L/2 - 0.4, 0, 0), (L/2 + 0.4, 0, 0)], cyclic=False, depth=0.008)
62
+ wl.data.materials.append(mat)
63
+
64
+ # Superstructure on deck (block)
65
+ SS_X = -0.4
66
+ SS_W = 1.0
67
+ SS_H = 0.45
68
+ ss_pts = [
69
+ (SS_X - SS_W/2, 0, D_ABOVE),
70
+ (SS_X + SS_W/2, 0, D_ABOVE),
71
+ (SS_X + SS_W/2, 0, D_ABOVE + SS_H),
72
+ (SS_X - SS_W/2, 0, D_ABOVE + SS_H),
73
+ ]
74
+ ss = curve_from("SS", ss_pts, cyclic=True, depth=0.020)
75
+ ss.data.materials.append(mat)
76
+
77
+ # Bridge windows: 3 small rectangles on superstructure
78
+ for i in range(3):
79
+ x = SS_X - SS_W/2 + 0.15 + i * 0.30
80
+ w_pts = [
81
+ (x, 0, D_ABOVE + 0.12),
82
+ (x + 0.20, 0, D_ABOVE + 0.12),
83
+ (x + 0.20, 0, D_ABOVE + 0.30),
84
+ (x, 0, D_ABOVE + 0.30),
85
+ ]
86
+ win = curve_from(f"Win_{i}", w_pts, cyclic=True, depth=0.008)
87
+ win.data.materials.append(mat)
88
+
89
+ # Funnel (small)
90
+ F_X = 0.30
91
+ F_TOP = D_ABOVE + 0.65
92
+ funnel_pts = [
93
+ (F_X - 0.10, 0, D_ABOVE),
94
+ (F_X + 0.10, 0, D_ABOVE),
95
+ (F_X + 0.10, 0, F_TOP),
96
+ (F_X - 0.10, 0, F_TOP),
97
+ ]
98
+ funnel = curve_from("Funnel", funnel_pts, cyclic=True, depth=0.018)
99
+ funnel.data.materials.append(mat)
100
+
101
+ # Deck details: cargo crates (2-3 rectangles forward of superstructure)
102
+ for i, x_center in enumerate([0.70, 1.10, 1.45]):
103
+ c_pts = [
104
+ (x_center - 0.18, 0, D_ABOVE),
105
+ (x_center + 0.18, 0, D_ABOVE),
106
+ (x_center + 0.18, 0, D_ABOVE + 0.22),
107
+ (x_center - 0.18, 0, D_ABOVE + 0.22),
108
+ ]
109
+ cr = curve_from(f"Crate_{i}", c_pts, cyclic=True, depth=0.014)
110
+ cr.data.materials.append(mat)
111
+
112
+ setup_world()
113
+
114
+ target = bpy.data.objects.new("Target", None); target.location = (0, 0, 0)
115
+ scene.collection.objects.link(target)
116
+ cam_data = bpy.data.cameras.new("Cam"); cam_data.lens = 50
117
+ cam_data.clip_start = 0.001
118
+ cam = bpy.data.objects.new("Cam", cam_data); scene.collection.objects.link(cam)
119
+
120
+ half_fov = math.atan((36/2) / 50)
121
+ content_w = L + 0.6
122
+ content_h = D_BELOW + D_ABOVE + SS_H + 0.4
123
+ dist = max(content_w, content_h * 1.07) / 2 / math.tan(half_fov) * 1.10
124
+ cam.location = (0, -dist, 0)
125
+ trk = cam.constraints.new('TRACK_TO')
126
+ trk.target = target; trk.track_axis = 'TRACK_NEGATIVE_Z'; trk.up_axis = 'UP_Y'
127
+ scene.camera = cam
128
+
129
+ print(f"[lane21] rendering → {OUT_2X}")
130
+ render_2x(OUT_2X)
131
+ print(f"[lane21] done")