agent

+16:14
reasoning

The code snippet indicates a bevel modifier being applied. The parameters 'bevel', 'segs', and 'angle' control the bevel's width, segments, and angle limit, respectively. Examining these values within the calling context will clarify how the bevel effect is generated.

The use_clamp_overlap and miter_outer settings are applied to the bevel modifier. Further investigation reveals a smoothing issue when beveling with a single segment, which creates a chamfer that results in incorrect smoothing. This happens because the angle is smaller than the threshold defined by the sharp angle.

The averaging of normals between the large outer face and the small chamfer results in a significant bending of the vertex normal around the armor plate's perimeter. Alternative modifiers and methods, such as those that use face-area weighting, can preserve the flat surface normals and maintain crisp medial ridges. This explains the observed pillowed shading around the armor plates, stemming from the bevel application with a single segment and smooth shading.

The bevel modifier creates edges that are smoothed due to the segment count and smooth shading. Specifically, a single segment bevel on 90° edges results in ~45° chamfers, which, combined with the smoothing and sharp angle settings, averages normals across the chamfered region, leading to rounded appearances where sharp creases are expected. The dihedral angles of the tent ridges are also small enough to get smoothed out.

A possible fix could be setting sharp edges before beveling or using a weighted normal modifier after beveling. Need to see how that would change the existing code. There is an idea to use a weighted normal modifier after beveling.

  • read_file{"Path":"~/work/sortie/kit/build.py"}

    input

    {
      "Path": "~/work/sortie/kit/build.py"
    }

    result, 74 lines

    Showing lines 1-73 of 73
    1: """Build every model into public/assets/*.glb.
    2: 
    3:     npm run kit                 # everything
    4:     npm run kit -- striker ship # just these
    5:     npm run kit -- block_dummy  # a block model, kit/blocks/dummy.py
    6: """
    7: import os
    8: import sys
    9: import time
    10: 
    11: sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
    12: 
    13: import lib  # noqa: E402
    14: from block import build_block  # noqa: E402
    15: from cockpit import build_cockpit  # noqa: E402
    16: from cockpit_light import build_cockpit_light  # noqa: E402
    17: from mech import build_striker  # noqa: E402
    18: from heavy import build_heavy, build_heavy_lab  # noqa: E402
    19: from props import build_cannon, build_drone, build_rifle  # noqa: E402
    20: from ship import build_ship  # noqa: E402
    21: from station import build_station  # noqa: E402
    22: from salvage import build_salvage_pod, build_wreck_field  # noqa: E402
    23: from escape_pod import build_escape_pod  # noqa: E402
    24: from light import build_light, build_light_lab  # noqa: E402
    25: from automaton import build_automaton, build_automaton_lab  # noqa: E402
    26: from alien import build_alien, build_alien_lab  # noqa: E402
    27: sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "lab"))
    28: from heads import build_head_lab, build_head_lab2  # noqa: E402
    29: from headkit import build_head_lab3, build_head_lab4, build_head_lab5, build_head_lab6, build_head_lab7, build_head_lab8  # noqa: E402
    30: from sizes import build_sizes  # noqa: E402
    31: from pilotlab import build_pilot_lab  # noqa: E402
    32: from assembly import build_assembly_lab, build_back_lab, build_chest_frames, build_show, game_frame  # noqa: E402
    33: from raider import build_raider, build_raider_lab  # noqa: E402
    34: from pattern_lab import build_pattern_lab, build_pattern_m  # noqa: E402
    35: from atelier_lab import build_atelier_lab  # noqa: E402
    36: from atelier_board import build_atelier_line  # noqa: E402
    37: from bodykit import build_chest_lab, build_chest_lab2, build_foot_lab, build_foot_lab2, build_chest_lab3, build_foot_lab3  # noqa: E402
    38: 
    39: OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "public", "assets")
    40: ASSETS = {"striker": build_striker, "striker_a": lambda: game_frame(0), "striker_b": lambda: game_frame(1), "rifle": build_rifle, "cannon": build_cannon, "drone": build_drone,
    41:           "cockpit": build_cockpit, "cockpit_light": build_cockpit_light, "ship": build_ship, "station": build_station,
    42:           "wreck_field": build_wreck_field, "salvage_pod": build_salvage_pod, "escape_pod": build_escape_pod,
    43:           "light": lambda: build_light("knight"), "light_line": lambda: build_light("line"), "light_lancer": lambda: build_light("lancer"),
    44:           "heavy": lambda: build_heavy("A"), "heavy_B": lambda: build_heavy("B"), "heavy_C": lambda: build_heavy("C"),
    45:           "lab_heads": build_head_lab, "lab_heads2": build_head_lab2, "lab_heads3": build_head_lab3, "lab_heads4": build_head_lab4, "lab_heads5": build_head_lab5, "lab_heads6": build_head_lab6, "lab_heads7": build_head_lab7, "lab_heads8": build_head_lab8, "lab_chests": build_chest_lab, "lab_feet": build_foot_lab, "lab_chests2": build_chest_lab2, "lab_feet2": build_foot_lab2, "lab_chests3": build_chest_lab3, "lab_feet3": build_foot_lab3, "lab_frames": build_assembly_lab, "lab_backs": build_back_lab, "lab_chests4": build_chest_frames,
    46:           "lab_show": build_show, "lab_show_v": lambda: build_show(formation=True),
    47:           "lab_heavy": build_heavy_lab, "lab_light": build_light_lab, "lab_sizes": build_sizes, "lab_pilot": build_pilot_lab,
    48:           "auto_tally": lambda: build_automaton("tally"), "auto_tick": lambda: build_automaton("tick"),
    49:           "auto_ledger": lambda: build_automaton("ledger"),
    50:           "alien_acicular": lambda: build_alien("acicular"), "alien_druse": lambda: build_alien("druse"),
    51:           "alien_druse_mimic": lambda: build_alien("druse_mimic"), "alien_geode": lambda: build_alien("geode"),
    52:           "raider_grunt": lambda: build_raider("grunt"), "raider_brawler": lambda: build_raider("brawler"),
    53:           "raider_boss": lambda: build_raider("boss"),
    54:           "pattern_m": build_pattern_m, "lab_pattern": build_pattern_lab, "lab_atelier": build_atelier_lab, "lab_atelier_a": lambda: build_atelier_line("a"), "lab_atelier_b": lambda: build_atelier_line("b"),
    55:           "lab_atelier_c": lambda: build_atelier_line("c"), "lab_atelier_d": lambda: build_atelier_line("d"),
    56:           "lab_auto": build_automaton_lab, "lab_alien": build_alien_lab, "lab_raider": build_raider_lab}
    57: 
    58: 
    59: def main(names):
    60:     os.makedirs(OUT, exist_ok=True)
    61:     for name in names or [n for n in ASSETS if not n.startswith("lab")]:
    62:         t = time.time()
    63:         lib.reset()
    64:         if name.startswith("block_"):  # scratch models, kit/blocks/<name>.py
    65:             build_block(name)
    66:         else:
    67:             ASSETS[name]()
    68:         path = os.path.normpath(os.path.join(OUT, f"{name}.glb"))
    69:         lib.export(path)
    70:         print(f"kit: {name} -> {path} ({os.path.getsize(path) // 1024} KB, {time.time() - t:.1f}s)")
    71: 
    72: 
    73: main(sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
  • read_file{"EndLine":80,"Path":"~/work/sortie/kit/lib.py","StartLine":1}

    input

    {
      "EndLine": 80,
      "Path": "~/work/sortie/kit/lib.py",
      "StartLine": 1
    }

    result, 81 lines

    Showing lines 1-80 of 437
    1: """Modelling helpers shared by every kit script.
    2: 
    3: Blender units are metres, Z is up, and models face -Y (Blender's front view). The glTF exporter turns
    4: that into three.js's Y up with models facing +Z.
    5: 
    6: Parts are solids built from a few primitives:
    7:   loft      cross-sections stacked along an axis (most armour, limbs, hulls)
    8:   prism     a 2D outline pushed through a depth
    9:   two_view  a front outline and a side outline intersected, the classic hard-surface blockout
    10: Every solid gets a material role (main, accent, frame, glow_eye, ...). The game maps roles to toon
    11: materials, so one model can wear any faction's paint.
    12: """
    13: import math
    14: 
    15: import bmesh
    16: import bpy
    17: from mathutils import Matrix, Vector
    18: 
    19: # Preview colours only, for anyone opening a .blend. The game ignores them.
    20: PREVIEW = {
    21:     "main": (0.86, 0.87, 0.9), "accent": (0.12, 0.3, 0.55), "trim": (0.85, 0.55, 0.12),
    22:     "frame": (0.2, 0.21, 0.24), "joint": (0.12, 0.12, 0.14), "visor": (0.05, 0.06, 0.08),
    23:     "glow_eye": (0.3, 1.0, 0.9), "glow_core": (0.3, 1.0, 0.9), "glow_thruster": (0.6, 0.78, 1.0),
    24:     "glow_exhaust": (0.31, 0.56, 1.0),
    25:     "metal": (0.55, 0.57, 0.6), "hull": (0.72, 0.73, 0.75), "hull_dark": (0.32, 0.33, 0.36),
    26:     "deck": (0.25, 0.26, 0.28), "hazard": (0.9, 0.75, 0.1), "light": (1.0, 0.97, 0.9),
    27:     "screen": (0.2, 0.8, 0.75), "glass": (0.1, 0.2, 0.25), "lamp_red": (1.0, 0.2, 0.15),
    28:     "lamp_green": (0.3, 1.0, 0.4), "suit": (0.14, 0.19, 0.36), "glow_hot": (0.92, 1.0, 0.98),
    29:     # raider salvage (palette.ts): donor paint, primer, rust, hand paint
    30:     "donor_a": (0.78, 0.76, 0.72), "donor_b": (0.24, 0.34, 0.43), "donor_c": (0.36, 0.38, 0.26), "primer": (0.54, 0.55, 0.52),
    31:     "rust": (0.42, 0.23, 0.13), "handpaint": (0.93, 0.89, 0.8), "warpaint": (0.76, 0.23, 0.15),
    32:     # markings: pattern codes, service text, unit codes (a decal layer in geometry)
    33:     "stencil": (0.13, 0.14, 0.16),
    34:     "crystal": (0.8, 0.81, 0.84), "crystal_lit": (0.55, 0.45, 0.78), "glow_violet": (0.66, 0.48, 1.0),
    35: }
    36: 
    37: 
    38: def reset():
    39:     for o in list(bpy.data.objects):
    40:         bpy.data.objects.remove(o, do_unlink=True)
    41:     for coll in (bpy.data.meshes, bpy.data.materials):
    42:         for item in list(coll):
    43:             coll.remove(item)
    44: 
    45: 
    46: def material(role):
    47:     m = bpy.data.materials.get(role)
    48:     if m is None:
    49:         m = bpy.data.materials.new(role)
    50:         c = PREVIEW.get(role, (0.7, 0.7, 0.7))
    51:         m.diffuse_color = (*c, 1.0)
    52:     return m
    53: 
    54: 
    55: def link(o):
    56:     bpy.context.scene.collection.objects.link(o)
    57:     return o
    58: 
    59: 
    60: def empty(name, at=(0, 0, 0), parent=None, **extras):
    61:     """A joint or marker. Children keep their world placement when parented to it."""
    62:     o = link(bpy.data.objects.new(name, None))
    63:     o.empty_display_size = 0.4
    64:     o.location = Vector(at) if parent is None else parent.matrix_world.inverted() @ Vector(at)
    65:     if parent is not None:
    66:         o.parent = parent
    67:     for k, v in extras.items():
    68:         o[k] = v
    69:     bpy.context.view_layer.update()
    70:     return o
    71: 
    72: 
    73: def attach(o, parent):
    74:     """Parent without moving: geometry is authored in world (rest pose) coordinates."""
    75:     bpy.context.view_layer.update()
    76:     mw = o.matrix_world.copy()
    77:     o.parent = parent
    78:     o.matrix_parent_inverse = parent.matrix_world.inverted()
    79:     o.matrix_world = mw
    80:     return o
  • read_file{"EndLine":437,"Path":"~/work/sortie/kit/lib.py","StartLine":380}

    input

    {
      "EndLine": 437,
      "Path": "~/work/sortie/kit/lib.py",
      "StartLine": 380
    }

    result, 59 lines

    Showing lines 380-437 of 437
    380:         f = e.link_faces
    381:         if len(f) == 2 and f[0].normal.angle(f[1].normal, 0) > lim:
    382:             attr.data[e.index].value = crease
    383:     probe.free()
    384:     o = link(bpy.data.objects.new("_subd", me))
    385:     mod = o.modifiers.new("subd", "SUBSURF")
    386:     mod.levels = mod.render_levels = levels
    387:     bake(o)
    388:     out = bmesh.new()
    389:     out.from_mesh(o.data)
    390:     data = o.data
    391:     bpy.data.objects.remove(o, do_unlink=True)
    392:     bpy.data.meshes.remove(data)
    393:     return out
    394: 
    395: 
    396: def cylinder(r, z0, z1, n=10, r1=None, axis="z", at=(0, 0)):
    397:     """An n-sided cylinder (or cone with r1) between z0 and z1 along an axis, centred at `at` in the
    398:     other two coordinates."""
    399:     r1 = r if r1 is None else r1
    400:     return loft([(z0, circle(r, n, *at)), (z1, circle(r1, n, *at))], axis=axis)
    401: 
    402: 
    403: def nozzle(r_out, length, n=12, flare=1.25):
    404:     """A thruster bell along -Z from the origin (throat at z=0, exit at z=-length), open-ended with
    405:     a thick lip. Returns (shell bmesh, glow disc bmesh)."""
    406:     ro, ri = r_out, r_out * 0.78
    407:     rings_out = [(0, circle(ro / flare, n)), (-length * 0.6, circle(ro * 0.92, n)), (-length, circle(ro, n))]
    408:     rings_in = [(-length, circle(ri, n)), (-length * 0.6, circle(ri * 0.9, n)), (0.0, circle(ri / flare * 0.9, n))]
    409:     bm = bmesh.new()
    410:     loops = []
    411:     for h, pts in rings_out + rings_in:
    412:         loops.append([bm.verts.new((u, v, h)) for u, v in pts])
    413:     for a, b in zip(loops, loops[1:]):
    414:         for i in range(n):
    415:             j = (i + 1) % n
    416:             bm.faces.new((a[i], a[j], b[j], b[i]))
    417:     bm.faces.new(list(reversed(loops[0])))
    418:     _outward(bm)
    419:     glow = loft([(-length * 0.15, circle(ri / flare * 0.85, n)), (-length * 0.12, circle(ri / flare * 0.85, n))])
    420:     return bm, glow
    421: 
    422: 
    423: def slats(x0, x1, z0, z1, y, n, depth=0.12, gap=0.35):
    424:     """Horizontal vent slats on a plane facing -Y at depth y."""
    425:     out = []
    426:     h = (z1 - z0) / n
    427:     for i in range(n):
    428:         zb = z0 + i * h
    429:         out.append(prism([(x0, zb), (x1, zb), (x1, zb + h * (1 - gap)), (x0, zb + h * (1 - gap))],
    430:                          y - depth, y + 0.05, "xz"))
    431:     return merge(*out)
    432: 
    433: 
    434: def export(path, extras=True):
    435:     bpy.ops.export_scene.gltf(filepath=path, export_format="GLB", export_apply=True, export_yup=True,
    436:                               export_extras=extras, export_cameras=False, export_lights=False,
    437:                               export_materials="EXPORT", export_normals=True, export_texcoords=False)
  • read_file{"EndLine":290,"Path":"~/work/sortie/kit/makers/shell.py","StartLine":240}

    input

    {
      "EndLine": 290,
      "Path": "~/work/sortie/kit/makers/shell.py",
      "StartLine": 240
    }

    result, 52 lines

    Showing lines 240-290 of 297
    240: 
    241: def plan(front, side, cf=.2, cb=.12):
    242:     """A plan outline (x, y) over a front and a side outline, its corners chamfered: cf at the front,
    243:     cb at the back. Takes the box out of a two_view block."""
    244:     xs, ys = [p[0] for p in front], [p[0] for p in side]
    245:     x0, x1, y0, y1 = min(xs) - .01, max(xs) + .01, min(ys) - .01, max(ys) + .01
    246:     return [(x0 + cf, y0), (x1 - cf, y0), (x1, y0 + cf), (x1, y1 - cb), (x1 - cb, y1), (x0 + cb, y1), (x0, y1 - cb), (x0, y0 + cf)]
    247: 
    248: 
    249: def shell(front, side, t=0.0, keep=None, top=None):
    250:     """A closed plate with a volume: the whole block, or a plate of thickness t on the keep faces."""
    251:     bm = two_view(front, side, top)
    252:     if keep is None:
    253:         return bm
    254:     return _bool(bm, behind(front, side, t, keep, top), "DIFFERENCE")
    255: 
    256: 
    257: def banded(front, side, t, keep, band, recess=.06, top=None):
    258:     """A shell cut across by a recessed service band between heights band = (z0, z1). Returns
    259:     (pieces in the main role, band piece)."""
    260:     z0, z1 = band
    261:     whole = shell(front, side, t, keep, top)
    262:     lo, hi = clip(copy(whole), z=(-60, z0)), clip(whole, z=(z1, 60))
    263:     b = two_view(inset(front, recess), inset(side, recess), inset(top, recess) if top is not None else None)
    264:     if keep is not None:
    265:         b = _bool(b, behind(front, side, t, keep, top), "DIFFERENCE")
    266:     return [p for p in (lo, hi) if len(p.faces) >= 4], clip(b, z=(z0, z1))
    267: 
    268: 
    269: 
    270: def inset_panel(front, side, t, keep, box, recess=.06, top=None, cut_back=.02):
    271:     """A shell with a recessed panel let into its front face: box = (x0, x1, z0, z1). Returns (the
    272:     shell with the opening, the panel set back by `recess`)."""
    273:     x0, x1, z0, z1 = box
    274:     y = max(surface(side, z, 0, -1)[0] for z in (z0, (z0 + z1) / 2, z1))
    275:     whole = shell(front, side, t, keep, top)
    276:     hole = two_view([(x0, z0), (x1, z0), (x1, z1), (x0, z1)], [(-60, z0), (y + t + cut_back, z0), (y + t + cut_back, z1), (-60, z1)])
    277:     main = subtract(whole, hole)
    278:     p = two_view(inset(front, recess), inset(side, recess), inset(top, recess) if top is not None else None)
    279:     p = clip(p, x=(x0, x1), y=(-60, y + t + cut_back), z=(z0, z1))
    280:     if keep is not None:
    281:         p = subtract(p, behind(front, side, t, keep, top))
    282:     return main, p
    283: 
    284: 
    285: def surface(poly, z, axis=0, sign=-1):
    286:     """Where an outline is outermost at height z: poly in (u, z), the extreme u toward sign, and the
    287:     slope du/dz of the edge there. For a side outline (y, z) and sign -1 that is the front face."""
    288:     best = None
    289:     n = len(poly)
    290:     for i in range(n):
  • read_file{"EndLine":60,"Path":"~/work/sortie/kit/makers/shell.py","StartLine":1}

    input

    {
      "EndLine": 60,
      "Path": "~/work/sortie/kit/makers/shell.py",
      "StartLine": 1
    }

    result, 61 lines

    Showing lines 1-60 of 297
    1: """Plate building blocks every maker family shares (docs/visual-language.md, Plates).
    2: 
    3: A plate is a slab on one face of a segment. A Face maps 2D outline coordinates (u across, v up) and
    4: a depth w (outward) to world space, so outlines are written in plain world numbers:
    5: 
    6:   front(y)   the face at y, facing -Y   u = x       v = z
    7:   back(y)    facing +Y                  u = x       v = z
    8:   outer(x)   facing +X (the left side)  u = -y      v = z    (u grows toward the front)
    9:   inner(x)   facing -X                  u = -y      v = z
    10:   top(z)     facing up                  u = x       v = -y   (v grows toward the front)
    11: 
    12: Most plates are shells (below): closed blocks from a front and a side outline. Every plate is
    13: closed, none is hollow with its inside showing. Every plate is authored on the left (+X) and
    14: mirrored for the right unless it straddles the centre line. A maker family decides its outlines,
    15: its band, its chamfer and how each grade sizes and adds to them.
    16: """
    17: import bmesh
    18: import bpy
    19: from mathutils import Matrix, Vector
    20: 
    21: from lib import boolean, ccw, clip, copy, empty, link, loft, merge, mirror_x, solid, transform, two_view
    22: from mech import gltf_dir
    23: 
    24: 
    25: class Face:
    26:     def __init__(self, origin, u, v, w):
    27:         self.o, self.u, self.v, self.w = Vector(origin), Vector(u), Vector(v), Vector(w)
    28:         self.m = Matrix((self.u, self.v, self.w)).transposed().to_4x4()
    29:         self.m.translation = self.o
    30: 
    31:     def at(self, u, v, d=0.0):
    32:         return self.o + self.u * u + self.v * v + self.w * d
    33: 
    34:     def slab(self, outline, d0, d1):
    35:         """The outline pushed out from depth d0 to d1."""
    36:         poly = ccw(list(outline))
    37:         return transform(loft([(d0, poly), (d1, poly)]), self.m)
    38: 
    39: 
    40: def front(y):
    41:     return Face((0, y, 0), (1, 0, 0), (0, 0, 1), (0, -1, 0))
    42: 
    43: 
    44: def back(y):
    45:     return Face((0, y, 0), (1, 0, 0), (0, 0, 1), (0, 1, 0))
    46: 
    47: 
    48: def outer(x):
    49:     return Face((x, 0, 0), (0, -1, 0), (0, 0, 1), (1, 0, 0))
    50: 
    51: 
    52: def inner(x):
    53:     return Face((x, 0, 0), (0, -1, 0), (0, 0, 1), (-1, 0, 0))
    54: 
    55: 
    56: def top(z):
    57:     return Face((0, 0, z), (1, 0, 0), (0, -1, 0), (0, 0, 1))
    58: 
    59: 
    60: def bottom(z):
  • read_file{"EndLine":130,"Path":"~/work/sortie/kit/makers/shell.py","StartLine":61}

    input

    {
      "EndLine": 130,
      "Path": "~/work/sortie/kit/makers/shell.py",
      "StartLine": 61
    }

    result, 71 lines

    Showing lines 61-130 of 297
    61:     return Face((0, 0, z), (1, 0, 0), (0, 1, 0), (0, 0, -1))
    62: 
    63: 
    64: def clipped(u0, u1, v0, v1, c, taper=(0.0, 0.0), corner="tr"):
    65:     """A rectangle with one 45 degree clip of size c. `taper` insets the bottom edge from the left and
    66:     right. `corner`: tr (top right, the usual outboard top), tl, or both."""
    67:     tl, tr = taper
    68:     c = min(c, (u1 - u0) * .6, (v1 - v0) * .6)
    69:     pts = [(u0 + tl, v0), (u1 - tr, v0)]
    70:     pts += [(u1, v1 - c), (u1 - c, v1)] if corner in ("tr", "both") else [(u1, v1)]
    71:     pts += [(u0 + c, v1), (u0, v1 - c)] if corner in ("tl", "both") else [(u0, v1)]
    72:     return pts
    73: 
    74: 
    75: def clip_v(poly, lo, hi):
    76:     """The part of a polygon with lo <= v <= hi (Sutherland-Hodgman on two edges)."""
    77:     def cut(pts, keep, edge):
    78:         out = []
    79:         for i, a in enumerate(pts):
    80:             b = pts[(i + 1) % len(pts)]
    81:             ia, ib = keep(a), keep(b)
    82:             if ia:
    83:                 out.append(a)
    84:             if ia != ib:
    85:                 t = (edge - a[1]) / (b[1] - a[1])
    86:                 out.append((a[0] + (b[0] - a[0]) * t, edge))
    87:         return out
    88:     pts = cut(list(poly), lambda p: p[1] >= lo, lo)
    89:     return cut(pts, lambda p: p[1] <= hi, hi) if pts else []
    90: 
    91: 
    92: def clip_u(poly, lo, hi):
    93:     swap = [(v, u) for u, v in poly]
    94:     return [(u, v) for v, u in clip_v(swap, lo, hi)]
    95: 
    96: 
    97: class Plates:
    98:     """Collects one family's plates for a frame and writes them as solids on the joints."""
    99: 
    100:     def __init__(self, n, chamfer, roles=("main", "accent"), smooth=False):
    101:         """smooth: shade plates smooth with sharp rims, for families whose plates are curved."""
    102:         self.n, self.ch = n, chamfer
    103:         self.main, self.band_role = roles
    104:         self.smooth = smooth
    105: 
    106:     def _put(self, name, bm, role, jl, jr, bevel):
    107:         kw = dict(bevel=bevel, panels=False, smooth=self.smooth)
    108:         if jr is None:
    109:             return solid(f"{self.n}_{name}", bm, role, jl, **kw)
    110:         right = mirror_x(bm)
    111:         solid(f"{self.n}_{name}.L", bm, role, jl, **kw)
    112:         solid(f"{self.n}_{name}.R", right, role, jr, **kw)
    113: 
    114:     def plate(self, name, face, outline, t, jl, jr=None, band=None, recess=None, role=None, d0=0.0, lean=None):
    115:         """A slab of thickness t on a face, standing d0 off it. With band=(v0, v1) the slab is cut into
    116:         upper and lower pieces and a recessed band between them in the band role. `lean` (a matrix,
    117:         see shear) tilts the plate."""
    118:         role = role or self.main
    119:         slab = (lambda poly, a, b: face.slab(poly, a, b)) if lean is None else (lambda poly, a, b: transform(face.slab(poly, a, b), lean))
    120:         if band is None:
    121:             self._put(name, slab(outline, d0, d0 + t), role, jl, jr, self.ch)
    122:             return
    123:         recess = recess if recess is not None else max(.04, t * .35)
    124:         b0, b1 = band
    125:         lo, mid, hi = clip_v(outline, -1e3, b0), clip_v(outline, b0, b1), clip_v(outline, b1, 1e3)
    126:         pieces = [(f"{name}_lo", lo, role, t), (f"{name}_hi", hi, role, t), (f"{name}_band", mid, self.band_role, t - recess)]
    127:         for nm, poly, r, tt in pieces:
    128:             if len(poly) >= 3:
    129:                 self._put(nm, slab(poly, d0, d0 + tt), r, jl, jr, self.ch if r == role else self.ch * .5)
    130:

agent

+17:34
reasoning

The code snippet creates a bevel modifier, setting its width, segment count, and angle limit. The limit_method is set to "ANGLE", suggesting the bevel will only affect edges within a specific angle. The angle_limit is determined by a pre-calculated value.

The code applies a smooth shading to the mesh and sets sharp edges based on an angle. However, the interaction of set_sharp_from_angle with existing bevel operations and the export_gltf process in Blender 5.2 raises a concern. Specifically, the setting of sharp edges might not correctly change the mesh normals when an edge is beveled with one segment, particularly if the weighted normal or edge split modifiers aren't present. Need to examine whether the initial bevel operation followed by set_sharp_from_angle with no other normal-related adjustments produces the desired result.

The initial bevel with one segment divides border edges into two segments; thus, the subsequent sharp edge assignment based on a 35-degree angle will fail to identify and set sharp many critical edges. Specifically, sharp edges on tapered forms like the pauldron may not be marked due to the smaller angles formed by the beveled edges. The smoothing of these incorrectly-marked edges leads to undesirable visual artifacts, such as dark regions and inverted normals, as seen in the pauldron and house examples.

The dark ring/pillow shading is likely due to the smooth averaging of normals across beveled edges on tapered sheets, because the resulting dihedral angle falls below the sharpness threshold. Similarly, sharp ridges on the armor, like keels, are smoothed out due to the same angle limitation after beveling. This smoothing eliminates the desired crispness of the armor's design. Examining the construction of the sheet confirms this behavior.

The bevel operation combined with smooth shading creates edge angle issues, particularly on tapered forms, causing incorrect normal calculations. The current implementation's sharp edge assignment fails because beveled edges' angles fall below the sharpness threshold, leading to smoothing artifacts instead of sharp creases. A possible solution involves explicitly marking perimeter edges and ridge creases as sharp before or after the bevel operation to ensure proper normal splitting and preserve desired edge sharpness.

Initial test involves examining the effect of modifying key files and comparing the results before and after. The approach involves scrutinizing specific functions within the codebase to identify how edge smoothing and bevel operations interact. Focus is on evaluating the impact of adjusting the angle threshold used for marking sharp edges, particularly in relation to the WEIGHTED_NORMAL modifier and its application before or after the bevel operation. Specifically, the test will vary angle settings with and without applying WEIGHTED_NORMAL to see if the angle threshold change with beveling provides the desired sharp edges.

Boundary edge splitting in Sheet.bm() appears crucial for preserving sharpness, along with beveling disabled in the put() function. This combination aims to prevent normal smearing on outer faces (O) by the bevel operation. The angle-based split operation (at 12 degrees) is hypothesized to identify and sharpen boundary edges between outer faces, inner faces, and the side rim, and also ridge crests.

The use of 12° is now under closer consideration. The choice of 12 degrees is strategic: this threshold should preserve smooth curves on outer faces where adjacent face angles are small (2-6 degrees), while effectively sharpening medial keel ridges with larger angles (15-32 degrees).

The 12-degree threshold in bmesh.ops.split_edges is tested to create sharp metallic creases where the angle is greater than 12 degrees and it isolates outer face normals from the side wall's. The initial put() function likely failed because beveling with a very small value followed by a sharp edge angle of 35 degrees missed the ridge crest and the beveled perimeter, respectively. Further, the angle calculations reveal the smooth curvature steps and crease angles across various aspects of the sheet.

The hypothesis is that splitting edges exceeding 12 degrees in Sheet.bm() with bevel disabled in the put() function preserves smooth curves and sharp creases. Specifically, smooth curves formed by small angles (3-8 degrees) remain smooth, ridges with larger angles (16-35 degrees) become crisp, and sheet perimeters (~90 degrees) avoid normal leakage. Examining files such as atelier_b_houses.png is needed to locate visual artifacts.

Further investigation of knightkit.py, specifically line 499, reveals a cylindrical radius causing a prominent visual artifact: a "washboard" effect due to the radius specification. This analysis extends to frame_std.py to identify additional potential issues within the model.

  • read_file{"EndLine":170,"Path":"~/work/sortie/kit/frame_std.py","StartLine":1}

    input

    {
      "EndLine": 170,
      "Path": "~/work/sortie/kit/frame_std.py",
      "StartLine": 1
    }

    result, 171 lines

    Showing lines 1-170 of 435
    1: """The standard class inner frame (17.6 m), shared by every maker (docs/visual-language.md).
    2: 
    3: Dark roles only: frame for bones and blocks, joint for housings, cables and pistons, metal for the
    4: mount pad locks, the cockpit socket rim and the ankle pins, trim for the ring on every mount pad.
    5: Joint names and positions are the striker's (mech.joints), so poses, muzzles and harken mounts carry
    6: over. bend_knees stands the knees forward and the feet apart after the plates are on. Plates come
    7: from a maker family (kit/makers) and ride the same joints.
    8: 
    9: The frame shows at the sides and back of the neck, waist, shoulders, elbows, wrists, knees and ankles
    10: under every grade. The foot is a ball ankle in the shin's yoke, an arched sole and a hinged toe.
    11: Pistons at the hips, shoulders, elbows, knees and ankles, a cable run down every long bone. The chest
    12: carries the cockpit socket in front and the reactor drum behind it, visible through the open sides.
    13: Mount pads (one shape, `pad`) at the forearms, shoulders, backpack and hips, each with a mount.* empty.
    14: 
    15: Geometry is authored on the left (+X) in world rest pose coordinates and mirrored.
    16: """
    17: import math
    18: 
    19: import bpy
    20: from mathutils import Matrix, Vector
    21: 
    22: from lib import circle, cylinder, empty, loft, merge, mirror_x, octo, piston, rot, solid, transform, two_view
    23: from mech import gltf_dir, joints as striker_joints
    24: 
    25: HEIGHT = 17.6
    26: BEVEL = .04
    27: PAD = .72  # mount pad edge
    28: PAD_T = .08
    29: ROOF = 15.13  # the shoulder pad sits on the pauldron roof, the same height for every grade
    30: 
    31: 
    32: def box(x0, x1, y0, y1, z0, z1):
    33:     r = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]
    34:     return loft([(z0, r), (z1, r)])
    35: 
    36: 
    37: def rod(p0, p1, r, n=6):
    38:     """A plain cylinder from p0 to p1."""
    39:     p0, p1 = Vector(p0), Vector(p1)
    40:     a = p1 - p0
    41:     m = Matrix.Translation(p0) @ Vector((0, 0, 1)).rotation_difference(a.normalized()).to_matrix().to_4x4()
    42:     return transform(loft([(0, circle(r, n)), (a.length, circle(r, n))]), m)
    43: 
    44: 
    45: def basis(at, normal, up):
    46:     """A matrix whose local +Z is `normal` and local +Y is `up`, placed at `at`."""
    47:     z = Vector(normal).normalized()
    48:     y = Vector(up)
    49:     y = (y - z * y.dot(z)).normalized()
    50:     x = y.cross(z)
    51:     m = Matrix((x, y, z)).transposed().to_4x4()
    52:     m.translation = Vector(at)
    53:     return m
    54: 
    55: 
    56: def joints(tag="frame_std"):
    57:     """The striker's 22 joint rig, exact names and positions, tagged with this frame's name."""
    58:     J = striker_joints()
    59:     J["frame"]["frame"] = tag
    60:     J["frame"]["height"] = HEIGHT
    61:     return J
    62: 
    63: 
    64: def lr(J, part):
    65:     return J[part, "L"], J[part, "R"]
    66: 
    67: 
    68: def pair(name, bm_left, role, jl, jr, **kw):
    69:     bm_right = mirror_x(bm_left)
    70:     return solid(f"{name}.L", bm_left, role, jl, **kw), solid(f"{name}.R", bm_right, role, jr, **kw)
    71: 
    72: 
    73: def cable(name, pts, parent_l, parent_r=None, r=.055):
    74:     """A cable run along a bone, inside a square duct through the points, a clamp at every inner point.
    75:     Seen from behind it reads as a covered run, not a loose hose."""
    76:     duct = merge(*[rod(a, b, r * 1.6, n=4) for a, b in zip(pts, pts[1:])])
    77:     clamps = merge(*[box(p[0] - .1, p[0] + .1, p[1] - .1, p[1] + .1, p[2] - .06, p[2] + .06) for p in pts[1:-1]]) if len(pts) > 2 else None
    78:     if parent_r is None:
    79:         solid(f"{name}", duct, "frame", parent_l, .01)
    80:         if clamps:
    81:             solid(f"{name}_clamp", clamps, "joint", parent_l)
    82:     else:
    83:         pair(name, duct, "frame", parent_l, parent_r, bevel=.01)
    84:         if clamps:
    85:             pair(f"{name}_clamp", clamps, "joint", parent_l, parent_r)
    86: 
    87: 
    88: def tube(name, rings, at, parents, collars=(), n=10):
    89:     """A long bone: a faceted tube through (height, radius) rings, a joint collar at each height in
    90:     `collars`."""
    91:     pair(name, loft([(z, circle(r, n, *at)) for z, r in rings]), "frame", *parents, bevel=.03)
    92:     radius = lambda z: next(r0 + (r1 - r0) * (z - z0) / (z1 - z0) for (z0, r0), (z1, r1) in zip(rings, rings[1:]) if z0 <= z <= z1)
    93:     if collars:
    94:         cs = [loft([(z - .08, circle(radius(z) + .06, n, *at)), (z + .08, circle(radius(z) + .06, n, *at))]) for z in collars]
    95:         pair(f"{name}_collar", merge(*cs), "joint", *parents, bevel=.015)
    96: 
    97: 
    98: def pad(name, parent, at, normal, up=(0, 0, 1)):
    99:     """The common pattern mount pad: a square plate with clipped corners, four bolt bosses and a lock
    100:     ring in the middle. Every maker builds to it, so it always reads the same. `at` is the centre of
    101:     the pad's back, `normal` the way it faces. A mount.<name> empty marks the face."""
    102:     m = basis(at, normal, up)
    103:     h = PAD / 2
    104:     plate = loft([(0, octo(PAD, PAD, .12)), (PAD_T, octo(PAD, PAD, .12))])
    105:     rim = loft([(PAD_T, octo(PAD * .62, PAD * .62, .06)), (PAD_T + .025, octo(PAD * .62, PAD * .62, .06))])
    106:     lock = merge(loft([(PAD_T, circle(.15, 10)), (PAD_T + .07, circle(.15, 10))]),
    107:                  loft([(PAD_T + .07, circle(.07, 8)), (PAD_T + .1, circle(.07, 8))]))
    108:     k = h - .1
    109:     bosses = merge(*[box(x - .045, x + .045, y - .045, y + .045, PAD_T, PAD_T + .05) for x in (-k, k) for y in (-k, k)])
    110:     solid(f"pad_{name}", transform(plate, m), "frame", parent, .015)
    111:     solid(f"pad_{name}_rim", transform(rim, m), "trim", parent)
    112:     solid(f"pad_{name}_lock", transform(lock, m), "metal", parent, .01)
    113:     solid(f"pad_{name}_bolts", transform(bosses, m), "joint", parent)
    114:     face = Vector(at) + Vector(normal).normalized() * (PAD_T + .1)
    115:     empty(f"mount.{name}", face, parent, dir=gltf_dir(normal), size=PAD)
    116: 
    117: 
    118: def mirror(p):
    119:     return (-p[0], p[1], p[2])
    120: 
    121: 
    122: # Pad sites on the left, mirrored on the right: (joint, centre of the pad back, normal, up).
    123: PADS = {
    124:     "forearm": ("forearm", (3.08, 0, 10.42), (1, 0, 0), (0, 0, 1)),
    125:     "shoulder": ("shoulder", (2.42, .12, ROOF), (0, 0, 1), (0, -1, 0)),
    126:     "hip": ("pelvis", (2.04, 0, 10.92), (1, 0, 0), (0, 0, 1)),
    127: }
    128: BACK_PAD = ((0, 1.56, 13.8), (0, 1, 0), (0, 0, 1))
    129: 
    130: 
    131: def build_pelvis(J):
    132:     P = J["pelvis"]
    133:     solid("pelvis_block", loft([(9.85, octo(1.1, .95, .25)), (10.35, octo(1.6, 1.25, .3)), (10.98, octo(1.5, 1.2, .3))]),
    134:           "frame", P, BEVEL)
    135:     # hip arms reach out over the thighs and carry the holster pads
    136:     pair("hip_arm", box(.6, 1.98, -.32, .32, 10.62, 11.04), "frame", P, P, bevel=BEVEL)
    137:     pair("hip_arm_web", box(.6, 1.0, -.25, .25, 10.2, 10.62), "frame", P, P, bevel=.02)
    138:     pair("hip_socket", cylinder(.5, .55, .8, 12, axis="x", at=(0, 10.55)), "joint", P, P, smooth=True)
    139:     for s, sx in (("L", 1), ("R", -1)):
    140:         j, at, nm, up = PADS["hip"]
    141:         pad(f"hip.{s}", P, (at[0] * sx, at[1], at[2]), (nm[0] * sx, nm[1], nm[2]), up)
    142: 
    143: 
    144: def build_waist(J):
    145:     W = J["waist"]
    146:     solid("spine", cylinder(.42, 10.9, 12.1, 12), "joint", W, smooth=True)
    147:     for i, z in enumerate((11.15, 11.5, 11.85)):
    148:         solid(f"spine_ring{i}", loft([(z - .07, octo(1.15, 1.0, .25)), (z + .07, octo(1.15, 1.0, .25))]), "frame", W, .02)
    149:     # two short rams either side of the spine: the waist twists and bends on them
    150:     pair("waist_ram", piston((.62, .1, 10.95), (.62, .1, 11.95), r=.1), "joint", W, W, smooth=True)
    151:     # the spine housing closes the back of the waist, ribbed so it still reads as the joint
    152:     solid("spine_housing", loft([(10.98, octo(.9, .34, .1, y=.56)), (11.98, octo(.9, .34, .1, y=.56))]), "frame", W, .02)
    153:     for i, z in enumerate((11.2, 11.48, 11.76)):
    154:         solid(f"spine_housing_rib{i}", box(-.5, .5, .7, .78, z - .05, z + .05), "joint", W, .01)
    155: 
    156: 
    157: def build_torso(J):
    158:     T = J["torso"]
    159:     solid("chest_base", loft([(11.95, octo(1.6, 1.3, .3)), (12.55, octo(2.5, 1.9, .4))]), "frame", T, BEVEL)
    160:     # cockpit block in front, the socket the pod sits in: a metal rim round a recessed hatch
    161:     solid("cockpit_block", box(-.88, .88, -1.04, -.15, 12.5, 14.95), "frame", T, BEVEL)
    162:     rim = [box(-.66, .66, -1.16, -.98, 14.3, 14.44), box(-.66, .66, -1.16, -.98, 12.98, 13.12),
    163:            box(-.66, -.52, -1.16, -.98, 12.98, 14.44), box(.52, .66, -1.16, -.98, 12.98, 14.44)]
    164:     solid("socket_rim", merge(*rim), "metal", T, .015)
    165:     solid("socket_hatch", box(-.52, .52, -1.08, -1.0, 13.12, 14.3), "joint", T, .01)
    166:     solid("socket_seam", box(-.015, .015, -1.1, -1.07, 13.16, 14.26), "frame", T)
    167:     # the reactor drum behind the cockpit, seen through the open chest sides
    168:     solid("reactor", cylinder(.62, -1.22, 1.22, 14, axis="x", at=(.35, 13.4)), "frame", T, smooth=True)
    169:     for x in (-.85, -.3, .3, .85):
    170:         solid(f"reactor_band{x:+.1f}", cylinder(.66, x - .06, x + .06, 14, axis="x", at=(.35, 13.4)), "joint", T, smooth=True)
  • read_file{"EndLine":300,"Path":"~/work/sortie/kit/frame_std.py","StartLine":171}

    input

    {
      "EndLine": 300,
      "Path": "~/work/sortie/kit/frame_std.py",
      "StartLine": 171
    }

    result, 131 lines

    Showing lines 171-300 of 435
    171:     pair("reactor_cap", cylinder(.44, 1.22, 1.27, 14, axis="x", at=(.35, 13.4)), "joint", T, T, smooth=True)
    172:     pair("reactor_glow", cylinder(.3, 1.26, 1.29, 14, axis="x", at=(.35, 13.4)), "glow_core", T, T, outline=False)
    173:     solid("spine_block", box(-.72, .72, .72, 1.12, 12.45, 14.95), "frame", T, BEVEL)
    174:     # back panels either side of the spine block close the torso, the reactor still shows at the sides
    175:     pair("back_panel", box(.72, 1.28, .86, 1.0, 12.5, 14.42), "frame", T, T, bevel=.02)
    176:     pair("back_panel_rib", box(.8, 1.2, .98, 1.04, 13.3, 13.4), "joint", T, T, bevel=.01)
    177:     # side posts tie the base to the shoulder girdle; the reactor shows between them
    178:     for y0, y1 in ((-.9, -.62), (.75, 1.02)):
    179:         pair(f"rib{y0:+.1f}", box(1.1, 1.32, y0, y1, 12.4, 14.5), "frame", T, T, bevel=.02)
    180:     solid("girdle", box(-1.55, 1.55, -.72, .9, 14.42, 15.02), "frame", T, BEVEL)
    181:     pair("girdle_cheek", box(1.3, 1.6, -.6, .6, 14.05, 14.42), "frame", T, T, bevel=.02)
    182:     solid("neck_base", loft([(15.0, octo(1.2, 1.1, .3)), (15.28, octo(.9, .85, .25))]), "frame", T, .02)
    183:     cable("chest_cable", [(1.22, -.95, 12.6), (1.38, -.98, 13.6), (1.42, -.8, 14.4)], T, T)
    184: 
    185: 
    186: def build_head(J):
    187:     N, H = J["neck"], J["head"]
    188:     solid("neck_column", cylinder(.3, 15.15, 16.05, 10), "joint", N, smooth=True)
    189:     for i, z in enumerate((15.42, 15.7)):
    190:         solid(f"neck_ring{i}", loft([(z - .05, octo(.78, .74, .18)), (z + .05, octo(.78, .74, .18))]), "frame", N, .015)
    191:     pair("neck_ram", piston((.32, .25, 15.2), (.3, .2, 15.95), r=.06), "joint", N, N, smooth=True)
    192:     # the bare head: a sensor block with one lens, the cradle every maker's helmet bolts over
    193:     solid("head_core", box(-.4, .4, -.42, .45, 15.95, 16.72), "frame", H, .03)
    194:     solid("head_lens_ring", cylinder(.16, -.47, -.42, 12, axis="y", at=(0, 16.4)), "joint", H, smooth=True)
    195:     solid("head_lens", cylinder(.11, -.49, -.46, 12, axis="y", at=(0, 16.4)), "glow_eye", H, outline=False)
    196: 
    197: 
    198: def build_arms(J):
    199:     S, UA, FA, HA = lr(J, "shoulder"), lr(J, "upperarm"), lr(J, "forearm"), lr(J, "hand")
    200:     pair("shoulder_housing", cylinder(.5, 1.5, 2.15, 14, axis="x", at=(0, 14.6)), "joint", *S, smooth=True)
    201:     pair("shoulder_block", box(2.1, 2.85, -.48, .48, 14.15, 15.1), "frame", *S, bevel=BEVEL)
    202:     # the shoulder pad sits on a pedestal that flares up to the pad's size, not a post
    203:     pair("shoulder_pedestal", loft([(15.0, octo(.56, .5, .1, x=2.42, y=.12)), (ROOF, octo(.68, .64, .14, x=2.42, y=.12))]), "frame", *S,
    204:          bevel=.02)
    205:     # shoulder rams from the chest corners up to the block, front and back
    206:     for k, y in (("f", -.62), ("b", .62)):
    207:         pair(f"shoulder_ram_{k}", piston((1.28, y, 13.1), (2.15, y * .8, 14.3), r=.11), "joint", *S, smooth=True)
    208:     pair("upperarm_swivel", cylinder(.42, 13.92, 14.32, 12, at=(2.45, 0)), "joint", *UA, smooth=True)
    209:     tube("upperarm_bone", [(12.35, .29), (13.95, .33)], (2.45, 0), UA, collars=(12.6, 13.7))
    210:     for k, (x0, x1) in (("i", (2.02, 2.16)), ("o", (2.74, 2.88))):
    211:         pair(f"elbow_fork_{k}", box(x0, x1, -.36, .36, 11.6, 12.55), "frame", *UA, bevel=.02)
    212:     cable("upperarm_cable", [(2.45, .4, 13.95), (2.45, .44, 13.1), (2.45, .4, 12.3)], *UA)
    213:     pair("elbow", cylinder(.42, 2.0, 2.9, 14, axis="x", at=(0, 11.95)), "joint", *FA, smooth=True)
    214:     tube("forearm_bone", [(9.88, .27), (11.7, .31)], (2.5, 0), FA, collars=(10.0, 11.5))
    215:     pair("elbow_ram", piston((2.5, .52, 12.55), (2.5, .42, 10.85), r=.09), "joint", *FA, smooth=True)
    216:     pair("pad_post", box(2.74, 3.08, -.2, .2, 10.2, 10.64), "frame", *FA, bevel=.02)
    217:     cable("forearm_cable", [(2.18, -.28, 11.6), (2.16, -.3, 10.8), (2.2, -.26, 10.0)], *FA)
    218:     for s, sx in (("L", 1), ("R", -1)):
    219:         j, at, nm, up = PADS["forearm"]
    220:         pad(f"forearm.{s}", J["forearm", s], (at[0] * sx, at[1], at[2]), (nm[0] * sx, nm[1], nm[2]), up)
    221:         j, at, nm, up = PADS["shoulder"]
    222:         pad(f"shoulder.{s}", J["shoulder", s], (at[0] * sx, at[1], at[2]), nm, up)
    223:     # bare hands: the frame's own
    224:     pair("wrist", cylinder(.28, 9.42, 9.86, 10, at=(2.5, 0)), "joint", *HA, smooth=True)
    225:     pair("palm", loft([(8.9, octo(.5, .82, .1, x=2.52)), (9.5, octo(.46, .8, .1, x=2.52))]), "frame", *HA, bevel=.02)
    226:     pair("fingers", loft([(8.75, octo(.42, .82, .13, x=2.27)), (9.35, octo(.44, .82, .13, x=2.27))]), "frame", *HA, bevel=.025)
    227:     pair("thumb", loft([(9.02, octo(.24, .24, .06, x=2.32, y=-.5)), (9.4, octo(.26, .26, .06, x=2.38, y=-.46))]), "frame", *HA,
    228:          bevel=.02)
    229:     pair("knuckles", box(2.62, 2.8, -.36, .36, 9.0, 9.42), "joint", *HA, bevel=.02)
    230: 
    231: 
    232: def build_legs(J):
    233:     TH, SH, FT = lr(J, "thigh"), lr(J, "shin"), lr(J, "foot")
    234:     pair("hip_ball", cylinder(.47, .8, 1.55, 12, axis="x", at=(0, 10.55)), "joint", *TH, smooth=True)
    235:     tube("thigh_bone", [(6.55, .42), (8.0, .5), (9.3, .54), (10.25, .48)], (1.16, 0), TH, collars=(7.0, 9.75))
    236:     for k, (x0, x1) in (("i", (.58, .72)), ("o", (1.68, 1.82))):
    237:         pair(f"knee_fork_{k}", box(x0, x1, -.4, .4, 5.75, 6.8), "frame", *TH, bevel=.02)
    238:     # hip rams: a long one down the back of the thigh, a short one at the front
    239:     pair("hip_ram_b", piston((1.15, .72, 10.45), (1.17, .7, 7.9), r=.13), "joint", *TH, smooth=True)
    240:     pair("hip_ram_f", piston((.8, -.68, 10.35), (.9, -.64, 9.15), r=.1), "joint", *TH, smooth=True)
    241:     cable("thigh_cable", [(.56, .3, 10.0), (.52, .34, 8.4), (.56, .3, 6.9)], *TH)
    242:     pair("knee", cylinder(.47, .7, 1.7, 14, axis="x", at=(0, 6.1)), "joint", *SH, smooth=True)
    243:     # slim under the knee, so the shin plate can be narrow there
    244:     tube("shin_bone", [(1.95, .36), (3.2, .46), (5.0, .36), (5.75, .42)], (1.2, .05), SH, collars=(2.4,))
    245:     pair("knee_ram", piston((1.2, .74, 7.35), (1.2, .8, 5.0), r=.11), "joint", *SH, smooth=True)
    246:     pair("ankle_ram", piston((1.2, .66, 3.2), (1.2, .8, 1.85), r=.08), "joint", *SH, smooth=True)
    247:     for k, (x0, x1) in (("i", (.7, .82)), ("o", (1.58, 1.7))):
    248:         pair(f"ankle_fork_{k}", box(x0, x1, -.26, .26, 1.34, 2.08), "frame", *SH, bevel=.02)
    249:     cable("shin_cable", [(.9, .36, 5.5), (.84, .42, 3.8), (.9, .36, 2.3)], *SH)
    250:     build_foot(J)
    251: 
    252: 
    253: # The foot is drawn at one size and then fitted: widened, shortened and turned out a touch about the
    254: # ankle. Every foot part, frame and plate, goes through place_foot().
    255: TURN = 6.0
    256: FOOT_SCALE = (1.45, .82)  # across and along
    257: ANKLE = (1.2, .1, 1.55)
    258: 
    259: 
    260: def place_foot(bm):
    261:     a = Vector((ANKLE[0], ANKLE[1], 0))
    262:     m = Matrix.Diagonal((FOOT_SCALE[0], FOOT_SCALE[1], 1, 1))
    263:     return transform(bm, rot("Z", TURN, about=a) @ Matrix.Translation(a) @ m @ Matrix.Translation(-a))
    264: 
    265: 
    266: def ball(r, at, n=12):
    267:     """A faceted sphere."""
    268:     rings = [(at[2] + r * math.cos(math.pi * i / 6), circle(max(r * math.sin(math.pi * i / 6), .01), n, at[0], at[1])) for i in range(6, -1, -1)]
    269:     return loft(rings)
    270: 
    271: 
    272: def build_foot(J):
    273:     """A foot that carries weight: a ball ankle in the shin's yoke, set in a cup on an A frame
    274:     pedestal, a sole with an arch between heel and ball, a toe block on a hinge. Toe longer than heel."""
    275:     FT = lr(J, "foot")
    276:     x, y, z = ANKLE
    277:     pair("ankle", ball(.36, ANKLE), "joint", *FT, smooth=True)
    278:     pair("ankle_pin", cylinder(.17, .62, 1.78, 10, axis="x", at=(y, z)), "metal", *FT, smooth=True)
    279:     pair("ankle_cup", place_foot(loft([(1.22, octo(.9, .86, .22, x=x, y=y)), (1.36, octo(.78, .76, .2, x=x, y=y))])), "joint", *FT, bevel=.015)
    280:     pair("ankle_pedestal", place_foot(two_view([(.84, 1.24), (1.56, 1.24), (1.64, .5), (.76, .5)],
    281:                                          [(-.3, 1.24), (.46, 1.24), (.9, .5), (-.8, .5)])), "frame", *FT, bevel=BEVEL)
    282:     # the rear foot: heel and arch on one sole, the hinge at the ball
    283:     plan = [(.82, 1.16), (1.58, 1.16), (1.72, .86), (1.74, -1.48), (.66, -1.48), (.68, .86)]
    284:     arch = [(-1.48, .3), (-1.48, 0), (-1.1, 0), (-.9, .14), (.3, .14), (.5, 0), (1.04, 0), (1.18, .14), (1.18, .3)]
    285:     pair("sole", place_foot(two_view([(.6, 0), (1.8, 0), (1.8, .3), (.6, .3)], arch, plan)), "joint", *FT, bevel=.02)
    286:     pair("foot_frame", place_foot(two_view([(.76, .29), (1.64, .29), (1.58, .62), (.82, .62)],
    287:                                      [(-1.44, .29), (1.08, .29), (.98, .64), (-1.38, .5)])), "frame", *FT, bevel=BEVEL)
    288:     pair("toe_hinge", place_foot(cylinder(.14, .76, 1.64, 10, axis="x", at=(-1.56, .26))), "joint", *FT, smooth=True)
    289:     toe_plan = [(.7, -1.62), (1.7, -1.62), (1.68, -2.3), (1.5, -2.58), (.9, -2.58), (.72, -2.3)]
    290:     pair("toe_frame", place_foot(two_view([(.6, .06), (1.8, .06), (1.8, .44), (.6, .44)],
    291:                                     [(-1.62, .06), (-2.5, .06), (-2.6, .16), (-2.48, .3), (-1.62, .44)], toe_plan)), "frame", *FT,
    292:          bevel=BEVEL)
    293:     pair("toe_sole", place_foot(two_view([(.6, 0), (1.8, 0), (1.8, .07), (.6, .07)], [(-1.62, 0), (-2.5, 0), (-2.5, .07), (-1.62, .07)],
    294:                                    toe_plan)), "joint", *FT, bevel=.015)
    295:     pair("heel_frame", place_foot(box(.82, 1.58, .56, 1.12, .28, .62)), "frame", *FT, bevel=.02)
    296: 
    297: 
    298: def build_backpack(J):
    299:     B = J["backpack"]
    300:     solid("back_mount", box(-.86, .86, 1.1, 1.56, 12.9, 14.72), "frame", B, BEVEL)

