| """Lane 32: Morph-Bench — benchmark methodology lane. |
| Key visual: radar/spider chart with 3 overlaid polygons (baseline comparisons). |
| """ |
| import sys, os |
| sys.path.insert(0, os.path.dirname(__file__)) |
| from render_protocol import ( |
| clean_scene, setup_world, render_2x, W2X, H2X, WIRE_COLOR, |
| ) |
| import bpy, math, random |
|
|
| OUT_2X = "/Users/Zer0pa/ZPE/ZPE-Animation-Workspace/blender-proto/lane32_morph_2x.png" |
| OUT_FINAL = "/Users/Zer0pa/ZPE/ZPE-Animation-Workspace/final-572x534/key-visuals/lane32_Morph-Bench.png" |
|
|
| scene = clean_scene() |
| random.seed(20098) |
|
|
| AXES = 7 |
| R_MAX = 1.2 |
|
|
| def curve_from(name, pts, cyclic=False, depth=0.012): |
| cd = bpy.data.curves.new(name, type='CURVE'); cd.dimensions = '3D' |
| sp = cd.splines.new('POLY') |
| if cyclic: sp.use_cyclic_u = True |
| sp.points.add(len(pts) - 1) |
| for i, p in enumerate(pts): |
| sp.points[i].co = (*p, 1.0) |
| cd.bevel_depth = depth |
| obj = bpy.data.objects.new(name, cd); scene.collection.objects.link(obj) |
| return obj |
|
|
| |
| axes_list = [] |
| for i in range(AXES): |
| a = i * 2 * math.pi / AXES + math.pi / 2 |
| x = R_MAX * math.cos(a); z = R_MAX * math.sin(a) |
| ax = curve_from(f"Axis_{i}", [(0, 0, 0), (x, 0, z)], cyclic=False, depth=0.004) |
| axes_list.append(ax) |
|
|
| |
| ring_radii = [R_MAX * r for r in (0.33, 0.66, 1.0)] |
| rings = [] |
| for j, r in enumerate(ring_radii): |
| pts = [] |
| for i in range(60): |
| a = i * 2 * math.pi / 60 + math.pi / 2 |
| pts.append((r * math.cos(a), 0, r * math.sin(a))) |
| rings.append(curve_from(f"Ring_{j}", pts, cyclic=True, depth=0.004)) |
|
|
| |
| scores_set = [ |
| [random.uniform(0.30, 0.95) for _ in range(AXES)], |
| [random.uniform(0.45, 0.85) for _ in range(AXES)], |
| [random.uniform(0.55, 0.78) for _ in range(AXES)], |
| ] |
| polygons = [] |
| for k, scores in enumerate(scores_set): |
| pts = [] |
| for i, s in enumerate(scores): |
| a = i * 2 * math.pi / AXES + math.pi / 2 |
| r = s * R_MAX |
| pts.append((r * math.cos(a), 0, r * math.sin(a))) |
| polygons.append(curve_from(f"Poly_{k}", pts, cyclic=True, depth=0.014)) |
|
|
| |
| mat_light = bpy.data.materials.new("Light"); mat_light.use_nodes = True |
| nt = mat_light.node_tree |
| for n in list(nt.nodes): nt.nodes.remove(n) |
| out = nt.nodes.new("ShaderNodeOutputMaterial") |
| emi = nt.nodes.new("ShaderNodeEmission") |
| emi.inputs["Color"].default_value = (0.22, 0.22, 0.24, 1.0) |
| emi.inputs["Strength"].default_value = 1.0 |
| nt.links.new(emi.outputs[0], out.inputs[0]) |
|
|
| mat_bright = bpy.data.materials.new("Bright"); mat_bright.use_nodes = True |
| nt = mat_bright.node_tree |
| for n in list(nt.nodes): nt.nodes.remove(n) |
| out = nt.nodes.new("ShaderNodeOutputMaterial") |
| emi = nt.nodes.new("ShaderNodeEmission") |
| emi.inputs["Color"].default_value = WIRE_COLOR |
| emi.inputs["Strength"].default_value = 3.0 |
| nt.links.new(emi.outputs[0], out.inputs[0]) |
|
|
| |
| for obj in axes_list + rings: |
| obj.data.materials.append(mat_light) |
| for obj in polygons: |
| obj.data.materials.append(mat_bright) |
|
|
| setup_world() |
|
|
| target = bpy.data.objects.new("Target", None); target.location = (0, 0, 0) |
| scene.collection.objects.link(target) |
| cam_data = bpy.data.cameras.new("Cam"); cam_data.lens = 50 |
| cam_data.clip_start = 0.001 |
| cam = bpy.data.objects.new("Cam", cam_data); scene.collection.objects.link(cam) |
|
|
| half_fov = math.atan((36/2) / 50) |
| dist = R_MAX / math.tan(half_fov) * 1.18 |
| cam.location = (0, -dist, 0) |
| trk = cam.constraints.new('TRACK_TO') |
| trk.target = target; trk.track_axis = 'TRACK_NEGATIVE_Z'; trk.up_axis = 'UP_Y' |
| scene.camera = cam |
|
|
| print(f"[lane32] rendering → {OUT_2X}") |
| render_2x(OUT_2X) |
| print(f"[lane32] done") |
|
|