Hologram calls, HaulOS phone, Enhanced lighting, smoother camera; Blender remaster review files
Game: - Assistant and Director portraits: GPT backgrounds and a holographic appear/disappear shader (Talk/TalkHolo) instead of on/off - Phone redesigned (HaulOS home, address bar, dock, error/loading states) and the browser link made sturdier - Settings > Graphics > Lighting: Classic / Enhanced (runtime volume, no project assets changed); Enhanced SSAO uses the smooth interleaved-gradient method at high samples so flat panels don't speckle - Painted board textures (T_HullPanel, T_BarnRed) keep only edge wear: the big bare-wood patches read as dirty smudges - The head leans into a sidestep smoothly instead of snapping with A / D - New keys in all 11 languages Review only (nothing swapped into the game yet): ArtSource/Blender/remaster (v1 paint pass of our own models, Synty-built ones left out), remaster/crew (crew repaint with arm, colour-edge and face fixes), remaster_v2 (smooth-geometry pilot). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
269
ArtSource/Blender/remaster/scripts/review.py
Normal file
269
ArtSource/Blender/remaster/scripts/review.py
Normal file
@ -0,0 +1,269 @@
|
||||
"""GRASS CUTTER - builds Remaster_Review.blend: every remastered model next to its original, grouped by category.
|
||||
|
||||
Collections: Remastered/<Category> (the remasters, appended from <OUT>/<name>.blend) and Originals/<Category>
|
||||
(the game FBX with the game's flat materials), each model under an empty named after it. The original stands on the
|
||||
left of its remaster, a label in front of each pair (name, tris before -> after), a category title at each row.
|
||||
Sun + sky world, a ground plane, a camera; every 3D view opens in Material Preview with the scene's lights and world.
|
||||
|
||||
Run: blender -b --factory-startup --python review.py --python-exit-code 1
|
||||
"""
|
||||
import bpy, json, math, os, sys
|
||||
from mathutils import Vector, Euler
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
import remaster as R
|
||||
|
||||
OUT = R.OUT
|
||||
REVIEW = os.path.join(OUT, "Remaster_Review.blend")
|
||||
|
||||
|
||||
def coll(name, parent):
|
||||
c = bpy.data.collections.get(name) or bpy.data.collections.new(name)
|
||||
if c.name not in parent.children:
|
||||
parent.children.link(c)
|
||||
return c
|
||||
|
||||
|
||||
def text(body, loc, size, col, mat, align="CENTER"):
|
||||
cu = bpy.data.curves.new("T_" + body[:20], "FONT")
|
||||
cu.body = body
|
||||
cu.size = size
|
||||
cu.align_x = align
|
||||
cu.align_y = "CENTER"
|
||||
cu.extrude = size * 0.02
|
||||
o = bpy.data.objects.new("Label_" + body.split("\n")[0][:30], cu)
|
||||
o.location = loc
|
||||
cu.materials.append(mat)
|
||||
col.objects.link(o)
|
||||
return o
|
||||
|
||||
|
||||
def flat_mat(name, rgb, rough=0.8):
|
||||
m = bpy.data.materials.new(name)
|
||||
b = m.node_tree.nodes.get("Principled BSDF")
|
||||
b.inputs["Base Color"].default_value = (*rgb, 1)
|
||||
b.inputs["Roughness"].default_value = rough
|
||||
return m
|
||||
|
||||
|
||||
def bounds(objs):
|
||||
bpy.context.view_layer.update()
|
||||
mn = Vector((1e9,) * 3)
|
||||
mx = Vector((-1e9,) * 3)
|
||||
for o in objs:
|
||||
if o.type != "MESH":
|
||||
continue
|
||||
for c in o.bound_box:
|
||||
w = o.matrix_world @ Vector(c)
|
||||
mn = Vector(map(min, mn, w))
|
||||
mx = Vector(map(max, mx, w))
|
||||
return mn, mx
|
||||
|
||||
|
||||
def group_under(objs, name, col):
|
||||
"""Move objs into col and parent their roots under a new empty at the origin."""
|
||||
e = bpy.data.objects.new(name, None)
|
||||
e.empty_display_size = 0.2
|
||||
e.empty_display_type = "PLAIN_AXES"
|
||||
col.objects.link(e)
|
||||
for o in objs:
|
||||
for c in list(o.users_collection):
|
||||
c.objects.unlink(o)
|
||||
col.objects.link(o)
|
||||
for o in objs:
|
||||
if o.parent is None or o.parent not in objs:
|
||||
mw = o.matrix_world.copy()
|
||||
o.parent = e
|
||||
o.matrix_world = mw
|
||||
return e
|
||||
|
||||
|
||||
def append_remaster(name, col):
|
||||
path = os.path.join(OUT, name + ".blend")
|
||||
with bpy.data.libraries.load(path, link=False) as (src, dst):
|
||||
dst.objects = list(src.objects)
|
||||
objs = [o for o in dst.objects if o is not None]
|
||||
sc = bpy.context.scene
|
||||
for o in objs:
|
||||
sc.collection.objects.link(o)
|
||||
return objs
|
||||
|
||||
|
||||
def import_original(name):
|
||||
before = set(bpy.data.objects)
|
||||
mats_before = set(bpy.data.materials)
|
||||
bpy.ops.import_scene.fbx(filepath=os.path.join(R.MODELS_DIR, name + ".fbx"))
|
||||
objs = [o for o in bpy.data.objects if o not in before]
|
||||
built = {}
|
||||
for o in objs:
|
||||
if o.type != "MESH":
|
||||
continue
|
||||
for i, ms in enumerate(o.data.materials):
|
||||
if ms is None:
|
||||
continue
|
||||
nb = R.base_name(ms.name)
|
||||
if nb not in built:
|
||||
m = R.orig_material(nb)
|
||||
m.name = "ORIG_" + nb
|
||||
built[nb] = m
|
||||
o.data.materials[i] = built[nb]
|
||||
for m in list(bpy.data.materials):
|
||||
if m not in mats_before and m.users == 0:
|
||||
bpy.data.materials.remove(m)
|
||||
return objs
|
||||
|
||||
|
||||
def setup_world(sc, sun_rot):
|
||||
w = bpy.data.worlds.new("ReviewSky")
|
||||
sc.world = w
|
||||
nt = w.node_tree
|
||||
bg = nt.nodes.get("Background")
|
||||
ok = False
|
||||
try:
|
||||
sky = nt.nodes.new("ShaderNodeTexSky")
|
||||
for t in ("MULTIPLE_SCATTERING", "SINGLE_SCATTERING", "NISHITA", "HOSEK_WILKIE", "PREETHAM"):
|
||||
try:
|
||||
sky.sky_type = t
|
||||
break
|
||||
except Exception:
|
||||
continue
|
||||
try:
|
||||
sky.sun_elevation = math.radians(90 - math.degrees(sun_rot[0]))
|
||||
sky.sun_rotation = math.radians(-math.degrees(sun_rot[2]))
|
||||
sky.sun_disc = False
|
||||
except Exception:
|
||||
pass
|
||||
nt.links.new(sky.outputs["Color"], bg.inputs["Color"])
|
||||
bg.inputs["Strength"].default_value = 0.25
|
||||
ok = True
|
||||
except Exception:
|
||||
pass
|
||||
if not ok:
|
||||
bg.inputs["Color"].default_value = (0.55, 0.70, 0.90, 1)
|
||||
bg.inputs["Strength"].default_value = 0.8
|
||||
|
||||
|
||||
def main():
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
sc = bpy.context.scene
|
||||
sc.render.engine = "BLENDER_EEVEE"
|
||||
try:
|
||||
sc.view_settings.view_transform = "AgX"
|
||||
sc.view_settings.look = "AgX - Punchy"
|
||||
except Exception:
|
||||
pass
|
||||
root_r = coll("Remastered", sc.collection)
|
||||
root_o = coll("Originals", sc.collection)
|
||||
root_l = coll("Labels", sc.collection)
|
||||
root_s = coll("Stage", sc.collection)
|
||||
m_label = flat_mat("Label_Ink", (0.03, 0.035, 0.04), 0.6)
|
||||
m_title = flat_mat("Label_Title", (0.85, 0.30, 0.10), 0.6)
|
||||
m_sub = flat_mat("Label_Sub", (0.20, 0.22, 0.25), 0.6)
|
||||
|
||||
y = 0.0
|
||||
xmax = 0.0
|
||||
placed = 0
|
||||
skipped = []
|
||||
focus_x = focus_y = 0.0
|
||||
for cat, names in R.CATEGORIES.items():
|
||||
if cat == "World": # the spires and the UFO are huge: the view is framed on the rows in front of them
|
||||
focus_x, focus_y = xmax, y
|
||||
cr = coll("R_" + cat, root_r)
|
||||
co = coll("O_" + cat, root_o)
|
||||
rows = []
|
||||
x = 0.0
|
||||
depth = 0.0
|
||||
for name in names:
|
||||
stp = os.path.join(R.STATS, name + ".json")
|
||||
if not os.path.exists(os.path.join(OUT, name + ".blend")) or not os.path.exists(stp):
|
||||
skipped.append(name)
|
||||
continue
|
||||
st = json.load(open(stp))
|
||||
ro = append_remaster(name, cr)
|
||||
oo = import_original(name)
|
||||
mn, mx = bounds(ro)
|
||||
size = mx - mn
|
||||
gap = max(0.25, size.x * 0.15)
|
||||
er = group_under(ro, name, cr)
|
||||
eo = group_under(oo, name + "_orig", co)
|
||||
# the pair: original left (Blender -X... the viewer looks along +Y, so left is -X), remaster right
|
||||
cx = x + size.x / 2 - mn.x
|
||||
eo.location = Vector((x - mn.x, y - mn.y, -mn.z * 0 + 0.0))
|
||||
er.location = Vector((x + size.x + gap - mn.x, y - mn.y, 0.0))
|
||||
pair_w = size.x * 2 + gap
|
||||
lab = "%s\n%s -> %s tris" % (name[3:], format(st["tris_before"], ","), format(st["tris_after"], ","))
|
||||
ls = min(max(0.06 * pair_w, 0.05), 0.35)
|
||||
text(lab, (x + pair_w / 2, y - 0.25 - ls * 1.2, 0.002), ls, root_l, m_label)
|
||||
text("original", (x + size.x / 2, y - 0.08 - ls * 0.3, 0.002), ls * 0.5, root_l, m_sub)
|
||||
text("remaster", (x + size.x * 1.5 + gap, y - 0.08 - ls * 0.3, 0.002), ls * 0.5, root_l, m_sub)
|
||||
x += pair_w + max(0.8, pair_w * 0.35)
|
||||
depth = max(depth, size.y)
|
||||
placed += 1
|
||||
tsz = 0.9
|
||||
t = text(cat.upper(), (-0.6, y + depth * 0.3, 0.002), tsz, root_l, m_title, align="RIGHT")
|
||||
xmax = max(xmax, x)
|
||||
y += depth + 3.0
|
||||
# stage
|
||||
gm = bpy.data.meshes.new("Ground")
|
||||
s0, s1 = Vector((-15, -12, 0)), Vector((xmax + 15, y + 15, 0))
|
||||
gm.from_pydata([(s0.x, s0.y, -0.002), (s1.x, s0.y, -0.002), (s1.x, s1.y, -0.002), (s0.x, s1.y, -0.002)], [], [(0, 1, 2, 3)])
|
||||
g = bpy.data.objects.new("Ground", gm)
|
||||
gm.materials.append(flat_mat("Ground_Mat", (0.20, 0.23, 0.18), 0.95))
|
||||
root_s.objects.link(g)
|
||||
sun_rot = (math.radians(42), math.radians(8), math.radians(-35))
|
||||
ld = bpy.data.lights.new("Sun", "SUN")
|
||||
ld.energy = 2.6
|
||||
ld.angle = math.radians(4)
|
||||
sun = bpy.data.objects.new("Sun", ld)
|
||||
sun.rotation_euler = sun_rot
|
||||
root_s.objects.link(sun)
|
||||
fl = bpy.data.lights.new("SkyFill", "SUN")
|
||||
fl.energy = 0.6
|
||||
fl.angle = math.radians(40)
|
||||
fo = bpy.data.objects.new("SkyFill", fl)
|
||||
fo.rotation_euler = (math.radians(60), 0, math.radians(150))
|
||||
root_s.objects.link(fo)
|
||||
setup_world(sc, sun_rot)
|
||||
if focus_y <= 0:
|
||||
focus_x, focus_y = xmax, y
|
||||
ctr = Vector((focus_x / 2, focus_y * 0.4, 0))
|
||||
cd = bpy.data.cameras.new("ReviewCam")
|
||||
cd.lens = 28
|
||||
cd.clip_end = 2000
|
||||
cam = bpy.data.objects.new("ReviewCam", cd)
|
||||
dist = max(focus_x, focus_y) * 0.85 + 6
|
||||
cam.location = ctr + Vector((0, -dist * 0.8, dist * 0.6))
|
||||
cam.rotation_euler = (ctr - cam.location).to_track_quat("-Z", "Y").to_euler()
|
||||
root_s.objects.link(cam)
|
||||
sc.camera = cam
|
||||
sc.render.resolution_x, sc.render.resolution_y = 1920, 1080
|
||||
try:
|
||||
sc.eevee.taa_render_samples = 32
|
||||
except Exception:
|
||||
pass
|
||||
# viewports: Material Preview with the scene lights and world, framed on the whole layout
|
||||
for scr in bpy.data.screens:
|
||||
for a in scr.areas:
|
||||
if a.type != "VIEW_3D":
|
||||
continue
|
||||
for sp in a.spaces:
|
||||
if sp.type != "VIEW_3D":
|
||||
continue
|
||||
sp.shading.type = "MATERIAL"
|
||||
sp.shading.use_scene_lights = True
|
||||
sp.shading.use_scene_world = True
|
||||
sp.clip_end = 2000
|
||||
r3 = sp.region_3d
|
||||
if r3:
|
||||
r3.view_location = ctr
|
||||
r3.view_distance = dist
|
||||
r3.view_rotation = Euler((math.radians(55), 0, math.radians(-15))).to_quaternion()
|
||||
r3.view_perspective = "PERSP"
|
||||
bpy.ops.wm.save_as_mainfile(filepath=REVIEW, check_existing=False, relative_remap=True, compress=True)
|
||||
print("[review] placed %d models, skipped %s" % (placed, skipped))
|
||||
if "--render" in sys.argv:
|
||||
sc.render.filepath = os.path.join(R.PREVOUT, "Remaster_Review_overview.png")
|
||||
bpy.ops.render.render(write_still=True)
|
||||
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user