@babylonjs-toolkit/agent 1.2.16 → 1.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/package.json +1 -1
- package/skills/bt-blender/SKILL.md +386 -0
- package/skills/bt-blender/THIRD_PARTY_NOTICES.md +141 -0
- package/skills/bt-blender/references/art-style-and-genre.md +173 -0
- package/skills/bt-blender/references/characters-and-creatures.md +644 -0
- package/skills/bt-blender/references/environments.md +478 -0
- package/skills/bt-blender/references/game-engine-export.md +284 -0
- package/skills/bt-blender/references/geometry-nodes.md +447 -0
- package/skills/bt-blender/references/hard-surface.md +720 -0
- package/skills/bt-blender/references/procedural-generation.md +358 -0
- package/skills/bt-blender/references/rigging-and-animation.md +1080 -0
- package/skills/bt-blender/references/sculpting-and-retopology.md +544 -0
- package/skills/bt-blender/references/uv-and-pbr-materials.md +381 -0
- package/skills/bt-blender/references/vehicles.md +632 -0
- package/skills/bt-blender/scripts/blender/assembly_check.py +420 -0
- package/skills/bt-blender/scripts/blender/character_blockout.py +462 -0
- package/skills/bt-blender/scripts/blender/construction_kit.py +1710 -0
- package/skills/bt-blender/scripts/blender/environment_kit.py +525 -0
- package/skills/bt-blender/scripts/blender/export_asset.py +623 -0
- package/skills/bt-blender/scripts/blender/geometry_nodes_builders.py +575 -0
- package/skills/bt-blender/scripts/blender/hard_surface_panels.py +374 -0
- package/skills/bt-blender/scripts/blender/hard_surface_trims.py +200 -0
- package/skills/bt-blender/scripts/blender/image_measure.py +568 -0
- package/skills/bt-blender/scripts/blender/materials_pbr.py +439 -0
- package/skills/bt-blender/scripts/blender/measure_stations.py +486 -0
- package/skills/bt-blender/scripts/blender/ortho_views.py +309 -0
- package/skills/bt-blender/scripts/blender/procedural_game_ready.py +258 -0
- package/skills/bt-blender/scripts/blender/procedural_generators.py +842 -0
- package/skills/bt-blender/scripts/blender/qa_check.py +729 -0
- package/skills/bt-blender/scripts/blender/retopology_tools.py +781 -0
- package/skills/bt-blender/scripts/blender/review_render.py +358 -0
- package/skills/bt-blender/scripts/blender/rigging_tools.py +1170 -0
- package/skills/bt-blender/scripts/blender/style_palette.py +190 -0
- package/skills/bt-blender/scripts/blender/tool_common.py +289 -0
- package/skills/bt-blender/scripts/blender/uv_layout.py +555 -0
- package/skills/bt-blender/scripts/blender/vehicle_parts.py +370 -0
- package/skills/bt-blender/scripts/blender/view_consistency.py +133 -0
- package/skills/bt-blender/scripts/blender/world_gate.py +219 -0
- package/skills/bt-blender/scripts/bt-blender.mjs +329 -0
- package/skills/bt-blender/scripts/validate_gltf.mjs +204 -0
- package/skills/bt-gauntlet/SKILL.md +6 -6
- package/skills/bt-gauntlet/references/critic-rubrics.md +71 -4
- package/skills/bt-gauntlet/references/spec-composition.md +13 -0
- package/skills/bt-gauntlet/references/unity-pipeline.md +18 -2
- package/skills/bt-unwrap/scripts/blender/__pycache__/bt_unwrap.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/image_utils.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/mesh_tools.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/model_io.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/previews.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/rasterizer.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/reference_views.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/reference_warp.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/texture_bake.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/texture_compose.cpython-313.pyc +0 -0
- package/skills/bt-unwrap/scripts/blender/__pycache__/uv_layout.cpython-313.pyc +0 -0
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
# Vehicle modelling: references, stance, shells, wheels, pivots, interiors and LODs
|
|
2
|
+
|
|
3
|
+
**Load this when** the asset drives, flies, floats or rolls: cars, karts, buggies, trucks, motorbikes,
|
|
4
|
+
aircraft, boats, tanks, carts and machines with wheels or hinged parts. Load it for the blueprint setup, the
|
|
5
|
+
proportion and stance check, the body shell, wheels and tyres, the pivot hierarchy an engine animates,
|
|
6
|
+
cockpits, and LODs.
|
|
7
|
+
|
|
8
|
+
**What it assumes.** The Agent Reference's Blender guide (`references/unity-blender-cli.md`) covers the basics:
|
|
9
|
+
§8.4b for measuring against the references, with the brief, the view-agreement check, stations and the
|
|
10
|
+
world-scale gate; §8.4d for the construction kit. `hard-surface.md` covers cuts, bevels, normals, trims and
|
|
11
|
+
decals on the body. This file goes deeper on what is specific to vehicles.
|
|
12
|
+
|
|
13
|
+
**Helpers.** `scripts/blender/vehicle_parts.py` provides:
|
|
14
|
+
- `wheel`, `wheel_profile`, `tread_lugs`, `radial_array` and `rolling_radius` for wheels;
|
|
15
|
+
- `mount_wheel` and `set_origin` for the pivot hierarchy;
|
|
16
|
+
- `pivot_report` and `stance_report` for the proof;
|
|
17
|
+
- `outline_kinks` and `stations_from_outlines` for the body;
|
|
18
|
+
- `lod_chain` for LODs.
|
|
19
|
+
|
|
20
|
+
Every recipe below is a complete script. Run it with
|
|
21
|
+
`node <skill>/scripts/bt-blender.mjs run recipe.py <out folder>`.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1. The professional workflow
|
|
26
|
+
|
|
27
|
+
1. **Collect real dimensions first.** Get the wheelbase, track, length, height and tyre size of the real or
|
|
28
|
+
designed vehicle. Real dimensions beat any blueprint.
|
|
29
|
+
2. **Set up the references and the scale** (section 2). The wheelbase sets every view's scale, so check the
|
|
30
|
+
views agree (`view-consistency`) and settle the disagreements once.
|
|
31
|
+
3. **Block out with a proxy box and four wheel cylinders** at the real dimensions. Camera-match the references,
|
|
32
|
+
and expect the first match to be wrong. Gate the blockout with `world-gate` and `stance_report` before any
|
|
33
|
+
detail (section 3).
|
|
34
|
+
4. **Wheel arches and wheels first.** Arches and wheels are what the eye locks onto. Experienced vehicle artists
|
|
35
|
+
start the body at the wheel wells and work outwards.
|
|
36
|
+
5. **Build the body shell** from the traced outlines (section 4). Cut panel lines last.
|
|
37
|
+
6. **Model the wheels and the separate moving parts, and set every pivot** (sections 5 and 6).
|
|
38
|
+
7. **Add the interior to what the camera sees** (section 7), then **LODs** (section 8), then export.
|
|
39
|
+
8. **Check in orthographic views as well as perspective.** A body can look right in perspective and be wrong
|
|
40
|
+
in ortho.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 2. References and blueprint setup
|
|
45
|
+
|
|
46
|
+
| Decision | Professional practice |
|
|
47
|
+
|---|---|
|
|
48
|
+
| Scale anchor | The **wheelbase**, measured hub centre to hub centre in the side view, sets that view's pixels per metre. Lock the top view to the same wheelbase. Never re-estimate the scale per round. |
|
|
49
|
+
| View set | Cut each view (front, side, top, back) into its own image. Register it in `refs/spec.json` with `pixels_per_metre` and `origin_pixel`. Put the origin on the ground under the vehicle centre, with Y = 0 at mid-wheelbase or at the front axle, decided once. |
|
|
50
|
+
| Disagreeing views | Expect them. Practitioners report that nearly every blueprint they used had errors, and two views agreeing while the third is off is the norm. Pick one anchor view per axis (top for width and length, side for height and length), align the others to a fixed line such as the axle or a door shut line, and **write the decision in the brief**. |
|
|
51
|
+
| Photos | Photos settle disagreements, but lenses distort. Use long-lens shots near the axle height, and solve their cameras with `bt-unwrap --analyze` before measuring. |
|
|
52
|
+
| CAD or scans | When they exist, model over them. Blueprints are shape guides, not truth. |
|
|
53
|
+
|
|
54
|
+
**Length disagreements between views are a decision, not a tuning knob.** In one production build the top view
|
|
55
|
+
put the front overhang 0.13 m longer than the side view. The fix that held:
|
|
56
|
+
- sweep the disputed length;
|
|
57
|
+
- score each value on the WEAKER view's silhouette IoU and on the station grades together;
|
|
58
|
+
- pick the lowest value at which every station stays MATCH or CLOSE;
|
|
59
|
+
- record the split in the brief.
|
|
60
|
+
|
|
61
|
+
Pure silhouette maximisation chose a length at which the top view's stations went WRONG, because the part was
|
|
62
|
+
hidden under another part in that view.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 3. Proportions and stance
|
|
67
|
+
|
|
68
|
+
Stance is mostly the tyre's relation to the arch and the track's relation to the body. Measure these on the
|
|
69
|
+
reference and on the model (`stance_report`) and grade them like stations.
|
|
70
|
+
|
|
71
|
+
| Number | What it controls | Typical real values | Stylised (cartoon cars, karts, toys) |
|
|
72
|
+
|---|---|---|---|
|
|
73
|
+
| Wheelbase / length | Cabin space, dynamic or static feel | Short overhangs ("a wheel at each corner") read sporty. Unequal front and rear overhangs read dynamic; equal ones read static | Short wheelbase, wheels pushed to the corners |
|
|
74
|
+
| Track / body width | Planted or tippy | Tyres flush with the arch lip on sporty cars | Wheels outside the body (open-wheel) |
|
|
75
|
+
| Wheel diameter / overall height | Toy or truck feel | About 0.45-0.55 on cars | Oversized wheels, 0.6 and above on karts and cartoon cars |
|
|
76
|
+
| Arch gap / wheel diameter | Ride height feel | 15-20 % on road cars, 8-12 % on track cars (vendor figures, unverified) | Near zero, or no arch at all |
|
|
77
|
+
| Ride height (body underside) | Stance and clearance | Road, sport and off-road differ by tens of millimetres | Exaggerated low, or comically high |
|
|
78
|
+
| Cabin position | Cab-rearward reads fast; cab-forward reads roomy | Small shifts change the stance | Oversized cabin or driver |
|
|
79
|
+
| Tumblehome and tuck-under | Lean-in of the glass; lower bodyside pulled in | More lean-in reads sportier; tuck-under shows the tyre | Exaggerated |
|
|
80
|
+
|
|
81
|
+
Fix the numbers in this order: wheels and wheelbase, then track, then overhangs, then ride height, then the
|
|
82
|
+
cabin. A wrong wheelbase makes every later station wrong.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 4. The body shell
|
|
87
|
+
|
|
88
|
+
| Form | Build it with | Rules |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| Main shell, nose, tail, fuselage, hull | **Loft of rounded sections from traced outlines** (`stations_from_outlines` + `kit.loft`) | Read width from the top-view trace, top and bottom from the side-view trace, and corner radii from the front view. Interpolate linearly. Put a station at every kink of every outline (`outline_kinks`). |
|
|
91
|
+
| Arches, pods, cheeks, scoops, wing roots, bumpers blending into the body | **Subdivision cage on the design lines** (`kit.design_line_cage` + `kit.subdivision_cage`), one cage for everything that flows together | Edge loops run fully round the arch. Poles go on flat areas. Spacing stays even across highlights. A sharpness per line (see "Rounded bodywork" below). |
|
|
92
|
+
| Wings, spoilers, fins, endplates | **Planform x section**: trace the leading and trailing edges in the top view, then loft a NACA-like section defined as fractions of the local chord, with absolute thickness from the side view; endplates are filleted outlines extruded and rounded inward | Never a bevelled box, and never Solidify outwards from a traced line |
|
|
93
|
+
| Grilles, lamps, vents, badges | Separate inserts sunk 1-2 mm, or trims and decals | See `hard-surface.md` |
|
|
94
|
+
|
|
95
|
+
**One shell or panels?** Keep the body one connected shell ("model connected, cut apart later"). Separate only
|
|
96
|
+
what animates (doors, hood, flaps) or what needs its own material. Inner and outer panels that sit close
|
|
97
|
+
together share topology, or the inner one pokes through. Panel gaps follow the edge loops, and the loops follow
|
|
98
|
+
the character lines and highlights.
|
|
99
|
+
|
|
100
|
+
**Why lofted bodies come out fat**, and the rule that prevents each cause:
|
|
101
|
+
|
|
102
|
+
| Cause | What happened | Rule |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| A free table of section widths | Separate top and bottom half-widths per station put the flare of one view into the other; the plan width came out 38-48 % over | Derive every section from the traces. The plan view is an envelope: no vertex exceeds the plan half-width at its station (`stations_from_outlines` builds inside it) |
|
|
105
|
+
| Smooth interpolation between stations | Auto-Bézier handles and blended bridges overshoot a waist in the plan | Interpolate linearly, and add stations where the form changes |
|
|
106
|
+
| Uniform scaling of one template section | Scaling to the plan width also grew the height, so the rear third came out 16-18 % deep | Scale width and height independently (`rounded_section(width, height, ...)`) |
|
|
107
|
+
| Thickness added outside a traced line | Solidify offset outward, or flipped normals, made a wing tip 41 px thick against 20 | Model the outer surface on the line, and give thin parts absolute thickness inward |
|
|
108
|
+
|
|
109
|
+
### Rounded bodywork: the professional method
|
|
110
|
+
|
|
111
|
+
`hard-surface.md` section 3a gives the method in general: design lines first, a sparse quad cage between them, a
|
|
112
|
+
sharpness per line, poles only where it is flat, zebra in both directions. On a vehicle it works out like this.
|
|
113
|
+
|
|
114
|
+
1. **Name the lines from the reference views before any geometry.** For a nose, for example: the centre line
|
|
115
|
+
(the mirror seam), the hood's shoulder and lip, the edge where the nose face meets the cheek, the valley of
|
|
116
|
+
the cheek, the inner rim of a headlight pod, its crest, its outer shoulder, the foot where it meets the
|
|
117
|
+
front wing, and the brow over the lamp. Give each its sharpness in the brief: crisp (crease 1.0), fold
|
|
118
|
+
(0.3 to 0.6), roll with a radius (holding loops at r / 0.57), or smooth.
|
|
119
|
+
2. **One cage per side for everything that flows together.** The face, the cheeks and a headlight pod are one
|
|
120
|
+
`design_line_cage`, mirrored, with stations along the length and the named lines across. Built as separate
|
|
121
|
+
parts that butt together, the pods read as curved scoops stuck on the nose instead of sculpted wedges flowing
|
|
122
|
+
into it, however smooth each part is: that was the main shortfall of an otherwise smooth prototype. Use 7 to 9
|
|
123
|
+
stations, with one at every outline kink (`vehicle.outline_kinks`).
|
|
124
|
+
3. **Fair each line along its length** (`fair_passes`), never across a crisp line, then clamp it back to the
|
|
125
|
+
traces. A tight roll magnifies every kink in its line.
|
|
126
|
+
4. **Openings in the cage**: the lamp socket under the brow and an intake slot under the lip are quad rings
|
|
127
|
+
inset into the cage before subdividing, with their rims creased 1.0. The lamp and lens are separate inserts
|
|
128
|
+
set back into the socket.
|
|
129
|
+
5. **Join the cage to a lofted body** by giving the cage's rear ring the loft's front-ring vertex count and
|
|
130
|
+
bridging them (`bmesh.ops.bridge_loops`), or let a lip overhang the joint by 5 to 10 mm and sink the joint
|
|
131
|
+
under it.
|
|
132
|
+
6. **Budget from the start.** A pod and nose prototype came out at 10,500 triangles against about 8,000, with
|
|
133
|
+
these savings estimated:
|
|
134
|
+
- open the faces nothing sees (pod rears, the nose underside), about 1,200;
|
|
135
|
+
- set a short, straight fold with a crease instead of two holding lines, about 1,000;
|
|
136
|
+
- make small inserts plain meshes, not cages, about 400.
|
|
137
|
+
|
|
138
|
+
**Thin aero parts are sections, not subdivided slabs.**
|
|
139
|
+
- **A wing is a section lofted along the span** (`kit.loft`, not subdivided). The section is NACA-like: a
|
|
140
|
+
rounded leading edge of radius about 1.1019 t² of the chord, thickest at about 30 % chord, a 2 to 3 mm trailing
|
|
141
|
+
edge (a knife edge aliases), 12 to 16 points. Take the absolute thickness from the side view and the chord
|
|
142
|
+
from the top view, with a station at every planform kink. Taper the tips over two stations in the last
|
|
143
|
+
1.5 × thickness of span (chord 0.85 then 0.6, thickness 0.8 then 0.5), and close them with quad caps (an even
|
|
144
|
+
point count). The tip then reads round in plan and in front view without growing past the traced outline.
|
|
145
|
+
- **An endplate is a filleted outline extruded** symmetrically about its traced mid-plane to its absolute
|
|
146
|
+
thickness, then rounded with a weight-limited bevel on the perimeter at width 0.45 × thickness, 3 segments,
|
|
147
|
+
profile 0.5. A bevel cuts inward, so the round never makes the plate thicker, and a width under half the
|
|
148
|
+
thickness keeps the two rounds apart.
|
|
149
|
+
- Junctions are hidden intersections: the wing runs 2 to 3 mm into the body and into the endplate. No boolean
|
|
150
|
+
union.
|
|
151
|
+
|
|
152
|
+
### Recipe: a front wing and an endplate from sections
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
"""Thin aero parts: a front wing lofted from a NACA-like section through span stations, its tips tapered over
|
|
156
|
+
two stations and closed with quad caps, and an endplate extruded from a filleted outline with an inward edge
|
|
157
|
+
round. Saves aero.blend and prints the measured sizes."""
|
|
158
|
+
import json
|
|
159
|
+
import math
|
|
160
|
+
import os
|
|
161
|
+
import sys
|
|
162
|
+
|
|
163
|
+
import bmesh
|
|
164
|
+
import bpy
|
|
165
|
+
import numpy as np
|
|
166
|
+
from mathutils import Matrix
|
|
167
|
+
|
|
168
|
+
import construction_kit as kit
|
|
169
|
+
|
|
170
|
+
out_folder = sys.argv[sys.argv.index("--") + 1]
|
|
171
|
+
CHORD, THICKNESS, HALF_SPAN = 0.25, 0.03, 0.60 # absolute sizes from the top and side views
|
|
172
|
+
TRAILING_EDGE = 0.0025 # 2-3 mm: a knife edge aliases
|
|
173
|
+
POINTS_PER_SIDE = 7 # 16 section points: even, so the tips cap with quads
|
|
174
|
+
TIP_TAPER = ((0.85, 0.80), (0.60, 0.50)) # (chord, thickness) shares at the two tip stations
|
|
175
|
+
PLATE_THICKNESS = 0.007
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def wing_section(chord, thickness):
|
|
179
|
+
"""Closed (x, z) section, leading edge at x = 0: the NACA 4-digit thickness form (leading-edge radius
|
|
180
|
+
1.1019 t^2 of the chord, thickest at 30 % chord) opened to a blunt trailing edge."""
|
|
181
|
+
ratio = thickness / chord
|
|
182
|
+
|
|
183
|
+
def half_thickness(x):
|
|
184
|
+
naca = 5.0 * ratio * (0.2969 * math.sqrt(x) - 0.1260 * x - 0.3516 * x ** 2 + 0.2843 * x ** 3 - 0.1015 * x ** 4)
|
|
185
|
+
closing = 5.0 * ratio * (0.2969 - 0.1260 - 0.3516 + 0.2843 - 0.1015)
|
|
186
|
+
return chord * (naca + x * (TRAILING_EDGE / (2.0 * chord) - closing))
|
|
187
|
+
|
|
188
|
+
# Cosine spacing packs points into the leading edge. The upper side runs trailing edge to leading edge
|
|
189
|
+
# (x = 0) and the lower side back on half steps, so the count stays even with one leading-edge point.
|
|
190
|
+
upper = [(1.0 - math.cos(math.pi * index / POINTS_PER_SIDE)) / 2.0 for index in range(POINTS_PER_SIDE, -1, -1)]
|
|
191
|
+
lower = [(1.0 - math.cos(math.pi * (index - 0.5) / (POINTS_PER_SIDE + 0.5))) / 2.0
|
|
192
|
+
for index in range(1, POINTS_PER_SIDE + 2)]
|
|
193
|
+
return [(x * chord, half_thickness(x)) for x in upper] + [(x * chord, -half_thickness(x)) for x in lower]
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
kit.clear_default_scene()
|
|
197
|
+
# Span stations: the tips round off over the last 1.5 x thickness in two stations (chord and thickness
|
|
198
|
+
# shrink about the section's middle), so they never grow past the traced tip outline.
|
|
199
|
+
tip_step = 1.5 * THICKNESS / 2.0
|
|
200
|
+
stations = []
|
|
201
|
+
for span in (-HALF_SPAN, -HALF_SPAN + tip_step, -HALF_SPAN + 2 * tip_step, -0.3, 0.0,
|
|
202
|
+
0.3, HALF_SPAN - 2 * tip_step, HALF_SPAN - tip_step, HALF_SPAN):
|
|
203
|
+
steps_from_tip = round((HALF_SPAN - abs(span)) / tip_step)
|
|
204
|
+
chord_share, thickness_share = TIP_TAPER[1 - steps_from_tip] if steps_from_tip < 2 else (1.0, 1.0)
|
|
205
|
+
chord = CHORD * chord_share
|
|
206
|
+
section = kit.translate_section(wing_section(chord, THICKNESS * thickness_share), x=(CHORD - chord) / 2.0)
|
|
207
|
+
stations.append((span, section))
|
|
208
|
+
wing = kit.loft("FrontWing", stations) # quad caps close the tips
|
|
209
|
+
wing.data.transform(Matrix.Rotation(math.pi / 2.0, 4, "Z")) # span along X, leading edge forward (-Y)
|
|
210
|
+
count = 2 * POINTS_PER_SIDE + 2 # points per section; the first and last are the trailing edge
|
|
211
|
+
ring_vertices = len(stations) * count # the loft's rings come first, the cap grids after them
|
|
212
|
+
trailing = [edge.index for edge in wing.data.edges
|
|
213
|
+
if all(vertex < ring_vertices and vertex % count in (0, count - 1) for vertex in edge.vertices)]
|
|
214
|
+
caps = [edge.index for edge in wing.data.edges if edge.use_edge_sharp]
|
|
215
|
+
kit.shade_smooth(wing, design_line_edges=trailing + caps) # smooth section, sharp trailing edge and tips
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def filleted_outline(corners, radii, segments=4):
|
|
219
|
+
"""A closed 2D outline with each corner replaced by a circular fillet of its own radius."""
|
|
220
|
+
corners = np.array(corners, dtype=np.float64)
|
|
221
|
+
points = []
|
|
222
|
+
for index, (corner, radius) in enumerate(zip(corners, radii)):
|
|
223
|
+
previous, following = corners[index - 1], corners[(index + 1) % len(corners)]
|
|
224
|
+
toward_previous = (previous - corner) / np.linalg.norm(previous - corner)
|
|
225
|
+
toward_next = (following - corner) / np.linalg.norm(following - corner)
|
|
226
|
+
half_angle = math.acos(float(np.clip(toward_previous @ toward_next, -1.0, 1.0))) / 2.0
|
|
227
|
+
center = corner + (toward_previous + toward_next) / np.linalg.norm(toward_previous + toward_next) * radius / math.sin(half_angle)
|
|
228
|
+
start = corner + toward_previous * radius / math.tan(half_angle)
|
|
229
|
+
end = corner + toward_next * radius / math.tan(half_angle)
|
|
230
|
+
start_angle = math.atan2(start[1] - center[1], start[0] - center[0])
|
|
231
|
+
end_angle = math.atan2(end[1] - center[1], end[0] - center[0])
|
|
232
|
+
sweep = (end_angle - start_angle + math.pi) % (2.0 * math.pi) - math.pi
|
|
233
|
+
points += [center + radius * np.array([math.cos(start_angle + sweep * step / segments),
|
|
234
|
+
math.sin(start_angle + sweep * step / segments)])
|
|
235
|
+
for step in range(segments + 1)]
|
|
236
|
+
return points
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
# Endplate: the side-view trapezoid (y, z) with a generous top-front round, extruded symmetrically about its
|
|
240
|
+
# traced mid-plane, then rounded INWARD by a bevel of 0.45 x thickness, so the round never adds bulk.
|
|
241
|
+
outline = filleted_outline([(-0.10, 0.0), (0.16, 0.0), (0.16, 0.12), (-0.04, 0.16)], [0.003, 0.003, 0.003, 0.010])
|
|
242
|
+
edit_mesh = bmesh.new()
|
|
243
|
+
face = edit_mesh.faces.new([edit_mesh.verts.new((HALF_SPAN - PLATE_THICKNESS / 2.0, y, z)) for y, z in outline])
|
|
244
|
+
extruded = bmesh.ops.extrude_face_region(edit_mesh, geom=[face])
|
|
245
|
+
bmesh.ops.translate(edit_mesh, verts=[item for item in extruded["geom"] if isinstance(item, bmesh.types.BMVert)],
|
|
246
|
+
vec=(PLATE_THICKNESS, 0.0, 0.0))
|
|
247
|
+
bmesh.ops.recalc_face_normals(edit_mesh, faces=edit_mesh.faces[:])
|
|
248
|
+
perimeter = {edge for face in edit_mesh.faces if len(face.verts) > 4 for edge in face.edges}
|
|
249
|
+
edit_mesh.edges.index_update()
|
|
250
|
+
perimeter_edges = [edge.index for edge in perimeter]
|
|
251
|
+
mesh = bpy.data.meshes.new("Endplate_L")
|
|
252
|
+
edit_mesh.to_mesh(mesh)
|
|
253
|
+
edit_mesh.free()
|
|
254
|
+
plate = bpy.data.objects.new("Endplate_L", mesh)
|
|
255
|
+
bpy.context.scene.collection.objects.link(plate)
|
|
256
|
+
kit.bevel_edges(plate, perimeter_edges, width=0.45 * PLATE_THICKNESS, segments=3, profile=0.5)
|
|
257
|
+
bpy.context.view_layer.update()
|
|
258
|
+
|
|
259
|
+
mid_span = kit.section_points(wing, 0.0, axis="X") # (y, z) of the section at the centre line
|
|
260
|
+
tip = kit.section_points(wing, HALF_SPAN - 1e-4, axis="X")
|
|
261
|
+
plate_points = kit.world_vertices(plate)
|
|
262
|
+
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(out_folder, "aero.blend"))
|
|
263
|
+
print(json.dumps({"wing_thickness_m": round(float(np.ptp(mid_span[:, 1])), 5),
|
|
264
|
+
"wing_chord_m": round(float(np.ptp(mid_span[:, 0])), 5),
|
|
265
|
+
"trailing_edge_m": round(float(np.ptp(mid_span[mid_span[:, 0] > mid_span[:, 0].max() - 1e-6][:, 1])), 5),
|
|
266
|
+
"tip_thickness_m": round(float(np.ptp(tip[:, 1])), 5), "wing_audit": kit.cage_audit(wing),
|
|
267
|
+
"plate_thickness_m": round(float(np.ptp(plate_points[:, 0])), 5),
|
|
268
|
+
"plate_length_m": round(float(np.ptp(plate_points[:, 1])), 5)}))
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
The wing measures 0.030 m thick and 0.250 m in chord at the centre line, with a 2.5 mm trailing edge and tips
|
|
272
|
+
at half thickness. The cage audit shows every face a quad, with only the eight valence-3 cap corners as poles.
|
|
273
|
+
The endplate stays exactly 7 mm thick after its inward round.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 5. Wheels and tyres
|
|
278
|
+
|
|
279
|
+
| Decision | Practice |
|
|
280
|
+
|---|---|
|
|
281
|
+
| Construction | Lathe the whole wheel as one closed solid: rim face, sidewall, shoulders and tread (`wheel_profile` + `profile_spin`). Tread lugs are extruded out of the tyre's own crown faces (`tread_lugs`: every n-th face, so `steps` is a multiple of the lug count), which keeps the tyre one connected solid. Separate spokes, bolts and fan blades go round by a radial array (`radial_array`). |
|
|
282
|
+
| Sides around the axle | From the on-screen size: silhouette error = r (1 - cos(180 / n)), kept under a pixel at the closest view. War Thunder's edge count by wheel diameter: under 0.2 m 12; 0.2-0.3 m 16; 0.3-0.4 m 18; 0.4-0.5 m 24; 0.5-0.65 m 32; 0.65-0.9 m 36; 0.9-1.5 m 48. A 16-inch car wheel at hero distance uses about 36. |
|
|
283
|
+
| Tread | Geometric lugs only when they break the silhouette at play size (off-road, karts, big cartoon tyres). Otherwise use a normal map: tread is mostly hidden under the arch and repeats. |
|
|
284
|
+
| Sidewall text | Texture or decal, never geometry |
|
|
285
|
+
| Brake disc and caliper | The disc spins with the wheel. The caliper does NOT spin: it is its own object under the steering node (front) or the body (rear) |
|
|
286
|
+
| Mirroring | Avoid negative scale. Build the right-hand wheel as its own object (or reuse the same mesh rotated 180 degrees about Z, and handle the reversed spin sign in code). Negative scale breaks instancing in BabylonJS and flips winding. Camber is set in the engine, not modelled. |
|
|
287
|
+
| Hub height | Set it from `rolling_radius(wheel)`, tread included, so the tyre touches z = 0 exactly |
|
|
288
|
+
| Budget | Wheels count four times. Keep them lean: tens of percent of the vehicle's triangles at most. |
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## 6. Separate parts and pivots for game engines
|
|
293
|
+
|
|
294
|
+
**The hierarchy.** Every node keeps an identity parent inverse, no scale, and its origin on its rotation axis:
|
|
295
|
+
|
|
296
|
+
```text
|
|
297
|
+
Body root: origin on the ground under the vehicle centre; faces -Y in Blender (+Z after export)
|
|
298
|
+
├── Steer_FL empty at the front-left hub; steers about local Z (Y up after export)
|
|
299
|
+
│ ├── Wheel_FL origin at the hub centre; spins about local X (the axle) only
|
|
300
|
+
│ └── Caliper_FL does not spin; steers with the knuckle
|
|
301
|
+
├── Steer_FR ─ Wheel_FR
|
|
302
|
+
├── Wheel_RL rear wheels hang from the body (or a suspension node), no steering node
|
|
303
|
+
├── Wheel_RR
|
|
304
|
+
└── Door_L, Hood ... origin on the hinge line; rotate about the hinge axis only
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
| Engine | Forward | Up | Wheel requirements |
|
|
308
|
+
|---|---|---|---|
|
|
309
|
+
| glTF / BabylonJS | +Z | +Y | Each wheel a node, origin at the hub |
|
|
310
|
+
| Unity | +Z | +Y | WheelColliders are separate objects at the wheel positions, NOT children of the wheel meshes. The collider radius equals the mesh radius. Rear wheels steer 0. The Babylon Toolkit turns a chassis Rigidbody with two or more child WheelColliders into a Havok raycast vehicle (`RaycastWheel` per wheel). |
|
|
311
|
+
| Unreal (Chaos) | +X | +Z | Wheel bones accurately centred (an off-centre wheel wobbles, worst under motion blur); each wheel weighted to one bone only; at least a root plus 4 wheel bones; order FL, FR, BL, BR |
|
|
312
|
+
|
|
313
|
+
Blender's -Y forward and Z up export to glTF's +Z forward and Y up. The `export` tool's FBX preset gives Unity
|
|
314
|
+
the same.
|
|
315
|
+
|
|
316
|
+
**Naming.** End every corner part in its corner: `Wheel_FL`, `Steer_FL`, `Caliper_FL`. Use the same scheme
|
|
317
|
+
across LODs (`Wheel_FL_LOD1`). Studios use `wheel_front_left` or `F_L_wheelJNT`. Pick one scheme and never mix.
|
|
318
|
+
|
|
319
|
+
**Other moving parts:**
|
|
320
|
+
- Doors, hoods, flaps, control surfaces and landing gear get their origin on the hinge line (`set_origin`).
|
|
321
|
+
They are exported in the neutral pose (closed, gear down) and animate about one local axis.
|
|
322
|
+
- Suspension travel is along the wheel root's down axis.
|
|
323
|
+
- Motorbike forks steer about the **rake** axis (about 20-45 degrees from vertical, often 24-28), not about Z,
|
|
324
|
+
so tilt the steering node.
|
|
325
|
+
|
|
326
|
+
### Recipe: a vehicle with a lofted body, four lathed wheels, axles and steering pivots
|
|
327
|
+
|
|
328
|
+
This is the vehicle test asset. It is generic: a compact open-wheel buggy.
|
|
329
|
+
|
|
330
|
+
```python
|
|
331
|
+
"""Vehicle test asset: a body lofted from traced outlines, four lathed wheels with extruded tread lugs hung at
|
|
332
|
+
their hub centres (front wheels under steering nodes), axles tying them to the body. Saves vehicle.blend and
|
|
333
|
+
vehicle_assembly.json, and prints the pivot and stance reports."""
|
|
334
|
+
import json
|
|
335
|
+
import os
|
|
336
|
+
import sys
|
|
337
|
+
|
|
338
|
+
import bpy
|
|
339
|
+
|
|
340
|
+
import construction_kit as kit
|
|
341
|
+
import vehicle_parts as vehicle
|
|
342
|
+
|
|
343
|
+
out_folder = sys.argv[sys.argv.index("--") + 1]
|
|
344
|
+
FRONT_AXLE_Y, REAR_AXLE_Y = -0.72, 0.73 # wheelbase 1.45 m: the scale anchor of every view
|
|
345
|
+
TRACK = 1.10 # hub to hub across
|
|
346
|
+
WHEEL_RADIUS, WHEEL_WIDTH, RIM_RADIUS = 0.28, 0.22, 0.17
|
|
347
|
+
AXLE_RADIUS = 0.03
|
|
348
|
+
AXLE_REACH = 0.05 # how far each axle end runs into its hub
|
|
349
|
+
|
|
350
|
+
kit.clear_default_scene()
|
|
351
|
+
# Traced outlines, (y, value) in metres: top view half-width, side view top and bottom, front-view radii.
|
|
352
|
+
plan_half_width = [(-1.0, 0.30), (-0.75, 0.40), (0.0, 0.42), (0.85, 0.40), (1.1, 0.32)]
|
|
353
|
+
side_top = [(-1.0, 0.42), (-0.6, 0.55), (-0.2, 0.90), (0.6, 0.92), (1.1, 0.68)]
|
|
354
|
+
side_bottom = [(-1.0, 0.22), (1.1, 0.20)]
|
|
355
|
+
shoulder_radius = [(-1.0, 0.06), (1.1, 0.10)]
|
|
356
|
+
lower_radius = [(-1.0, 0.03), (1.1, 0.03)]
|
|
357
|
+
stations = vehicle.stations_from_outlines(vehicle.outline_kinks(plan_half_width, side_top, side_bottom),
|
|
358
|
+
plan_half_width, side_top, side_bottom, shoulder_radius, lower_radius)
|
|
359
|
+
body = kit.loft("Body", stations)
|
|
360
|
+
body.data.materials.append(bpy.data.materials.new("Body_Paint"))
|
|
361
|
+
|
|
362
|
+
hub_height = None
|
|
363
|
+
for corner, (side, axle) in vehicle.CORNERS.items():
|
|
364
|
+
wheel = vehicle.wheel(f"Wheel_{corner}", WHEEL_RADIUS, WHEEL_WIDTH, RIM_RADIUS, steps=48, tread_blocks=24)
|
|
365
|
+
hub_height = hub_height or vehicle.rolling_radius(wheel) # tread included: the tyre sits on z = 0
|
|
366
|
+
hub_y = FRONT_AXLE_Y if axle == "front" else REAR_AXLE_Y
|
|
367
|
+
vehicle.mount_wheel(wheel, body, (side * TRACK / 2.0, hub_y, hub_height), steer=(axle == "front"))
|
|
368
|
+
|
|
369
|
+
axle_material = bpy.data.materials.new("Axle_Metal")
|
|
370
|
+
for name, hub_y in (("Axle_Front", FRONT_AXLE_Y), ("Axle_Rear", REAR_AXLE_Y)):
|
|
371
|
+
# The axle runs through the body into both hubs, so every wheel is physically attached.
|
|
372
|
+
axle_end = TRACK / 2.0 + AXLE_REACH
|
|
373
|
+
axle = kit.curve_tube(name, [(-axle_end, hub_y, hub_height), (axle_end, hub_y, hub_height)],
|
|
374
|
+
AXLE_RADIUS, resolution=12, path_subdivisions=1)
|
|
375
|
+
axle.data.materials.append(axle_material)
|
|
376
|
+
axle.parent = body # the body sits at the origin, so the axle keeps its place
|
|
377
|
+
|
|
378
|
+
bpy.context.view_layer.update()
|
|
379
|
+
for part in [body] + vehicle.wheels_of(body) + [bpy.data.objects["Axle_Front"], bpy.data.objects["Axle_Rear"]]:
|
|
380
|
+
kit.smart_unwrap(part)
|
|
381
|
+
|
|
382
|
+
wheels = vehicle.wheels_of(body)
|
|
383
|
+
spec = {"units": "m", "root": "Body",
|
|
384
|
+
"parts": {**{wheel.name: {"attached_to": ["Axle_Front" if wheel.name.endswith(("FL", "FR")) else "Axle_Rear"]}
|
|
385
|
+
for wheel in wheels},
|
|
386
|
+
"Axle_Front": {"attached_to": ["Body"]}, "Axle_Rear": {"attached_to": ["Body"]}},
|
|
387
|
+
"expect_embedded": [["Axle_*", "Body"], ["Axle_*", "Wheel_*"]]}
|
|
388
|
+
with open(os.path.join(out_folder, "vehicle_assembly.json"), "w") as spec_file:
|
|
389
|
+
json.dump(spec, spec_file, indent=2)
|
|
390
|
+
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(out_folder, "vehicle.blend"))
|
|
391
|
+
print(json.dumps({"hub_height_m": round(hub_height, 4), "pivots": vehicle.pivot_report(wheels),
|
|
392
|
+
"stance": vehicle.stance_report([body], wheels)}))
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Then gate it:
|
|
396
|
+
- `assembly-check --model vehicle.blend --spec vehicle_assembly.json` passes: no floating parts, every wheel on
|
|
397
|
+
its axle, the axles in the body.
|
|
398
|
+
- The pivot report shows every hub offset at 0.0 m, every wheel round about its local X, and the front wheels
|
|
399
|
+
steered.
|
|
400
|
+
- `export --model vehicle.blend --out vehicle.glb` writes `Steer_FL` at the hub in glTF coordinates, with
|
|
401
|
+
`Wheel_FL` at zero offset under it, and every part (steering nodes, rear wheels, axles) under `Body`, so
|
|
402
|
+
the whole vehicle is one node tree.
|
|
403
|
+
|
|
404
|
+
### Recipe: a hinged part with its origin on the hinge line
|
|
405
|
+
|
|
406
|
+
```python
|
|
407
|
+
"""A door (or hood, flap, aileron) whose origin is moved onto its hinge line, so the engine rotates it about
|
|
408
|
+
one local axis: through a 60-degree swing the hinge edge stays put while the far edge travels."""
|
|
409
|
+
import json
|
|
410
|
+
import math
|
|
411
|
+
|
|
412
|
+
import bpy
|
|
413
|
+
import numpy as np
|
|
414
|
+
|
|
415
|
+
import construction_kit as kit
|
|
416
|
+
import vehicle_parts as vehicle
|
|
417
|
+
|
|
418
|
+
HINGE = (0.45, -0.5, 0.55) # on the door's front edge, half way up
|
|
419
|
+
SWING_DEGREES = 60.0
|
|
420
|
+
|
|
421
|
+
kit.clear_default_scene()
|
|
422
|
+
# A 40 mm thick door panel lofted along Y from its front edge (y = -0.5) to its rear edge (y = 0.4).
|
|
423
|
+
section = kit.translate_section(kit.rounded_section(0.04, 0.60, 0.01, 0.01, segments=2), x=0.45, z=0.25)
|
|
424
|
+
door = kit.loft("Door_L", [(y, section) for y in (-0.5, 0.4)])
|
|
425
|
+
vehicle.set_origin(door, HINGE)
|
|
426
|
+
bpy.context.view_layer.update()
|
|
427
|
+
before = kit.world_vertices(door)
|
|
428
|
+
door.rotation_euler = (0.0, 0.0, math.radians(SWING_DEGREES)) # the engine animates only this
|
|
429
|
+
bpy.context.view_layer.update()
|
|
430
|
+
moved = np.linalg.norm(kit.world_vertices(door) - before, axis=1)
|
|
431
|
+
front_edge = np.abs(before[:, 1] - HINGE[1]) < 1e-6
|
|
432
|
+
print(json.dumps({"origin": [round(value, 4) for value in door.location],
|
|
433
|
+
"hinge_edge_max_move_m": round(float(moved[front_edge].max()), 4),
|
|
434
|
+
"far_edge_max_move_m": round(float(moved[~front_edge].max()), 4)}))
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## 7. Interiors and cockpits at game budgets
|
|
440
|
+
|
|
441
|
+
| Camera | What to model | Budget guide |
|
|
442
|
+
|---|---|---|
|
|
443
|
+
| Chase or third person, closed car | Tinted glass with silhouettes of the seats, steering wheel and headrests. A dark interior texture behind the glass is enough. | A few percent of the vehicle |
|
|
444
|
+
| Chase, open cockpit (karts, buggies, bikes, open-wheel racers) | The driver, seat, steering wheel and visible frame are hero parts: they are in the silhouette | Treat the driver as a character asset |
|
|
445
|
+
| Cockpit or first person | The dashboard, gauges, steering wheel and mirrors in full, modelled from a camera at the driver's head. Density goes to front-facing surfaces; the floor and rear stay low. | Up to about 20k tris for the whole interior; textures 2048 interior, 1024 x 512 gauges, 512 seats (one sim studio's figures) |
|
|
446
|
+
|
|
447
|
+
Gauges, screens and stitching are texture. Only a small share of players use the cockpit view, so spend there
|
|
448
|
+
only when the game needs it.
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## 8. LODs
|
|
453
|
+
|
|
454
|
+
| LOD | Triangles (of LOD0) | What goes | Switch at (Unity screen height) |
|
|
455
|
+
|---|---|---|---|
|
|
456
|
+
| LOD0 | 100 % | — | > 0.5 |
|
|
457
|
+
| LOD1 | 50-55 % | Interior detail, small undercarriage parts, decals, separate bolts and nuts | 0.25-0.5 |
|
|
458
|
+
| LOD2 | 25-30 % | Calipers and discs, tread blocks (normal map), wheel sides cut 32 to 16 | 0.1-0.25 |
|
|
459
|
+
| LOD3 | 10-12 %, one material | Everything but the silhouette; wheels may merge into the body if nothing rotates at that distance | < 0.1 |
|
|
460
|
+
|
|
461
|
+
- Halve the count per LOD over 3 to 4 LODs. Judge each LOD from its real viewing distance.
|
|
462
|
+
- Moving parts stay separate nodes until the LOD at which nobody can see them move.
|
|
463
|
+
- Keep detail toward the rear of a racing vehicle: players mostly see the car ahead from behind.
|
|
464
|
+
- Keep normal accuracy on glossy paint and chrome.
|
|
465
|
+
- Fast vehicles hide pops, so they can switch earlier.
|
|
466
|
+
- Far vehicles can collapse to a single-material proxy drawn in one call.
|
|
467
|
+
- **Naming:** `Body_LOD0`, `Body_LOD1` ... as siblings. Unity builds a LOD Group from `_LOD0` to `_LODn` names
|
|
468
|
+
on import, and the Babylon Toolkit exports it. `lod_chain` makes the copies with the construction kit's
|
|
469
|
+
`lod_chain` and transfers LOD0's normals onto each (decimation bends normals).
|
|
470
|
+
|
|
471
|
+
### Recipe: an LOD chain for a body and a wheel
|
|
472
|
+
|
|
473
|
+
```python
|
|
474
|
+
"""LOD copies by collapse decimation, named for Unity's LOD Group import, with their triangle counts."""
|
|
475
|
+
import json
|
|
476
|
+
|
|
477
|
+
import construction_kit as kit
|
|
478
|
+
import vehicle_parts as vehicle
|
|
479
|
+
|
|
480
|
+
kit.clear_default_scene()
|
|
481
|
+
body = kit.loft("Body_LOD0", [(y, kit.rounded_section(0.80, 0.50, 0.12, 0.04, segments=6)) for y in (-1.0, -0.5, 0.4, 1.0)])
|
|
482
|
+
wheel = vehicle.wheel("Wheel_FL_LOD0", 0.28, 0.22, 0.17, steps=48, tread_blocks=24)
|
|
483
|
+
report = {}
|
|
484
|
+
for part in (body, wheel):
|
|
485
|
+
part.data.calc_loop_triangles()
|
|
486
|
+
report[part.name] = {"triangles": len(part.data.loop_triangles), "lods": vehicle.lod_chain(part, [0.5, 0.25, 0.12])}
|
|
487
|
+
print(json.dumps(report))
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
Decimation is the fast route. For a hero vehicle, rebuild LOD2 and LOD3 by hand: re-loft with fewer stations
|
|
491
|
+
and fewer sides. Collapse decimation cannot keep the arch loops and silhouette shoulders it does not know about.
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
## 9. Vehicle types: what differs
|
|
496
|
+
|
|
497
|
+
| Type | Key differences |
|
|
498
|
+
|---|---|
|
|
499
|
+
| Car | Closed shell; glass, interior to the camera's needs; arches hold the stance; four wheels under steering nodes at the front |
|
|
500
|
+
| Kart, buggy | Exposed tube chassis (`curve_tube` through traced centre lines), big soft tyres (large shoulder radius), driver in the silhouette, no suspension visible or very simple. Collision is often the body only, so big wheels can clip: keep the wheel collider separate. |
|
|
501
|
+
| Motorbike | Two wheels. The front fork steers about the tilted rake axis; the swingarm pivots at the frame; the chain is a texture or an array. The rider leans the whole bike: put a lean node at the ground contact line. |
|
|
502
|
+
| Aircraft | Every control surface (ailerons, elevator, rudder, flaps) is its own object with its origin on the hinge line. Exported neutral, flaps up, gear down. Root at the centre of gravity. The propeller is static blades plus a blurred disc for speed. Landing gear has hinge pivots per strut. |
|
|
503
|
+
| Boat | (No source in this research; working practice.) Hull lofted from waterlines and sections like a fuselage, with the waterline at a known Z. Rudder and propeller on hinge or spin pivots. The deck is one shell. |
|
|
504
|
+
| Tank, tracked | Road wheels and sprockets as spun parts; tracks as a texture-scrolled belt or segment array; turret on a Z pivot, gun on an X pivot; the hull rests on the tracks |
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## 10. Lessons from a production vehicle build
|
|
509
|
+
|
|
510
|
+
A vehicle front section was rebuilt over many review rounds against locked reference cameras. These are the
|
|
511
|
+
lessons, stated generally.
|
|
512
|
+
|
|
513
|
+
1. **Faceted versus rounded misread.** The brief called the forms "faceted", so they were built from planes
|
|
514
|
+
with weighted normals. Every width passed, and the review still said "blocky". The reference rolled its
|
|
515
|
+
shoulders over 15 to 45 mm. Measure the radius (§8.4b), then build rounded lofts or cages.
|
|
516
|
+
2. **Bulk came from the section table, not the modelling.** Free per-station widths contradicted the plan
|
|
517
|
+
view. Build stations only from traces (section 4).
|
|
518
|
+
3. **Holding loops set the radius.** A chamfer does not hold. Size the loops from the measured radius and keep
|
|
519
|
+
rings wide enough, or the global clamp shrinks every radius (`hard-surface.md`).
|
|
520
|
+
4. **Pods as primitive soup.** Lamp pods built as boxes with slots read as boxes for three rounds. They passed
|
|
521
|
+
only when rebuilt as multi-section lofts with a recessed housing as a separate insert. Add no new primitives
|
|
522
|
+
after the blockout.
|
|
523
|
+
5. **Stations catch what renders hide.** A part 10 to 15 % too fat looked "about right" in renders. The station
|
|
524
|
+
tables found it every time. Measure the stations on the game camera's frames, not only on Blender masks: the
|
|
525
|
+
two disagreed by a centimetre at the wing.
|
|
526
|
+
6. **Overhang disagreement between views** (section 2). Decide by sweeping and grading stations, and record
|
|
527
|
+
the split.
|
|
528
|
+
7. **Lighting-limited highlight checks.** A highlight-ramp target on the shoulder stayed unreachable even at
|
|
529
|
+
1.5x the reference radius, because the game's studio lighting concentrated the reflection in a narrow band.
|
|
530
|
+
Prove the geometry by its section radius, and log the highlight check as lighting-limited instead of
|
|
531
|
+
inflating the form.
|
|
532
|
+
8. **Depth needs value.** A lamp housing read flat until it was deep (several times the lens height), dark,
|
|
533
|
+
and under a brow catching a 2 mm bevel highlight.
|
|
534
|
+
9. **Blocks, then blobs, then the third way.** Planar solids with small bevels read as plates and wedges
|
|
535
|
+
(highlight ramps of 3 px against the reference's 22 to 53). A subdivided cage with no design lines read as a
|
|
536
|
+
bar of soap. A sparse cage on the named lines with a sharpness per line made every panel's zebra continuous
|
|
537
|
+
(section 4, "Rounded bodywork").
|
|
538
|
+
10. **Smooth is not the same as the right form.** That cage reached about 70 to 75 % of the reference: the front
|
|
539
|
+
view read right, the close and three-quarter views did not. The causes were layout, not technique: a
|
|
540
|
+
box-layout cage builder put poles on every corner, and the face, cheeks and pods were separate cages, so
|
|
541
|
+
the pods read as scoops instead of wedges flowing into the nose.
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## 11. Budgets (web and BabylonJS first)
|
|
546
|
+
|
|
547
|
+
| Item | Web / mobile | Desktop | Notes |
|
|
548
|
+
|---|---|---|---|
|
|
549
|
+
| Player or hero vehicle, LOD0 | 15-30k tris | 30-100k+ | Mobile racers sat around 15-25k; desktop sims 10k-26k in-game from 500k bake sources; AAA console hero cars go to 500k |
|
|
550
|
+
| AI or traffic vehicle | 50 % of the hero | 50 % | Far ones as one-material proxies |
|
|
551
|
+
| Materials | 2-4 (paint, trim and dark, glass, tyre and rim) | 4-8 | Each material is a draw per mesh per pass; far LODs use one |
|
|
552
|
+
| Textures | Body 1024-2048, wheels 256-512 | 2048-4096 | Wheels instanced: one mesh, four nodes |
|
|
553
|
+
| Wheels | 4 x (500-1,500) tris | 4 x (2-6k) | Lean, because they count four times |
|
|
554
|
+
| Interior | Silhouettes behind tinted glass | Up to about 20k in cockpit view | Section 7 |
|
|
555
|
+
| Draw calls per vehicle | 5-10 (body materials + 4 wheels that share one) | 10-25 | Count per pass: shadows draw it again |
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
## 12. Verification checklist
|
|
560
|
+
|
|
561
|
+
```bash
|
|
562
|
+
node <skill>/scripts/bt-blender.mjs view-consistency --spec refs/spec.json # settle view disagreements first
|
|
563
|
+
node <skill>/scripts/bt-blender.mjs world-gate --spec refs/spec.json --model vehicle.blend # blockout >= 0.85, final >= 0.9 IoU
|
|
564
|
+
node <skill>/scripts/bt-blender.mjs measure-stations --spec refs/spec.json --model vehicle.blend # no WRONG station, radii within 15 %
|
|
565
|
+
node <skill>/scripts/bt-blender.mjs review-render --model vehicle.blend --out review --distance 6 --fov 60
|
|
566
|
+
node <skill>/scripts/bt-blender.mjs assembly-check --model vehicle.blend --spec vehicle_assembly.json
|
|
567
|
+
node <skill>/scripts/bt-blender.mjs qa-check --model vehicle.blend
|
|
568
|
+
node <skill>/scripts/bt-blender.mjs export --model vehicle.blend --out build/vehicle.glb
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
- [ ] The brief records the scale anchor (wheelbase), every view disagreement and the split chosen.
|
|
572
|
+
- [ ] `stance_report` matches the reference: wheelbase, track, overhangs, wheel diameter, ride height.
|
|
573
|
+
- [ ] The body is built from traces: no station exceeds the plan envelope, and every station is MATCH or CLOSE.
|
|
574
|
+
- [ ] Rolled bodywork: named design lines with a sharpness each, one cage for surfaces that flow together,
|
|
575
|
+
`cage_audit` clean, zebra continuous in both directions, a shading ramp of at least 15 px across each roll
|
|
576
|
+
in the game camera.
|
|
577
|
+
- [ ] Wings and endplates are sections at absolute thickness: trailing edge 2 to 3 mm, tips tapered and
|
|
578
|
+
quad-capped, endplate rounds inward.
|
|
579
|
+
- [ ] `pivot_report` passes: every wheel origin at its hub, round about local X, X across the vehicle, steering
|
|
580
|
+
nodes at the hubs.
|
|
581
|
+
- [ ] Moving parts are separate, with identity parent inverses, no scale (no negative scale), hinge origins on
|
|
582
|
+
hinge lines, and corner names in one scheme.
|
|
583
|
+
- [ ] assembly-check passes: wheels on axles, nothing floating, intended embeds declared.
|
|
584
|
+
- [ ] The LODs are named `_LOD0` to `_LODn`, with the triangle ratios and moving parts as planned.
|
|
585
|
+
- [ ] The review render at the gameplay camera reads: wheels, stance and hero features visible at play size.
|
|
586
|
+
- [ ] The exported glTF has the hierarchy (`Steer_*` at the hubs, `Wheel_*` at zero offset under them).
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
## Sources
|
|
591
|
+
|
|
592
|
+
- 80.lv, Irfan Haider, "Modeling Vehicles for AAA Games" — https://80.lv/articles/modeling-vehicles-for-aaa-games/
|
|
593
|
+
- BeamNG documentation, "Vehicle Art: Modeling" — https://documentation.beamng.com/modding/vehicle/vehicle-art/modeling/
|
|
594
|
+
- BeamNG blog, "A look at vehicle workflow: Part 2" (interiors) — https://beamng.com/game/news/blog/a-look-at-vehicle-workflow-part-2
|
|
595
|
+
- the-blueprints.com, "Setting up blueprints in Blender" — https://the-blueprints.com/tutorials/blender
|
|
596
|
+
- Blender Artists, "Problem with blueprints/reference pics not matching all views" —
|
|
597
|
+
https://blenderartists.org/t/problem-with-blueprints-reference-pics-not-matching-all-views/1221567
|
|
598
|
+
- Car Design News, "What is stance and how do we achieve a good one?" —
|
|
599
|
+
https://www.cardesignnews.com/cars/what-is-stance-and-how-do-we-achieve-a-good-one/451467 ; "Car design
|
|
600
|
+
essentials part 1: bones" — https://www.cardesignnews.com/cars/car-design-essentials-part-1-bones/482965
|
|
601
|
+
- Pluralsight, "From 0 to Stunning: 10 Tips for Automotive Modeling" —
|
|
602
|
+
https://www.pluralsight.com/resources/blog/software-development/0-stunning-10-tips-automotive-modeling
|
|
603
|
+
- Epic Games, "Vehicle Art Setup in Unreal Engine" and "How to Set Up Vehicles" —
|
|
604
|
+
https://dev.epicgames.com/documentation/en-us/unreal-engine/vehicle-art-setup-in-unreal-engine ,
|
|
605
|
+
https://dev.epicgames.com/documentation/en-us/unreal-engine/how-to-set-up-vehicles-in-unreal-engine
|
|
606
|
+
- Unity Manual, "Wheel collider tutorial" —
|
|
607
|
+
https://docs.unity.com/en-us/engine/current/manual/physics-section/physics-overview/collision-section/collider-shapes/wheel-colliders/wheel-collider-tutorial
|
|
608
|
+
- Unity Vehicles package, "Getting started" — https://docs.unity3d.com/Packages/com.unity.vehicles@0.1/manual/getting-started.html
|
|
609
|
+
- Khronos glTF 2.0 specification, coordinate system — https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html
|
|
610
|
+
- War Thunder CDK, "3D models for aircraft" and "Creating a 3D tank model" (edge counts by wheel diameter,
|
|
611
|
+
LOD tables, hinge pivots) — https://wiki.warthunder.com/cdk/232-3d-models-for-aircraft ,
|
|
612
|
+
https://wiki.warthunder.com/cdk/249-creating-a-3d-tank-model
|
|
613
|
+
- Aerofly FS SDK, "Aircraft modelling" — https://www.aerofly.com/dokuwiki/doku.php/sdk:aircraft:modelling
|
|
614
|
+
- Microsoft Flight Simulator SDK, "LODs" — https://docs.flightsimulator.com/html/mergedProjects/How_To_Make_An_Aircraft/Contents/Modelling/LODs/LODs.htm
|
|
615
|
+
- Microsoft Game Dev / Simplygon, "How to Create AAA Quality Vehicle LODs for Racing Games" —
|
|
616
|
+
https://developer.microsoft.com/en-us/games/articles/2025/12/level-of-detail-vehicle-models-simplygon/ ;
|
|
617
|
+
Forza Motorsport 7 customer story — https://simplygon.com/posts/5f1e97cd-b9e9-4746-b669-d6d6e893b662
|
|
618
|
+
- iRacing, car modelling blog (2010) — https://www.iracing.com/?p=2624
|
|
619
|
+
- Cyberpunk 2077 modding wiki, "Adding wheels, tires and brake calipers" —
|
|
620
|
+
https://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/vehicles/adding-moving-parts-to-your-vehicle/adding-wheels-tires-and-brake-calipers
|
|
621
|
+
- SuperTuxKart, "Making Karts: Modeling" — https://supertuxkart.net/Making_Karts:_Modeling
|
|
622
|
+
- Wikipedia, "Bicycle and motorcycle geometry" (rake) — https://en.wikipedia.org/wiki/Bicycle_and_motorcycle_geometry
|
|
623
|
+
- Wikipedia, "NACA airfoil" (thickness form, leading-edge radius 1.1019 t²) — https://en.wikipedia.org/wiki/NACA_airfoil
|
|
624
|
+
- Blender Artists, "Requesting some advice with edgeloops" (loops along a thin trailing edge) —
|
|
625
|
+
https://blenderartists.org/t/requesting-some-advice-with-edgeloops/430156
|
|
626
|
+
- Ali Ismail (Ebal Studios), "Modeling Cars in Polygons" — https://ebalstudios.com/blog/modeling-cars-polygons
|
|
627
|
+
- note, Roman Nesuko, "Car in Blender: Eunos Cosmo" (one mesh until the shape is right; routed lines) —
|
|
628
|
+
https://note.com/romannesuko/n/n9e507262bba6
|
|
629
|
+
- Unity Discussions, "Ideal poly count for a mobile racing game" —
|
|
630
|
+
https://discussions.unity.com/t/what-would-be-an-ideal-poly-count-for-a-mobile-racing-game/673701
|
|
631
|
+
- Babylon Toolkit Agent Reference, `references/unity-authoring-recipes.md` §11 (WheelCollider to Havok raycast
|
|
632
|
+
vehicle) and §20 (web budgets).
|