agent

+18:45
reasoning

The FOOT_SCALE values appear to define the scaling factor for the foot model; the tuple likely represents scaling along the "across" and "along" axes. Inspecting the context of the code, a value of (1.45, 0.82) is used for these foot scales.

The scaling factor (1.45, 0.82) applied by place_foot significantly alters the foot model's dimensions. This scaling widens the foot by 1.45 and shortens it by 0.82, leading to a stubbier, wider appearance than intended, as observed in the visualizations. This explains the discrepancy in foot appearance within atelier_b_houses.png and atelier_a_houses.png, where the feet are not the sleek shape as intended and expected.

The scaling applied by place_foot causes the feet to appear overly wide and short due to the combined effect of scaling the foot model and the exposed rectangular toe frame. The FOOT_SCALE values cause a significant dimensional change, leading to the observed discrepancy in the generated images. This issue persists even when using tapered foot models like sabatons.

The described armor components, cover_fauld_side and cover_fauld_front, are inappropriately placed such that they extend beyond the intended breastplate and crotch armor, causing visual artifacts. A beveling operation on armor sheets, using a small bevel and sharp angle settings, produces unexpected smoothing. The smoothing effect removes crisp edges that are essential to the intended armor aesthetics, turning sharp creases into rounded shapes.

Initial hypothesis: The striker mech's visual presentation is significantly impacted by unposed skeletal joints in viewer.ts coupled with default material properties. The mech model relies on a fixed palette and look, resulting in a matte appearance with muted colors and no dynamic elements like weapons or thrusters. The current state represents a foundational issue, not a rendering artifact of a completed asset. The lack of skeletal posing and default materials explain the unappealing initial visual quality.

