The prompt
The same words for every run, whichever agent program and model ran it.
Read TASK.md and do it. Your agent name isagent; write only intoout/agent/. Work autonomously until everything in TASK.md is done: nobody will answer questions during the run. Use the gamedev and Blender skills available to you, and use the chrome-devtools MCP tools for web search and browsing.
The skills the agents could load
The same three skill sets were installed for every agent program; this is how many of each one loaded.
| Skill set | Claude Code | Codex CLI | Grok CLI | Antigravity CLI | opencode |
|---|---|---|---|---|---|
| Blender skills | 28 of 28 | 28 of 28 | 28 of 28 | 28 of 28 | 28 of 28 |
| Custom modelling skills | 12 of 12 | 12 of 12 | 12 of 12 | 12 of 12 | 12 of 12 |
| Game-development pack | 79 of 79, plus its router | 79 of 79 | 60 of 79 | 70 of 79, plus its router | 79 of 79 |
Grok CLI did not have 19 engine and publishing skills of the game-development pack: bevy-ecs, defold-core, ebitengine-game, game-docs, game-jam, itch-publish, love2d-core, prototype-fast, pygame-core, roblox-characters, roblox-datastores, roblox-luau, roblox-networking, roblox-physics, roblox-simulator-economy, roblox-studio-workflow, roblox-ui, steam-publish, unity-build-size.
Antigravity CLI fits skill descriptions into its own 20,000-token budget and left out 9 general skills of the game-development pack: ai-behavior-trees-utility-ai, camera-systems, game-feel, game-ui-ux, godot-gdscript-headless-testing, godot-physics, performance-optimization, threejs-materials-lighting, threejs-scene-setup.
A skill is a folder of instructions an agent reads when a task calls for it. Each program also offered its own built-in skills, which differ per program.
The 28 Blender skills
blender-addon-development, blender-animation, blender-asset-qa, blender-character-rigging, blender-clothing, blender-core, blender-environment-kits, blender-export-pipelines, blender-facial-shapekeys, blender-game-optimization, blender-geometry-nodes, blender-hair-grooming, blender-hardsurface-modeling, blender-lighting-lookdev, blender-pbr-materials, blender-pipeline-automation, blender-rendering, blender-retopology-uv, blender-scene-setup, blender-sculpting, blender-simulation, blender-stylized-npr, blender-texture-baking, blender-texturing, blender-time-of-day, blender-video-editing, blender-weather-fx, blender-workflow-recipes
The 12 custom modelling skills
blender-car-film, blender-film, blender-forest, car-body-surfacing, car-design-brief, car-detail-assemblies, car-finish-review, game-animation, game-asset-modeling, game-ui, game-vfx, reference-modeling
The 79 skills of the game-development pack
ai-behavior-trees-utility-ai, audio-design, bevy-ecs, camera-systems, card-game, create-game-assets, defold-core, dialogue-systems, ebitengine-game, fps-shooter, game-ai, game-docs, game-feel, game-jam, game-ui-ux, godot-2d-movement, godot-3d-essentials, godot-animation, godot-audio, godot-csharp, godot-export, godot-gdscript, godot-gdscript-headless-testing, godot-multiplayer, godot-nodes-scenes, godot-physics, godot-resources, godot-shaders, godot-signals-groups, godot-tilemap, godot-ui-control, input-systems, itch-publish, level-design, love2d-core, performance-optimization, phaser-arcade-physics, phaser-core, physics-tuning, pixijs-rendering, platformer, procedural-gen, prototype-fast, puzzle, pygame-core, roblox-characters, roblox-datastores, roblox-luau, roblox-networking, roblox-physics, roblox-simulator-economy, roblox-studio-workflow, roblox-ui, roguelike, rpg, save-systems, shader-programming, steam-publish, survival-crafting, threejs-gltf-loading, threejs-materials-lighting, threejs-scene-setup, tower-defense, unity-animation, unity-build-pipeline, unity-build-size, unity-csharp-scripting, unity-input-system, unity-navmesh, unity-physics, unity-scriptableobjects, unity-tilemap-2d, unreal-behavior-trees, unreal-blueprints, unreal-cpp-gameplay, unreal-enhanced-input, unreal-niagara, unreal-packaging, visual-novel
TASK.md
The brief, the scene contract and the eight judging criteria.
Prop trial: the abandoned passenger stair truck
You are a senior 3D prop designer on a commercial game. Design and model one prop, to final quality, from real references and the art style in this packet.
Your output folder is out/<your agent name>/ (for example out/codex/, out/claude/). Create it.
- Write only there. Don't change anything else in this packet.
- Don't read other folders on this disk.
- Public web sources are allowed and expected.
The prop
A truck-mounted passenger boarding stair: the self-propelled airstair vehicle that serves the forward door of a narrow-body jet (Boeing 737 class).
It has been abandoned on an airport apron for decades:
- sun-bleached;
- tyres flat;
- wheels and lowest steps buried in drifted sand;
- glass cracked;
- some panels missing or bent.
It is lowered and parked, not docked to an aircraft. It stands beside the racetrack in the airport boneyard of
the track name withheld track (read style/STYLE.md). It belongs to the same fictional ground-service fleet as the tug in
style/game_capture_sibling_tug.jpg.
What to do
- Find real references on the web.
- At least three real stair-truck models or types, with photos from several sides.
- Published dimensions: overall length, width and height; platform height range; step count and rise; wheelbase.
- The door-sill height of the aircraft it serves.
- Save the images in
out/<agent>/refs/. List every one inrefs/SOURCES.md: URL, what it shows, and the licence or "study only". - Never ship or trace a photo.
- Write
design.md, one page at most:- which real type(s) you follow, and why;
- the key dimensions, each with its source;
- which features you read from photos, and which you inferred;
- what you exaggerated for readability (see
style/STYLE.md), and why; - the livery, from the fleet in the style folder.
- Model it in Blender 5.1 (
D:/Blender 5.1/blender.exe), with any Blender tooling you have.- Build the geometry yourself. Don't download 3D models, and don't use image-to-3D or AI mesh generators.
- Follow the contract below.
- Render the standard review with the packet's tool (below). Then make at least three close-ups of your own:
- wheels in the sand;
- the treads and rails;
- the cab.
- Check yourself against the checklist below, fix what fails, and write the report.
The contract
Units and axes.
- Metres, real-world scale, Z up.
- The vehicle's front (the cab) faces -Y.
- Origin at the centre of the footprint, at ground level (Z = 0 is the terrain).
- Transforms applied.
Scene layout. One collection named Prop holding only the deliverable:
| Object | Contents |
|---|---|
stair_truck_lod0 |
Full detail (one or more objects; each name starts with stair_truck_ and ends _lod0) |
stair_truck_lod1 |
For about 50–100 m |
stair_truck_lod2 |
For 100 m and beyond |
stair_truck_bed_lod0 |
The drifted sand bed |
stair_truck_bed_lod1 |
Its lower LOD |
stair_truck_bed_lod2 |
Its lowest LOD |
The bed's outer rim lies exactly at Z = 0 all round, so it welds into the terrain. It covers the buried parts.
Budget (triangles).
| LOD0 | LOD1 | LOD2 | |
|---|---|---|---|
| Truck | 2,500 | 1,700 | 1,100 |
| Sand bed | 800 | 400 | 250 |
Materials.
- At most 8.
- Each is a Principled BSDF whose Base Color is the flat pigment. The review tool reads only that.
- At most one drawn texture atlas, up to 2048 x 1024, linked to Base Color. It holds drawn detail only (see
style/STYLE.md).
Geometry.
- Normals point outward.
- No coplanar overlapping faces (z-fighting).
- No parts floating free of their supports.
- No interpenetration that shows.
Export. Also export the Prop collection to out/<agent>/stair_truck.glb.
The review tool
It uses the same views, sun and approximate game shading for every agent:
"D:/Blender 5.1/blender.exe" -b out/<agent>/stair_truck.blend --python-exit-code 1 -P tools/review_render.py -- --collection Prop --out out/<agent>/review
It writes to review/:
- the front, both sides, rear and top orthographic views;
- the two 3/4 views;
- the chase-camera road views at 25 and 80 m (LOD0), 50 m (LOD1) and 120 m (LOD2), each with a native-pixel crop enlarged 3x;
stats.json: triangles per LOD, bounding box, materials and textures.
Read the road-view crops. They show what the player sees.
Deliverables in out/<agent>/
refs/andrefs/SOURCES.md.design.md.stair_truck.blendandstair_truck.glb.build_stair_truck.py, if you built it from a script (preferred: it makes the model reproducible).review/: the tool's output plus your close-ups.REPORT.md, 20 lines at most:- what you made;
- the triangles per LOD, and the bounding box from
stats.json; - the time you took;
- every checklist item you know you missed, marked MISS. Never mark your own PASS.
How it will be judged
- Reads at race distance. In the 80 m crop the silhouette says "airport stair truck": cab, diagonal stair, platform and rails.
- Real proportions. Overall dimensions within 5% of your cited real type. Step rise and platform height are plausible for a 737-class door.
- The style matches the packet. Flat pigments, cel bands, forms that take ink well, the fleet's livery. Not a photoreal or "2004 game" render.
- Real modelled forms. Recessed glass, treads with risers, hollow or tube rails, tyre sidewalls, lamp housings. Detail density like the sibling tug's.
- Burial is physical. Wheels sunk and tyres flat. Sand drifts against the windward side. No visible bed rim, no floating parts.
- The contract and budget are met, and the geometry is clean.
- The references are real and documented, with the dimensions traced to their sources.
- The report is honest: misses named as MISS.
style/STYLE.md
The art style the prop had to match.
Art style: what the prop must look like
The game is game title withheld, a commercial racing game with weapons. It must look like an adult 1980s cel-animated film: painted backgrounds, ink linework, and flat cel shading. Each frame should read like a cel from that film, not like a game render. The owner's references are films, two films titles withheld, never other games.
The track: track name withheld
- Las Vegas decades after the desert took it. The Strip, downtown and the airport are half-buried in dunes.
- Golden hour. A low western sun at about 20 degrees, teal sky, peach and orange sand.
- Clean and sun-bleached. It is not dark, grimy or night. Decay shows as sun-faded paint, sand drifts, cracked glass and missing parts, not as dirt textures.
- This prop sits in the airport boneyard: an abandoned airport apron with jets buried in sand.
The images in this folder
| File | What it is | Use it for |
|---|---|---|
painting_signature_b.png |
The owner's approved painting of the track | The overall look: colours, shading, ink weight |
painting_airport_terminal.png |
Concept painting of the airport terminal apron | The prop's own setting; a pale stair vehicle stands right of the gate |
painting_airport_runway.png |
Concept painting of the runway | Sand drifts against hard objects, buried pavement |
painting_boneyard.png |
Concept painting of the aircraft boneyard | How burial and drifting read in this style |
game_capture_sibling_tug.jpg |
In-game render of a finished vehicle from the same ground-service fleet | Detail level, colours, livery, glass, flat tyres, the real game shading |
game_capture_race_view.jpg |
In-game race view | Scale and what the player actually sees from the chase camera |
The paintings set the mood. Never copy their colours or effects literally where they fight these rules.
The rules
How the game shades. The game's shader does the light: hard-edged lit and shade bands, a cool violet shade, and screen-space ink outlines on silhouettes and major creases.
- Your materials are flat pigments: one base colour per surface.
- No gradients, no baked lighting or ambient occlusion, no roughness or metal showcase.
tools/review_render.pyapproximates the game shader, so check your work there.
Real modelled forms. Detail is drawn with shape and line, not noise.
- Model the real parts: window reveals and recessed glass, door seams, tread plates with risers, hollow tube rails, tyre sidewalls, lamp housings.
- Flat boxes with painted-on detail don't pass.
Drawn detail is allowed as a texture, if it is drawn the way a cel painter draws it:
- stencil lettering;
- hazard stripes;
- panel lines;
- cracks in glass;
- worn-paint shapes with clean edges.
No photo textures, tiled noise or normal maps.
Never:
- the "2004 game" render: photoreal attempts, PBR showcase materials, glossy plastic sheen, gray-brown "realistic" textures;
- random greebles or generic clutter;
- parts floating above their supports;
- a dirty or grime filter.
Readable at race distance. The player passes at 25–120 m from a chase camera 3 m above the road, at speed.
- The silhouette must say what the object is at 80 m.
- Members thinner than about 0.12 m vanish below one pixel at 80 m. Thicken the members that carry the read the way a cel artist would, and say what you exaggerated.
Burial.
- Sand drifts against the windward side. Wheels sink into it, and the tyres are flat.
- The sand bed blends into the terrain with no visible rim.
- The sand pigment is
#f3b275.
No real brands. The fleet is fictional (see the sibling tug). No real airline or manufacturer logos.
tools/review_render.py
The review tool every agent ran; 426 lines of Python for Blender 5.1.
"""Standard review renders for the prop trial: the same views, light and cel look for every agent.
Run headless; the .blend on disk is never changed:
"D:/Blender 5.1/blender.exe" -b out/<agent>/stair_truck.blend --python-exit-code 1 ^
-P tools/review_render.py -- --collection Prop --out out/<agent>/review
What it does:
- Renders every object in the collection (recursively). Objects whose name contains `_lod1` or `_lod2` are hidden
in the main views and shown in their own LOD views.
- Swaps each material for a two-band cel approximation of the game's [track name withheld] shader: lit = the pigment,
shade = min(pigment x 0.72, mix(pigment x 0.5, violet, 0.7)), with a hard edge at N.L = 0.14 and real cast
shadows. The pigment is the Principled BSDF's Base Color (its linked texture, if any).
- Adds dark violet ink lines (Freestyle), the game's low sun (20 degrees elevation), a sand ground at Z = 0 and a
flat teal sky.
- Writes PNG views plus stats.json (triangles per object and per LOD level, bounding box, materials, textures).
It approximates the game's look for comparison only; it is not the game renderer.
"""
import argparse
import json
import math
import os
import sys
import bmesh
import bpy
import mathutils
import numpy as np
from bpy_extras.object_utils import world_to_camera_view
# The game's [track name withheld] values (from the game's shader files).
SHADE = (0.14412847, 0.09084171, 0.12477182) # approved violet shade median, linear
PIGMENT = 0.7 # violet-to-base blend in shade
HALF = 0.5
SHADE_CAP = 0.72 # shade never brighter than pigment x this (ink and glazing stay dark)
LIT_EDGE = 0.14 # N.L above this is lit
SUN_ELEVATION = 20.0 # SUN_DIRECTION y = 0.342 -> asin = 20 degrees
SUN_AZIMUTH = 225.0 # review choice: sun behind the camera's left shoulder in the front 3/4 views
SAND = (0.8963, 0.4452, 0.1779) # #f3b275 dune pigment, linear
SKY = (0.1413, 0.4969, 0.5149) # (105,187,190) sampled from the signature painting's sky, linear
INK = (0.0395, 0.0273, 0.0395) # (56,46,56) ink, linear
RES = (1920, 1080)
CROP_ZOOM = 3 # road-view crops are enlarged with nearest-neighbour, so every game pixel stays visible
CROP_PAD = 0.15 # crop margin around the prop, as a share of its screen size
RIM_HEIGHT = 0.01 # open edges this close to Z = 0 are a weld rim into the terrain, not a drawn edge
ROAD_EYE = 3.0 # chase-camera eye height in metres
ROAD_VFOV = 70.0 # game camera vertical field of view in degrees
def args():
argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
p = argparse.ArgumentParser()
p.add_argument("--collection", default="Prop")
p.add_argument("--out", required=True)
p.add_argument("--azimuth", type=float, default=35.0, help="degrees from the front for 3/4 and road views")
p.add_argument("--front", default="-Y", choices=["-Y", "+Y", "-X", "+X"], help="axis the prop's front faces")
return p.parse_args(argv)
def lod_level(name):
n = name.lower()
if "_lod2" in n:
return 2
if "_lod1" in n:
return 1
return 0
def mesh_objects(col):
return [o for o in col.all_objects if o.type == "MESH"]
def tri_count(obj):
dg = bpy.context.evaluated_depsgraph_get()
ev = obj.evaluated_get(dg)
me = ev.to_mesh()
me.calc_loop_triangles()
n = len(me.loop_triangles)
ev.to_mesh_clear()
return n
def bbox(objs):
lo = mathutils.Vector((1e9, 1e9, 1e9))
hi = -lo
for o in objs:
for c in o.bound_box:
w = o.matrix_world @ mathutils.Vector(c)
lo = mathutils.Vector(map(min, lo, w))
hi = mathutils.Vector(map(max, hi, w))
return lo, hi
def cel_material(mat):
"""Replace the material's output with the two-band cel approximation (in memory only)."""
if not mat or not mat.use_nodes:
return
nt = mat.node_tree
bsdf = next((n for n in nt.nodes if n.type == "BSDF_PRINCIPLED"), None)
out = next((n for n in nt.nodes if n.type == "OUTPUT_MATERIAL" and n.is_active_output), None)
if out is None:
out = next((n for n in nt.nodes if n.type == "OUTPUT_MATERIAL"), None)
if out is None:
return
rgb = nt.nodes.new("ShaderNodeRGB")
if bsdf is not None:
base_in = bsdf.inputs["Base Color"]
rgb.outputs[0].default_value = base_in.default_value
base = base_in.links[0].from_socket if base_in.links else rgb.outputs[0]
else:
rgb.outputs[0].default_value = (*mat.diffuse_color[:3], 1.0)
base = rgb.outputs[0]
diff = nt.nodes.new("ShaderNodeBsdfDiffuse")
diff.inputs["Color"].default_value = (1, 1, 1, 1)
s2r = nt.nodes.new("ShaderNodeShaderToRGB")
nt.links.new(diff.outputs[0], s2r.inputs[0])
bw = nt.nodes.new("ShaderNodeRGBToBW")
nt.links.new(s2r.outputs["Color"], bw.inputs[0])
step = nt.nodes.new("ShaderNodeMath")
step.operation = "GREATER_THAN"
step.inputs[1].default_value = LIT_EDGE
nt.links.new(bw.outputs[0], step.inputs[0])
# shade = min(base*cap, base*half*(1-pigment) + shade*pigment)
half = nt.nodes.new("ShaderNodeVectorMath")
half.operation = "SCALE"
half.inputs["Scale"].default_value = HALF * (1.0 - PIGMENT)
nt.links.new(base, half.inputs[0])
add = nt.nodes.new("ShaderNodeVectorMath")
add.operation = "ADD"
add.inputs[1].default_value = tuple(c * PIGMENT for c in SHADE)
nt.links.new(half.outputs[0], add.inputs[0])
cap = nt.nodes.new("ShaderNodeVectorMath")
cap.operation = "SCALE"
cap.inputs["Scale"].default_value = SHADE_CAP
nt.links.new(base, cap.inputs[0])
mn = nt.nodes.new("ShaderNodeVectorMath")
mn.operation = "MINIMUM"
nt.links.new(add.outputs[0], mn.inputs[0])
nt.links.new(cap.outputs[0], mn.inputs[1])
mix = nt.nodes.new("ShaderNodeMix")
mix.data_type = "RGBA"
nt.links.new(step.outputs[0], mix.inputs["Factor"])
nt.links.new(mn.outputs[0], mix.inputs[6])
nt.links.new(base, mix.inputs[7])
em = nt.nodes.new("ShaderNodeEmission")
nt.links.new(mix.outputs[2], em.inputs["Color"])
nt.links.new(em.outputs[0], out.inputs["Surface"])
if "Displacement" in out.inputs:
for link in list(out.inputs["Displacement"].links):
nt.links.remove(link)
def mark_ground_rims(objs):
"""Mark faces on open edges lying at ground level so the ink skips the weld rim, as the game's ink does."""
for o in objs:
me = o.data
bm = bmesh.new()
bm.from_mesh(me)
mw = o.matrix_world
marked = set()
for e in bm.edges:
if e.is_boundary and all(abs((mw @ v.co).z) < RIM_HEIGHT for v in e.verts):
marked.update(f.index for f in e.link_faces)
bm.free()
if not marked:
continue
attr = me.attributes.get("freestyle_face") or me.attributes.new("freestyle_face", "BOOLEAN", "FACE")
values = [False] * len(me.polygons)
attr.data.foreach_get("value", values)
for i in marked:
values[i] = True
attr.data.foreach_set("value", values)
def flat_material(name, colour):
m = bpy.data.materials.new(name)
m.use_nodes = True
bsdf = next(n for n in m.node_tree.nodes if n.type == "BSDF_PRINCIPLED")
bsdf.inputs["Base Color"].default_value = (*colour, 1.0)
return m
def setup_scene(target_objs):
scene = bpy.context.scene
keep = set(target_objs)
for o in scene.objects:
if o not in keep:
o.hide_render = True
scene.render.engine = "BLENDER_EEVEE"
scene.render.resolution_x, scene.render.resolution_y = RES
scene.render.resolution_percentage = 100
scene.render.film_transparent = False
try:
scene.view_settings.view_transform = "Standard"
except TypeError:
pass
scene.view_settings.look = "None"
scene.view_settings.exposure = 0.0
scene.view_settings.gamma = 1.0
scene.render.image_settings.file_format = "PNG"
# Sky: seen by the camera only; the cel bands take light from the sun alone.
world = bpy.data.worlds.new("review_sky")
world.use_nodes = True
wn = world.node_tree
for n in list(wn.nodes):
wn.nodes.remove(n)
lp = wn.nodes.new("ShaderNodeLightPath")
bg_sky = wn.nodes.new("ShaderNodeBackground")
bg_sky.inputs["Color"].default_value = (*SKY, 1.0)
bg_none = wn.nodes.new("ShaderNodeBackground")
bg_none.inputs["Color"].default_value = (0, 0, 0, 1)
mixs = wn.nodes.new("ShaderNodeMixShader")
wout = wn.nodes.new("ShaderNodeOutputWorld")
wn.links.new(lp.outputs["Is Camera Ray"], mixs.inputs[0])
wn.links.new(bg_none.outputs[0], mixs.inputs[1])
wn.links.new(bg_sky.outputs[0], mixs.inputs[2])
wn.links.new(mixs.outputs[0], wout.inputs[0])
scene.world = world
# Sun
sun_data = bpy.data.lights.new("review_sun", "SUN")
sun_data.energy = math.pi # Blender diffuse returns E/pi; pi makes the shader-to-RGB value equal N.L
sun_data.angle = 0.0
try:
sun_data.use_shadow = True
except AttributeError:
pass
sun = bpy.data.objects.new("review_sun", sun_data)
scene.collection.objects.link(sun)
el, az = math.radians(SUN_ELEVATION), math.radians(SUN_AZIMUTH)
to_sun = mathutils.Vector((math.sin(az) * math.cos(el), -math.cos(az) * math.cos(el), math.sin(el)))
sun.rotation_euler = (-to_sun).to_track_quat("-Z", "Y").to_euler()
for o in scene.objects:
if o.type == "LIGHT" and o is not sun:
o.hide_render = True
# Sand ground
bpy.ops.mesh.primitive_plane_add(size=4000.0, location=(0, 0, -0.002))
ground = bpy.context.active_object
ground.name = "review_ground"
ground.data.materials.append(flat_material("review_sand", SAND))
# Cel materials (in memory; the file is never saved)
for m in bpy.data.materials:
cel_material(m)
# Ink
scene.render.use_freestyle = True
scene.render.line_thickness_mode = "ABSOLUTE"
scene.render.line_thickness = 1.5
vl = scene.view_layers[0]
vl.use_freestyle = True
fs = vl.freestyle_settings
fs.crease_angle = math.radians(134.0)
for old in list(fs.linesets):
fs.linesets.remove(old) # the file's own line sets would draw other edge types
ls = fs.linesets.new("ink")
ls.select_by_visibility = True
mark_ground_rims(target_objs)
ls.select_by_face_marks = True
ls.face_mark_negation = "EXCLUSIVE"
ls.face_mark_condition = "ONE"
ls.select_silhouette = True
ls.select_border = False # open mesh rims (the sand bed edge) are not drawn by the game ink either
ls.select_crease = True
if ls.linestyle is None:
ls.linestyle = bpy.data.linestyles.new("ink")
ls.linestyle.color = INK
ls.linestyle.thickness = 1.5
return scene, ground
def camera(scene, name):
cam_data = bpy.data.cameras.new(name)
cam = bpy.data.objects.new(name, cam_data)
scene.collection.objects.link(cam)
scene.camera = cam
return cam
def look_at(cam, eye, target):
cam.location = eye
cam.rotation_euler = (mathutils.Vector(target) - mathutils.Vector(eye)).to_track_quat("-Z", "Y").to_euler()
def render(scene, path):
scene.render.filepath = path
bpy.ops.render.render(write_still=True)
print("wrote", path)
def native_crop(scene, cam, objs, path):
"""Crop the prop out of a road view at native pixels and enlarge it with nearest-neighbour."""
xs, ys = [], []
for o in objs:
for c in o.bound_box:
p = world_to_camera_view(scene, cam, o.matrix_world @ mathutils.Vector(c))
xs.append(p.x)
ys.append(p.y)
w, h = RES
pad_x = (max(xs) - min(xs)) * CROP_PAD
pad_y = (max(ys) - min(ys)) * CROP_PAD
x0 = max(0, int((min(xs) - pad_x) * w))
x1 = min(w, int((max(xs) + pad_x) * w) + 1)
y0 = max(0, int((min(ys) - pad_y) * h))
y1 = min(h, int((max(ys) + pad_y) * h) + 1)
src = bpy.data.images.load(path)
px = np.empty(w * h * 4, dtype=np.float32)
src.pixels.foreach_get(px)
px = px.reshape(h, w, 4)[y0:y1, x0:x1]
px = np.repeat(np.repeat(px, CROP_ZOOM, axis=0), CROP_ZOOM, axis=1)
out = bpy.data.images.new("crop", px.shape[1], px.shape[0], alpha=True)
out.pixels.foreach_set(px.ravel())
out.filepath_raw = path.replace(".png", "_native_x3.png")
out.file_format = "PNG"
out.save()
print("wrote", out.filepath_raw, f"({x1 - x0}x{y1 - y0} game pixels)")
def set_visible(objs_by_level, level):
for lvl, objs in objs_by_level.items():
for o in objs:
o.hide_render = lvl != level
def main():
a = args()
col = bpy.data.collections.get(a.collection)
if col is None:
raise SystemExit(f"collection {a.collection!r} not found; have {[c.name for c in bpy.data.collections]}")
objs = mesh_objects(col)
if not objs:
raise SystemExit("collection has no mesh objects")
out = os.path.abspath(a.out)
os.makedirs(out, exist_ok=True)
by_level = {0: [], 1: [], 2: []}
for o in objs:
by_level[lod_level(o.name)].append(o)
# Stats before any change
stats = {"objects": {}, "triangles_per_lod": {}, "materials": set(), "textures": {}}
for lvl, lst in by_level.items():
total = 0
groups = {"truck": 0, "bed": 0}
for o in lst:
t = tri_count(o)
total += t
groups["bed" if "_bed" in o.name.lower() else "truck"] += t
stats["objects"][o.name] = {"lod": lvl, "triangles": t,
"materials": [m.name for m in o.data.materials if m]}
stats["materials"].update(m.name for m in o.data.materials if m)
if lst:
stats["triangles_per_lod"][f"lod{lvl}"] = {**groups, "total": total}
for img in bpy.data.images:
if img.size[0]:
stats["textures"][img.name] = list(img.size)
lo, hi = bbox(by_level[0])
stats["bbox_lod0_m"] = {"min": [round(v, 3) for v in lo], "max": [round(v, 3) for v in hi],
"size": [round(v, 3) for v in (hi - lo)]}
stats["materials"] = sorted(stats["materials"])
with open(os.path.join(out, "stats.json"), "w", encoding="utf-8") as f:
json.dump(stats, f, indent=1)
print(json.dumps({k: stats[k] for k in ("triangles_per_lod", "bbox_lod0_m")}))
scene, _ = setup_scene(objs)
set_visible(by_level, 0)
size = hi - lo
centre = (lo + hi) / 2
span = max(size.x, size.y, size.z)
aspect = RES[0] / RES[1]
cam = camera(scene, "review_cam")
cd = cam.data
# Orthographic views
cd.type = "ORTHO"
far = span * 4.0 + 50.0
cd.clip_end = far * 2
f = mathutils.Vector({"-Y": (0, -1, 0), "+Y": (0, 1, 0), "-X": (-1, 0, 0), "+X": (1, 0, 0)}[a.front])
s = mathutils.Vector((-f.y, f.x, 0.0))
across = abs(size.dot(s))
along = abs(size.dot(f))
for name, eye_dir, w, h in (
("01_front", f, across, size.z),
("02_side_a", s, along, size.z),
("03_side_b", -s, along, size.z),
("04_rear", -f, across, size.z),
("05_top", (0, 0, 1), size.x, size.y),
):
cd.ortho_scale = max(w, h * aspect) * 1.15
d = mathutils.Vector(eye_dir)
look_at(cam, centre + d * far, centre)
if name == "05_top":
cam.rotation_euler = (0, 0, 0)
cam.location = (centre.x, centre.y, centre.z + far)
render(scene, os.path.join(out, name + ".png"))
# Perspective views
cd.type = "PERSP"
cd.sensor_fit = "VERTICAL"
cd.clip_start = 0.05
cd.clip_end = 5000.0
az = math.radians(a.azimuth)
# Framed 3/4 views (35 degree vertical FOV, whole prop in frame)
cd.angle_y = math.radians(35.0)
hfov_half = math.atan(math.tan(cd.angle_y / 2) * aspect)
dist = span * 0.7 / math.tan(hfov_half) + span * 0.5
for name, azi in (("06_three_quarter_front", az), ("07_three_quarter_rear", az + math.pi)):
horiz = f * math.cos(azi) + s * math.sin(azi)
eye = centre + (horiz + mathutils.Vector((0, 0, 0.45))).normalized() * dist
look_at(cam, eye, centre)
render(scene, os.path.join(out, name + ".png"))
# Road views: the chase camera's eye height and field of view, at real distances
cd.angle_y = math.radians(ROAD_VFOV)
for lvl, label, d in ((0, "08_road_25m", 25.0), (0, "09_road_80m", 80.0), (1, "10_road_50m_lod1", 50.0),
(2, "11_road_120m_lod2", 120.0)):
if not by_level[lvl]:
continue
set_visible(by_level, lvl)
horiz = f * math.cos(az) + s * math.sin(az)
eye = mathutils.Vector((centre.x + horiz.x * d, centre.y + horiz.y * d, ROAD_EYE))
target = mathutils.Vector((centre.x, centre.y, max(1.0, centre.z)))
look_at(cam, eye, target)
render(scene, os.path.join(out, label + ".png"))
native_crop(scene, cam, by_level[lvl], os.path.join(out, label + ".png"))
set_visible(by_level, 0)
print("review done:", out)
main()