FBC: NIGHT SHIFT - baked the slick light-grey concrete and produced the final concept renders

This commit is contained in:
dandovlatov 2026-11-23 16:22:04 +04:00
parent 757a239d5b
commit 69fcf0b49b
12 changed files with 80 additions and 53 deletions

View file

@ -59,8 +59,9 @@ raylib 6.2 is fetched automatically by CMake (FetchContent). Needs a C++23 compi
- `docs/ROADMAP.md` — milestones M0–M6 and current status
- `docs/concept/` — rendered Blender concept frames (visual target for M5)
- `docs/ENV_ENHANCEMENT.md` — enhancement slices S0–S15 for the environment/actors
- `ConcreteMaterial.blend` + `tools/blender/bake_cgtrader_concrete.py` — CGTrader
concrete source material and the reproducible 2K bake used by floor/walls/pillars
- `ConcreteMaterial.blend` + `tools/blender/bake_cgtrader_concrete.py` and
`process_concrete_maps.py` — CGTrader concrete source and the reproducible 2K
bake/post-process used by floor/walls/pillars
- `tools/blender/` — procedural diorama + actor builders (`actor_kit.py` loft/sweep/blob/crystal helpers) and render scripts
- `assets/models/` — game-ready GLB actors (guard, 3 enemies, cyan resonance point crystal) and `props/` OoP set dressing
- `assets/textures/concrete/` — shared seamless albedo/normal/roughness maps

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 MiB

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View file

@ -27,7 +27,8 @@ units are little free-standing puppets rather than printed cards:
- Concrete `#2b2b2f`, paper `#e8e4d8`, redaction `#111111`
- One tileable concrete PBR set (albedo/normal/roughness, baked in Blender from
the CGTrader "Concrete material" by KirillP and tinted to graphite) is reused
the CGTrader "Concrete material" by KirillP, kept light grey with the crack
network baked into the albedo) is reused
on every concrete surface — floor, curbs, pillars, door frame — via world-space
triplanar mapping, so texel density is identical everywhere. The source
`.blend` and its bake script live in the repo root / `tools/blender/`

View file

@ -397,11 +397,15 @@ clipping < 0.5%, red-dominant 15–25%.
`tools/blender/bake_cgtrader_concrete.py` torus-maps the source's 4D
Noise/Musgrave/Voronoi to a seamless tile, bakes albedo + height, derives a
seamless normal from the two bump signals, and remaps roughness before writing
3 x 2K PNGs to `assets/textures/concrete/`. Albedo is tinted to the graphite
palette (mean 0.17, matching the old set) so the material's crack network and
fine aggregate read without breaking the look. Game load verified with a
temporary magenta albedo test; diorama scene rebuilt and concept frames
re-rendered. Old generator in `build_materials.py` remains as a fallback.
3 x 2K PNGs to `assets/textures/concrete/`. Follow-up (same day): albedo lifted
to 80% of the source value (mean 0.51, light grey) at the user's request; the
high-frequency speckle is blurred to stop aliasing/shimmer, the Voronoi crack
network is darkened into the albedo so the pattern reads at camera distance,
and the derived normal is softened with a broader roughness range for a slick,
non-sparkly floor. Game load verified with a temporary magenta albedo test;
diorama scene rebuilt and concept frames re-rendered. Old generator in
`build_materials.py` remains as a fallback. The bake needs two interpreters:
Blender for the Cycles maps, system Python + PIL for `process_concrete_maps.py`.
- 2026-11-23 (shard redesign): enemy point crystals are now small Control-style
Resonance crystals — a slim faceted cyan bipyramid (`#00c4eb`) with a hot
`#40dfff` core and three dark splinters, 60 tris down from the 154-tri yellow

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

View file