Now checking how the edge splitting can improve edge details.

Beveling at 12° edge splits enhances edge detail by providing clean splits for the sheet's outer surface, keel ridges, and perimeter. Adjustments to cover_armpit now tuck it inside the armpit to cover the shoulder rams behind the breastplate. Modifications to cover_fauld remove the front cover and reposition the side cover for proper under-tasset placement. Furthermore, adjustments were made in shoulder_root to ensure the clean coverage of the shoulder housing. The protruding elements like shoulder_block and pad_shoulder were also hidden under the pauldron when applicable.

  • read_file{"Path":"~/work/sortie/kit/lab/atelier_board.py"}

    input

    {
      "Path": "~/work/sortie/kit/lab/atelier_board.py"
    }

    result, 65 lines

    Showing lines 1-64 of 64
    1: """The atelier's four house lines, each in three grades, one lab per line (docs/study-atelier.md):
    2: 
    3:   lab_atelier_a  Harness  plate armour taken seriously     (board_plate)
    4:   lab_atelier_b  Estoc    sleek, few shapes, sharp points  (board_sleek)
    5:   lab_atelier_c  Blazon   bold heraldic, per pale          (board_heraldic)
    6:   lab_atelier_d  Tilt     lopsided tourney harness         (board_tourney)
    7: 
    8: Slots along X: slot1 light, slot2 medium, slot3 heavy. Round 1's medium for reference is lab_atelier's
    9: slot2 (kit/lab/atelier_lab.py). In the houses' livery:
    10: 
    11:     /?view=lab_atelier_c&only=slot2&tx=20&palette=houses&bg=studio
    12: 
    13: ATELIER_SLOTS=1,2 builds only those slots.
    14: """
    15: import os
    16: 
    17: import bpy
    18: from mathutils import Matrix
    19: 
    20: import board_heraldic
    21: import board_plate
    22: import board_sleek
    23: import board_tourney
    24: import frame_std
    25: from lib import attach, empty
    26: from makers import atelier
    27: from makers.shell import Plates
    28: 
    29: SPACING = 10.0
    30: GRADES = ("light", "medium", "heavy")
    31: KNEE = {"light": .41, "medium": .40, "heavy": .39}  # round 1's .43 left a tenth of a metre of thigh
    32: LINES = {"a": ("Harness", board_plate.plates), "b": ("Estoc", board_sleek.plates), "c": ("Blazon", board_heraldic.plates),
    33:          "d": ("Tilt", board_tourney.plates)}
    34: 
    35: 
    36: def _place(frame, slot):
    37:     attach(frame, slot)
    38:     frame.matrix_parent_inverse = Matrix.Identity(4)
    39:     frame.location = (0, 0, 0)
    40:     bpy.context.view_layer.update()
    41: 
    42: 
    43: def stance(J, knee):
    44:     frame_std.bend_knees(J, splay=atelier.SPLAY)
    45:     frame_std.proportion(J, atelier.crown_z(J), knee=knee, crotch=atelier.CROTCH_AT, crown=atelier.CROWN, shoulders=atelier.SHOULDER_OUT)
    46: 
    47: 
    48: def build(line, g):
    49:     name, plates = LINES[line]
    50:     J = frame_std.build_frame(f"atelier_{name.lower()}_{g}")
    51:     plates(J, Plates(f"k{line}", atelier.CHAMFER, smooth=True), g)
    52:     stance(J, KNEE[g])
    53:     return J["frame"]
    54: 
    55: 
    56: def build_atelier_line(line):
    57:     only = os.environ.get("ATELIER_SLOTS")
    58:     root = empty("lab", (0, 0, 0))
    59:     for i, g in enumerate(GRADES, 1):
    60:         if only and str(i) not in only.split(","):
    61:             continue
    62:         slot = empty(f"slot{i}", (i * SPACING, 0, 0), root, label=f"{LINES[line][0]} {g}")
    63:         _place(build(line, g), slot)
    64:     return root