diff --git a/README.md b/README.md index 408da01..f60a7e1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ cmake -B build && cmake --build build -j6 ./build/cntrl --seed 42 --shadows off # compare lighting ``` -C++23 (GCC 13+) and OpenGL/X11 headers; raylib 6.2 is fetched by CMake. Automated captures: `--screenshot /tmp/shot.png --screenshot-at 8`. Dev QA: `--skill-test` (staged CALL/WARP casts for VFX captures), `--floor-overview`, `--beacon-test`, `--door-test` (sealed Booth), `--disk-test` (Beacons lit, Disk claimed), `--plaza-test`, `--bot`, `--no-damage`, `--trace all`; full flag list in `src/main.cpp`. F12 saves a screenshot. +C++23 (GCC 13+) and OpenGL/X11 headers; raylib 6.2 is fetched by CMake. Automated captures: `--screenshot /tmp/shot.png --screenshot-at 8`. Dev QA: `--skill-test` (staged CALL/WARP casts for VFX captures), `--floor-overview`, `--beacon-test`, `--door-test` (sealed Booth), `--disk-test` (Beacons lit, Disk claimed), `--plaza-test`, `--ascension-test` (staged ambient riser), `--bot`, `--no-damage`, `--trace all`; full flag list in `src/main.cpp`. F12 saves a screenshot. ## Title screen & options diff --git a/assets/blender/fbc_ambient.blend b/assets/blender/fbc_ambient.blend new file mode 100644 index 0000000..3d9148c Binary files /dev/null and b/assets/blender/fbc_ambient.blend differ diff --git a/assets/models/ascended.glb b/assets/models/ascended.glb new file mode 100644 index 0000000..1086f96 Binary files /dev/null and b/assets/models/ascended.glb differ diff --git a/src/main.cpp b/src/main.cpp index 235d78a..d464d13 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,6 +58,7 @@ struct Options { bool menu_options = false; // --menu-options: QA capture of the Options tab bool hiss_test = false; // --hiss-test: close-up of one Hiss Brute bool room_test = false; // --room-test: frozen look at the open-plan room + bool ascension_test = false; // --ascension-test: rise-and-dissolve VFX QA bool aoe_test = false; // --aoe-test: repeating area blast for VFX QA bool skill_test = false; // --skill-test: staged CALL/WARP cast QA scene bool floor_overview = false; // --floor-overview: whole-floor dev camera @@ -138,6 +139,8 @@ Options parse_options(int argc, char** argv) { opts.hiss_test = true; } else if (std::strcmp(argv[i], "--room-test") == 0) { opts.room_test = true; + } else if (std::strcmp(argv[i], "--ascension-test") == 0) { + opts.ascension_test = true; } else if (std::strcmp(argv[i], "--aoe-test") == 0) { opts.aoe_test = true; } else if (std::strcmp(argv[i], "--skill-test") == 0) { @@ -361,6 +364,7 @@ int main(int argc, char** argv) { : Floor::kDefaultPath); game.state = (opts.bot || opts.hiss_test || opts.room_test || opts.aoe_test || opts.skill_test || opts.floor_overview || opts.plaza_test + || opts.ascension_test || opts.office_test || opts.beacon_test || opts.disk_test || opts.door_test || opts.blackout_test) ? GameState::Playing : GameState::Title; @@ -385,6 +389,7 @@ int main(int argc, char** argv) { TraceLog(LOG_INFO, "GFX: concrete filtering = %s", gfx::filtering_name(gfx::graphics_settings().concrete_filter)); presenter.set_floor_overview(opts.floor_overview); + presenter.set_ascension_test(opts.ascension_test); if (opts.fov > 0.0f) presenter.camera_tuning().fov = opts.fov; if (opts.cam_height > 0.0f) presenter.camera_tuning().height = opts.cam_height; if (opts.cam_forward > 0.0f) presenter.camera_tuning().forward = opts.cam_forward; @@ -399,6 +404,19 @@ int main(int argc, char** argv) { } game.enemy_system.clear(); } + if (opts.ascension_test) { + // QA entry: stand in the plaza with the horde cleared so the staged + // riser is framed against open floor at tactical distance. + for (const FloorRoom& r : game.floor.rooms()) { + if (r.kind == RoomKind::Plaza) { + game.player.pos = {(r.rect.x0 + r.rect.x1) * 0.5f, + (r.rect.z0 + r.rect.z1) * 0.5f}; + break; + } + } + game.enemy_system.clear(); + game.config.no_player_damage = true; + } if (opts.office_test) { for (const FloorRoom& r : game.floor.rooms()) { if (r.kind == RoomKind::OfficeSuite) { diff --git a/src/render/models.cpp b/src/render/models.cpp index 0898837..6780fee 100644 --- a/src/render/models.cpp +++ b/src/render/models.cpp @@ -44,6 +44,9 @@ struct Rig { case ActorModel::HissStaff: return {0.60f, 1.40f, 0.20f, 0.38f, 0.85f, 1.0f}; case ActorModel::HissBrute: return {1.05f, 2.10f, 0.40f, 0.95f, 1.0f, 1.0f}; case ActorModel::HissGhost: return {0.60f, 1.35f, 0.22f, 0.36f, 0.9f, 1.0f}; + // Ambient riser: no limb swing — it hangs limp while it climbs. Its + // nervous motion comes from the saturated red paint and the Hiss shader. + case ActorModel::Ascended: return {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f}; case ActorModel::MoldSpore: return {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 2.0f}; case ActorModel::Shard: return {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 3.0f}; case ActorModel::RoundBasic: @@ -64,6 +67,7 @@ float hiss_for(ActorModel id) { // A faint dark-red Hiss wave already crawls over the inert beacon; // activation raises it in the presenter. case ActorModel::Beacon: return 0.22f; + case ActorModel::Ascended: return 0.35f; // always wreathed in Hiss default: return 0.0f; } } @@ -419,6 +423,7 @@ float ModelBank::height(ActorModel id) { case ActorModel::MoldSpore: return 1.3f; case ActorModel::HissBrute: return 2.9f; case ActorModel::HissGhost: return 1.9f; + case ActorModel::Ascended: return 1.95f; case ActorModel::Shard: return 0.55f; case ActorModel::Hotline: return 1.3f; case ActorModel::TV: return 2.3f; @@ -463,6 +468,7 @@ const char* ModelBank::file_name(ActorModel id) { case ActorModel::MoldSpore: return "assets/models/mold_spore.glb"; case ActorModel::HissBrute: return "assets/models/hiss_brute.glb"; case ActorModel::HissGhost: return "assets/models/hiss_ghost.glb"; + case ActorModel::Ascended: return "assets/models/ascended.glb"; case ActorModel::Shard: return "assets/models/shard.glb"; case ActorModel::Hotline: return "assets/models/props/hotline.glb"; case ActorModel::TV: return "assets/models/props/tv.glb"; @@ -502,7 +508,7 @@ const char* ModelBank::file_name(ActorModel id) { bool ModelBank::actor_from_name(const std::string& name, ActorModel& id) { static const char* const kNames[] = { - "Guard", "HissStaff", "MoldSpore", "HissBrute", "HissGhost", "Shard", + "Guard", "HissStaff", "MoldSpore", "HissBrute", "HissGhost", "Ascended", "Shard", "Hotline", "TV", "Pedestal", "Duck", "Cabinet", "Crate", "Debris", "Switch", "OfficeDesk", "MeetingTable", "OfficeChair", "Computer", "Plant", "Sofa", "FloorLamp", "Partition", "GarbageCan", "DocumentStack", "LooseSheet", @@ -544,6 +550,16 @@ void ModelBank::draw_fallback(ActorModel id, Vector3 pos, float yaw, DrawCube(Vector3{0.0f, 1.2f * scale, 0.0f}, 1.5f * scale, 2.4f * scale, 1.0f * scale, tint); break; + case ActorModel::Ascended: + // Ambient riser fallback: keep the dark humanoid silhouette even + // when the GLB is missing, never a white primitive. + DrawCylinder({0.0f, 0.85f * scale, 0.0f}, 0.27f * scale, + 0.30f * scale, 1.7f * scale, 8, + Color{26, 12, 16, 255}); + DrawCube({0.0f, 1.84f * scale, 0.0f}, 0.34f * scale, + 0.34f * scale, 0.32f * scale, + Color{176, 158, 140, 255}); + break; case ActorModel::Shard: DrawSphere(Vector3{0.0f, 0.0f, 0.0f}, 0.3f * scale, tint); break; diff --git a/src/render/models.hpp b/src/render/models.hpp index 22fe31f..ebbc208 100644 --- a/src/render/models.hpp +++ b/src/render/models.hpp @@ -10,7 +10,7 @@ class ShadowMap; // All models are metres, origin at the feet, facing +Z (the game camera). // The set-dressing models share the same one-mesh / painted-vertex pipeline. enum class ActorModel { - Guard, HissStaff, MoldSpore, HissBrute, HissGhost, Shard, + Guard, HissStaff, MoldSpore, HissBrute, HissGhost, Ascended, Shard, Hotline, TV, Pedestal, Duck, Cabinet, Crate, Debris, Switch, OfficeDesk, MeetingTable, OfficeChair, Computer, Plant, Sofa, FloorLamp, Partition, GarbageCan, DocumentStack, LooseSheet, diff --git a/src/render/presenter.cpp b/src/render/presenter.cpp index c381d5a..1e62aa0 100644 --- a/src/render/presenter.cpp +++ b/src/render/presenter.cpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace { @@ -538,6 +539,29 @@ void Presenter::init(float arena_half, const Floor& floor) { debris_.init(); concrete_debris_.init(); scorch_.clear(); + + // Ambient risers are authored in the level's map space and validated + // against the cooked walls. Keeping them near room walls (rather than at + // the centre of the plaza) means a rising figure never masks a crowd or + // the player under the tactical camera. + static const Vec2 kRiserAnchors[] = { + {28.0f, 36.0f}, {124.0f, 40.0f}, {78.0f, 84.0f}, // plaza / projector / office + {102.0f, 66.0f}, {26.0f, 100.0f}, {116.0f, 20.0f}, // plaza / silos / gate + {134.0f, 102.0f}, {132.0f, 64.0f}, {48.0f, 18.0f}, + {60.0f, 39.0f}, {10.0f, 60.0f}, {154.0f, 52.0f}, // side rooms + }; + for (int i = 0; i < static_cast(std::size(kRiserAnchors)); ++i) { + const Vec2 p = Floor::to_world(kRiserAnchors[i].x, kRiserAnchors[i].y); + if (!floor.is_open(p, 0.8f)) continue; + // Long gaps between appearances: these are rare environmental beats, + // not a second horde. Anchors are fixed for the whole run — a figure + // never drifts toward the player. + ascensions_.push_back({p, std::fmod(i * 0.191f, 1.0f), + 34.0f + (i % 5) * 7.0f, + i * 1.37f, 0.92f + (i % 3) * 0.05f}); + } + TraceLog(LOG_INFO, "GFX: %d ambient riser anchors", (int)ascensions_.size()); + damage_numbers_.reserve(64); sparks_.reserve(160); push_shards_.reserve(16); @@ -561,6 +585,7 @@ void Presenter::reset() { skill_rings_.clear(); push_shards_.clear(); player_running_ = false; + ascension_clock_ = 0.0f; } void Presenter::shutdown() { @@ -1510,6 +1535,7 @@ void Presenter::draw_scene(Game& game) { shake_ = std::max(0.0f, shake_ - 0.06f); const float frame_dt = GetFrameTime(); anim_time_ += frame_dt; + ascension_clock_ += frame_dt; aura_.update(frame_dt); damage_flash_ = std::max(0.0f, damage_flash_ - frame_dt * 2.2f); for (DamageNumber& n : damage_numbers_) n.age += frame_dt; @@ -1915,6 +1941,66 @@ void Presenter::draw_scene(Game& game) { debris_.draw(camera_.position); concrete_debris_.draw(camera_.position); + // Ambient Hiss risers. There is deliberately no roof mesh: from a + // 16 m tactical camera a ceiling would hide the whole play area. The + // figure climbs a few metres, thins into the red haze and is gone + // before it can loom over the player or mask a crowd. Anchors hug room + // walls (init) so the beat reads at the edge of the frame, not on top + // of the combat. + auto draw_riser = [&](const Ascension& a, float cycle, float phase) { + const float t = std::fmod(ascension_clock_ / cycle + phase, 1.0f); + // Roughly a five-second appearance every half-minute or so — a + // visual tidbit you stumble across, not a recurring encounter. + if (t < 0.06f || t > 0.22f) return; + const float rise = std::clamp((t - 0.06f) / 0.10f, 0.0f, 1.0f); + const float ease = 1.0f - (1.0f - rise) * (1.0f - rise); + const float height = ease * 4.6f + + std::max(0.0f, t - 0.16f) * 30.0f; + const float fade_in = std::clamp((t - 0.06f) / 0.025f, 0.0f, 1.0f); + const float fade_out = std::clamp((0.22f - t) / 0.06f, 0.0f, 1.0f); + const float alpha = std::min(fade_in, fade_out) * 0.92f; + if (!cull.visible(a.pos.x, height + 1.0f, a.pos.y, 1.6f)) return; + const float hiss = 0.45f + 0.25f * game.corruption.value(); + models_.draw(ActorModel::Ascended, + {a.pos.x, height, a.pos.y}, + a.yaw + ascension_clock_ * 0.11f, a.scale, WHITE, + 0.0f, false, 0.0f, 0.0f, a.yaw, hiss, + {0.0f, 0.0f, 0.0f}, alpha, 0.16f); + // The scorch-red bloom it left on the floor fades as it climbs. + const unsigned char ground_a = static_cast( + 150.0f * (1.0f - rise) * fade_in); + glow_batch.add_ground({a.pos.x, 0.04f, a.pos.y}, 1.7f, + Color{190, 18, 30, ground_a}); + glow_batch.add_ground({a.pos.x, 0.05f, a.pos.y}, 0.9f, + Color{255, 48, 52, + static_cast(ground_a * 0.7f)}); + // A thin red veil from floor to figure sells the upward pull; it + // doubles as the Hiss haze in the reference image. + glow_batch.add_billboard({a.pos.x, height * 0.5f, a.pos.y}, + 0.85f, std::max(0.7f, height), + cam_right, cam_up, + Color{180, 22, 30, + static_cast(ground_a * 0.22f)}); + glow_batch.add_billboard({a.pos.x, height + 0.9f, a.pos.y}, + 2.1f, 2.6f, cam_right, cam_up, + Color{180, 24, 34, + static_cast(alpha * 46.0f)}); + }; + if (ascension_test_) { + // QA entry: one figure a few metres off the agent in the plaza, + // mid-rise when a screenshot around 9 s is taken. + const Vec2 at = game.floor.resolve(p + Vec2{5.0f, -3.0f}, 0.8f); + const Ascension staged{at, 0.497f, 14.0f, 0.6f, 1.0f}; + draw_riser(staged, staged.cycle, staged.phase); + } else { + const int active = std::min( + static_cast(ascensions_.size()), + 1 + static_cast(std::min(1.0f, game.corruption.value()) * 2.9f)); + for (int i = 0; i < active; ++i) + draw_riser(ascensions_[i], ascensions_[i].cycle, + ascensions_[i].phase); + } + shadow_batch.draw(); glow_batch.draw(); EndMode3D(); diff --git a/src/render/presenter.hpp b/src/render/presenter.hpp index 4ad8e71..a979039 100644 --- a/src/render/presenter.hpp +++ b/src/render/presenter.hpp @@ -65,6 +65,18 @@ struct PushShard { float life = 0.0f; }; +// Ambient Hiss riser: a figure caught mid-ascent, presentation-only. Anchors +// sit near room walls so the vertical motion never sits on top of the horde; +// the GLB rises a few metres, then dissolves into the red haze above the +// tactical camera instead of clipping through a roof plane. +struct Ascension { + Vec2 pos{}; + float phase = 0.0f; // offset into the shared rise cycle + float cycle = 17.0f; // seconds from one appearance to the next + float yaw = 0.0f; + float scale = 1.0f; +}; + class ViewCull; class Presenter { @@ -80,6 +92,7 @@ public: void set_hiss_test(bool on) { hiss_test_ = on; } void set_floor_overview(bool on) { floor_overview_ = on; } + void set_ascension_test(bool on) { ascension_test_ = on; } // Called by the graphics menu (later phase) after settings change. void apply_graphics_settings(); @@ -142,6 +155,9 @@ private: int muzzle_flash_tier_ = 0; bool player_running_ = false; // hysteresis latch for Idle <-> Run bool hiss_test_ = false; + bool ascension_test_ = false; + std::vector ascensions_; + float ascension_clock_ = 0.0f; bool floor_mode_ = false; bool floor_overview_ = false; bool shadow_pass_ = false; diff --git a/tools/blender/build_ambient.py b/tools/blender/build_ambient.py new file mode 100644 index 0000000..f6e0402 --- /dev/null +++ b/tools/blender/build_ambient.py @@ -0,0 +1,191 @@ +# tools/blender/build_ambient.py +# FBC: NIGHT SHIFT — ambient Hiss riser (the figure being pulled "up the roof"). +# +# Run inside Blender 5.x: +# exec(open("/home/dandovlatov/Documents/cntrl/tools/blender/build_ambient.py").read()) +# +# Exports a single merged, vertex-painted GLB with feet at the origin and the +# face looking -Y (glTF Y-up turns that into +Z in the game). The figure is +# presentation-only: it never enters the enemy simulation. + +import math +import os +import sys + +import bpy +import mathutils + +REPO = "/home/dandovlatov/Documents/cntrl" +MODEL_DIR = os.path.join(REPO, "assets", "models") +BLEND_DIR = os.path.join(REPO, "assets", "blender") +CONCEPT_DIR = os.path.join(REPO, "docs", "concept") +for d in (MODEL_DIR, BLEND_DIR, CONCEPT_DIR): + os.makedirs(d, exist_ok=True) + +sys.path.insert(0, os.path.join(REPO, "tools", "blender")) +import importlib +import actor_kit as K +importlib.reload(K) + +K.clear_scene() +P = K.PALETTE +P.update({"rot": "#4a1018", "rot_dk": "#200a10", "rot_vein": "#a81a22", + "ink": "#15161b"}) + + +def build_ascended(): + """A dark, upward-tilted figure with limp arms and red tether filaments.""" + r = K.new_actor("Ascended") + + # Jacket: ends at the hip, so the trouser legs stay legible from above. + K.loft(r, "jacket", [ + {"z": 0.90, "r": (0.29, 0.20), "n": 14, "fold": (0.03, 5)}, + {"z": 1.02, "r": (0.30, 0.205), "n": 14, "fold": (0.04, 5)}, + {"z": 1.18, "r": (0.31, 0.215), "n": 14, "fold": (0.04, 6)}, + {"z": 1.34, "r": (0.32, 0.22), "n": 14, "fold": (0.03, 5)}, + {"z": 1.46, "r": (0.31, 0.21), "n": 14}, + ], P["navy_dk"], ao=0.14) + K.loft(r, "belt", [ + {"z": 0.88, "r": (0.29, 0.205), "n": 12}, + {"z": 0.94, "r": (0.30, 0.21), "n": 12}, + ], P["redaction"], ao=0.06) + K.plate(r, "jacket_front", K.octagon(0.27, 0.19), 0.98, 1.44, 0.94, + P["navy"], shift=(0, -0.015), ao=0.10) + + # Two separate trouser legs, slightly slack and offset as if weightless. + for side in (-1, 1): + K.loft(r, "pants_%d" % side, [ + {"z": 0.94, "r": (0.155, 0.16), "n": 12, "c": (side * 0.15, 0)}, + {"z": 0.76, "r": (0.15, 0.155), "n": 12, "c": (side * 0.16, -0.005)}, + {"z": 0.58, "r": (0.14, 0.145), "n": 12, "c": (side * 0.17, -0.01)}, + {"z": 0.40, "r": (0.125, 0.13), "n": 12, "c": (side * 0.18, -0.015)}, + {"z": 0.22, "r": (0.11, 0.115), "n": 12, "c": (side * 0.185, -0.02)}, + {"z": 0.12, "r": (0.10, 0.105), "n": 12, "c": (side * 0.19, -0.02)}, + ], P["navy"], ao=0.12) + K.plate(r, "knee_%d" % side, K.octagon(0.13, 0.12), 0.42, 0.52, 0.92, + P["navy_dk"], shift=(side * 0.175, -0.11), ao=0.06) + K.loft(r, "boot_%d" % side, [ + {"z": 0.0, "r": (0.125, 0.185), "n": 10, "c": (side * 0.19, -0.075)}, + {"z": 0.10, "r": (0.115, 0.16), "n": 10, "c": (side * 0.19, -0.045)}, + {"z": 0.20, "r": (0.105, 0.12), "n": 10, "c": (side * 0.19, -0.015)}, + ], P["redaction"], ao=0.06) + + # Neck, head and face; the head tips back so the gaze follows the rise. + # A pale mask keeps the figure human when seen from the tactical camera. + K.tube(r, "neck", [(0, 0.01, 1.48), (0, 0.0, 1.62)], [0.09, 0.095], + P["ink"], sides=9) + head = K.blob(r, "head", (0, -0.01, 1.74), (0.195, 0.175, 0.215), + P["skin"], subdiv=2, seed=11, ao=0.04) + head.rotation_euler.x = -0.24 # chin lifts toward the ceiling + hood = K.blob(r, "hood", (0, 0.045, 1.82), (0.205, 0.19, 0.115), + P["redaction"], subdiv=2, seed=12, warp=0.10) + hood.rotation_euler.x = -0.24 + for side in (-1, 1): + K.crystal(r, "eye_%d" % side, (side * 0.072, -0.168, 1.76), 0.05, + P["hiss_hot"], sides=5, seed=20 + side, + tilt=(math.pi / 2, 0, 0)) + K.plate(r, "jaw", K.octagon(0.11, 0.07), 1.55, 1.63, 0.86, + P["redaction"], shift=(0, -0.06), ao=0.06) + + # Broad shoulders and limp arms: the cross-shaped silhouette is what reads + # when the tactical camera looks down at the figure. + for side in (-1, 1): + K.blob(r, "shoulder_%d" % side, (side * 0.34, 0.01, 1.42), + (0.17, 0.17, 0.15), P["navy_dk"], subdiv=1, seed=30 + side) + K.tube(r, "arm_%d" % side, + [(side * 0.37, 0.01, 1.42), (side * 0.46, 0.07, 1.14), + (side * 0.50, 0.11, 0.84)], [0.10, 0.078, 0.055], + P["redaction"], sides=7) + K.blob(r, "hand_%d" % side, (side * 0.51, 0.12, 0.79), + (0.075, 0.08, 0.095), P["skin"], subdiv=1, seed=40 + side) + for f in range(4): + x = side * (0.47 + f * 0.034) + K.tube(r, "finger_%d_%d" % (side, f), + [(x, 0.13, 0.77), (x + side * 0.01, 0.15, 0.67), + (x + side * 0.02, 0.17, 0.59)], + [0.018, 0.014, 0.008], P["skin"], sides=5) + + # Black-red rot crawling over the back and collar — no spikes above the + # head: the rise is communicated by motion and haze, not by antennae. + for i, (pos, size, tilt, hot) in enumerate([ + ((-0.22, 0.17, 1.39), 0.13, (0.3, -0.2, 0.5), False), + ((0.21, 0.18, 1.33), 0.12, (-0.2, 0.3, -0.4), True), + ((0.0, 0.21, 1.50), 0.11, (0.1, -0.3, 0.1), False), + ((-0.31, 0.08, 1.43), 0.10, (0.4, 0.2, 0.6), False), + ]): + K.crystal(r, "rot_%d" % i, pos, size, + P["hiss"] if hot else P["rot"], sides=5, seed=50 + i, + tilt=tilt) + for i, pts in enumerate([ + [(-0.13, 0.24, 1.40), (-0.19, 0.28, 1.54), (-0.24, 0.30, 1.66)], + [(0.14, 0.24, 1.36), (0.20, 0.29, 1.50), (0.25, 0.31, 1.62)], + [(0.0, 0.03, 1.54), (0.01, 0.08, 1.66), (0.03, 0.12, 1.78)], + ]): + K.tube(r, "vein_%d" % i, pts, [0.015] * len(pts), P["rot_vein"], + sides=5) + return r + + +root = build_ascended() +mesh = K.merge_actor(root, "ascended") +tris = K.triangle_count(root) +print("[budget] ascended %d tris (cap 2200) %s" + % (tris, "OK" if tris <= 2200 else "OVER")) +assert tris <= 2200, "ascended over triangle budget" + +out = os.path.join(MODEL_DIR, "ascended.glb") +K.export_actor(root, "ascended", out) +print("[export] %s (%d bytes)" % (out, os.path.getsize(out))) + +# Small showroom so the silhouette can be judged at tactical and close range. +world = bpy.data.worlds.new("AmbientWorld") +bpy.context.scene.world = world +world.use_nodes = True +bg = next(n for n in world.node_tree.nodes if n.type == "BACKGROUND") +bg.inputs["Color"].default_value = (*K.rgb("#100a0d"), 1.0) +bg.inputs["Strength"].default_value = 0.9 + + +def area(name, loc, color, power, size): + data = bpy.data.lights.new(name, "AREA") + data.energy = power + data.shape = "DISK" + data.size = size + data.color = K.rgb(color) + obj = bpy.data.objects.new(name, data) + bpy.context.scene.collection.objects.link(obj) + obj.location = loc + direction = (0.0 - loc[0], 0.0 - loc[1], 1.3 - loc[2]) + obj.rotation_euler = mathutils.Vector(direction).to_track_quat("-Z", "Y").to_euler() + return obj + + +area("Key", (-3, -7, 9), "#dce6ff", 2600, 7) +area("HissFill", (5, -2, 4), "#ff3b46", 1800, 6) +area("Rim", (0, 6, 6), "#a81a22", 1500, 6) + +cam_data = bpy.data.cameras.new("AscendedCam") +cam = bpy.data.objects.new("AscendedCam", cam_data) +bpy.context.scene.collection.objects.link(cam) +cam.location = (1.4, -6.5, 3.4) +cam.rotation_euler = mathutils.Vector((0.0, 6.5, -1.9)).to_track_quat("-Z", "Y").to_euler() +cam_data.lens = 42 +bpy.context.scene.camera = cam + +scene = bpy.context.scene +engines = [i.identifier for i in bpy.types.RenderSettings.bl_rna.properties["engine"].enum_items] +scene.render.engine = "BLENDER_EEVEE_NEXT" if "BLENDER_EEVEE_NEXT" in engines else engines[0] +scene.render.resolution_x = 640 +scene.render.resolution_y = 800 +scene.render.resolution_percentage = 100 +scene.render.image_settings.file_format = "PNG" +scene.render.filepath = os.path.join(CONCEPT_DIR, "ascended.png") +try: + scene.eevee.taa_render_samples = 48 +except Exception: + pass +bpy.ops.render.render(write_still=True) +print("[render] %s" % scene.render.filepath) + +bpy.ops.wm.save_as_mainfile(filepath=os.path.join(BLEND_DIR, "fbc_ambient.blend")) +print("[done] ascended")