@ -1,10 +1,9 @@
import math
import os
import subprocess
import sys
import bpy
import numpy as np
from PIL import Image
REPO = "/home/dandovlatov/Documents/cntrl"
SRC = os.path.join(REPO, "ConcreteMaterial.blend")
@ -96,55 +95,17 @@ def bake(name, bake_type):
img.file_format = "PNG"
img.save()
bake_node.select = False
return Image.open(img.filepath_raw).convert("RGB")
albedo = bake("albedo", "DIFFUSE")
bake("albedo", "DIFFUSE")
bake("normal", "NORMAL")
rough = bake("roughness", "ROUGHNESS")
bake("roughness", "ROUGHNESS")
cracks = next(n for n in nodes if n.name == "ColorRamp.002")
bw2 = nodes.new("ShaderNodeRGBToBW")
links.new(cracks.outputs["Color"], bw2.inputs["Color"])
rng2 = nodes.new("ShaderNodeMapRange")
links.new(bw2.outputs[0], rng2.inputs["Value"])
links.new(rng2.outputs["Result"], bsdf.inputs["Roughness"])
voronoi = bake("height_voronoi", "ROUGHNESS")
def arr(img):
return np.asarray(img, np.float32) / 255.0
def upscale(a):
h, w = a.shape[:2]
out = np.zeros((h * 2, w * 2, 3), np.float32)
for c in range(3):
out[:, :, c] = np.asarray(
Image.fromarray((a[:, :, c] * 255).astype(np.uint8)).resize(
(w * 2, h * 2), Image.Resampling.LANCZOS), np.float32) / 255.0
return out
def save(name, a):
Image.fromarray((np.clip(a, 0.0, 1.0) * 255.0 + 0.5).astype(np.uint8)).save(
os.path.join(TEX, name + ".png"))
print("[concrete] saved", name, flush=True)
albedo = upscale(arr(albedo)) * np.array([0.265, 0.265, 0.30], np.float32)
rough = upscale(arr(rough))
r = rough[:, :, 0]
rough[:, :, 0] = rough[:, :, 1] = rough[:, :, 2] = (
(r - r.min()) / max(r.max() - r.min(), 1e-5) * 0.38 + 0.30)
voronoi = upscale(arr(voronoi))[:, :, 0]
h = 0.37 * (rough[:, :, 0] - rough[:, :, 0].mean()) + 0.89 * (voronoi - voronoi.mean())
gx = (np.roll(h, -1, 1) - np.roll(h, 1, 1)) * 0.5
gy = (np.roll(h, -1, 0) - np.roll(h, 1, 0)) * 0.5
nx, ny, nz = -gx * 12.0, gy * 12.0, np.ones_like(h)
inv = 1.0 / np.sqrt(nx * nx + ny * ny + nz * nz)
normal = np.stack((nx * inv, ny * inv, nz * inv), 2) * 0.5 + 0.5
save("concrete_albedo", albedo)
save("concrete_roughness", rough)
save("concrete_normal", normal)
print("[concrete] done — 3 x 2048px seamless maps from CGTrader ConcreteMaterial.blend")
bake("height_voronoi", "ROUGHNESS")
subprocess.run(["python3", os.path.join(REPO, "tools", "blender",
"process_concrete_maps.py")], check=True)

View file

@ -0,0 +1,60 @@
import os
import numpy as np
from PIL import Image, ImageFilter
REPO = "/home/dandovlatov/Documents/cntrl"
SRC = "/tmp/opencode"
DST = os.path.join(REPO, "assets", "textures", "concrete")
def load(name):
return np.asarray(Image.open(os.path.join(SRC, name + ".png")).convert("RGB"),
np.float32) / 255.0
def save(name, rgb):
Image.fromarray((np.clip(rgb, 0.0, 1.0) * 255.0 + 0.5).astype(np.uint8)).save(
os.path.join(DST, name + ".png"))
im = np.asarray(Image.open(os.path.join(DST, name + ".png")), np.float32) / 255.0
print("[concrete] %-22s mean %.3f seamX %.4f" %
(name + ".png", im.mean(), np.abs(im[:, 0] - im[:, -1]).mean()), flush=True)
def upscale(rgb):
h, w = rgb.shape[:2]
out = np.zeros((h * 2, w * 2, 3), np.float32)
for c in range(3):
out[:, :, c] = np.asarray(
Image.fromarray((rgb[:, :, c] * 255).astype(np.uint8)).resize(
(w * 2, h * 2), Image.Resampling.LANCZOS), np.float32) / 255.0
return out
def blur(a, radius):
return np.asarray(
Image.fromarray((np.clip(a, 0.0, 1.0) * 255.0).astype(np.uint8)).filter(
ImageFilter.GaussianBlur(radius)), np.float32) / 255.0
albedo = upscale(load("albedo")) * np.array([0.80, 0.80, 0.86], np.float32)
albedo = blur(albedo, 1.6)
rough = upscale(load("roughness"))
r = rough[:, :, 0]
rough[:, :, 0] = rough[:, :, 1] = rough[:, :, 2] = (
(r - r.min()) / max(r.max() - r.min(), 1e-5) * 0.27 + 0.45)
voronoi = upscale(load("height_voronoi"))[:, :, 0]
crack = blur(np.clip((0.92 - voronoi) / 0.5, 0.0, 1.0), 1.0)
albedo *= (1.0 - 0.18 * crack)[:, :, None]
height = (0.37 * (blur(rough[:, :, 0], 1.0) - rough[:, :, 0].mean())
+ 0.89 * (blur(voronoi, 1.0) - voronoi.mean()))
gx = (np.roll(height, -1, 1) - np.roll(height, 1, 1)) * 0.5
gy = (np.roll(height, -1, 0) - np.roll(height, 1, 0)) * 0.5
nx, ny, nz = -gx * 8.0, gy * 8.0, np.ones_like(height)
inv = 1.0 / np.sqrt(nx * nx + ny * ny + nz * nz)
normal = np.stack((nx * inv, ny * inv, nz * inv), 2) * 0.5 + 0.5
save("concrete_albedo", albedo)
save("concrete_roughness", rough)
save("concrete_normal", normal)
print("[concrete] 3 x 2048px seamless maps written")