FBC: NIGHT SHIFT - developed the Hiss fluid shader look with a --hiss-test camera
This commit is contained in:
parent
1902617ddc
commit
739dc309f9
8 changed files with 115 additions and 9 deletions
|
|
@ -39,8 +39,11 @@ The window defaults to 1920×1080; pass `--720p` for the smaller 1280×720 view
|
|||
default; pass `--post-fx` for the graded/bloomed/VHS look.
|
||||
|
||||
Dev tools: `--bot` (kiting autopilot), `--no-damage` (stress mode),
|
||||
`--screenshot <path> [--screenshot-at <sec>]` for automated visual checks;
|
||||
F12 saves a screenshot on demand.
|
||||
`--screenshot <path> [--screenshot-at <sec>]` for automated visual checks,
|
||||
`--hiss-test` (close-up of one buffed Hiss Brute for shader look-dev);
|
||||
F12 saves a screenshot on demand. Hiss corruption is visualised on enemies
|
||||
carrying an active enemy-channel buff (burn/slow/vulnerable/resonance) and on
|
||||
Objects of Power.
|
||||
|
||||
raylib 6.2 is fetched automatically by CMake (FetchContent). Needs a C++23 compiler
|
||||
(GCC 13+) and OpenGL/X11 dev headers (already required by GLFW).
|
||||
|
|
|
|||
|
|
@ -22,6 +22,24 @@ uniform float uFlash = 0.0;
|
|||
uniform float uCorruption = 0.0;
|
||||
uniform float uOutline = 0.0;
|
||||
uniform float uGlow = 0.0;
|
||||
uniform float uHiss = 0.0;
|
||||
|
||||
// Cheap trig-free value noise (Dave Hoskins style hash). Two lookups feed a
|
||||
// domain warp, one more gives the filament field — no extra render targets.
|
||||
float hash21(vec2 p)
|
||||
{
|
||||
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
||||
p3 += dot(p3, p3.yzx + 33.33);
|
||||
return fract((p3.x + p3.y) * p3.z);
|
||||
}
|
||||
|
||||
float vnoise(vec2 p)
|
||||
{
|
||||
vec2 i = floor(p), f = fract(p);
|
||||
vec2 u = f * f * (3.0 - 2.0 * f);
|
||||
return mix(mix(hash21(i), hash21(i + vec2(1.0, 0.0)), u.x),
|
||||
mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), u.x), u.y);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -75,6 +93,36 @@ void main()
|
|||
// The House bleeds red into unlit faces as containment fails.
|
||||
lit += vec3(0.26, 0.012, 0.018) * (1.0 - ndl) * uCorruption * 0.30;
|
||||
|
||||
// Hiss: a cheap stand-in for Control's fluid sim. Domain-warped ridged
|
||||
// noise flows upward in world space; ridges read as bright crimson veins
|
||||
// over an almost-black ink body. Uniform branch keeps clean actors free.
|
||||
if (uHiss > 0.001) {
|
||||
vec2 flow = vec2(vWorld.x * 1.2 + vWorld.y * 0.75,
|
||||
vWorld.z * 1.2 - uTime * 0.55 + vWorld.y * 0.5);
|
||||
vec2 warp = vec2(vnoise(flow * 0.7 + uTime * 0.18),
|
||||
vnoise(flow * 0.7 + 19.7 - uTime * 0.12)) - 0.5;
|
||||
flow += warp * 2.8 + vec2(sin(flow.y * 0.9 + uTime * 0.7),
|
||||
cos(flow.x * 0.8 - uTime * 0.6)) * 0.35;
|
||||
float f = vnoise(flow * 3.1);
|
||||
float ridge = 1.0 - abs(f * 2.0 - 1.0);
|
||||
float veins = pow(ridge, 5.0);
|
||||
float body = smoothstep(0.40, 0.80, f);
|
||||
float mask = uHiss * (0.55 + 0.45 * smoothstep(0.10, 0.42, sat));
|
||||
vec3 ink = vec3(0.006, 0.002, 0.005);
|
||||
vec3 blood = vec3(0.26, 0.010, 0.024);
|
||||
vec3 hot = vec3(1.0, 0.12, 0.10);
|
||||
vec3 fluid = mix(ink, blood, body);
|
||||
fluid += hot * veins * (0.65 + 0.30 * sin(uTime * 3.1 + vWorld.y * 4.0));
|
||||
fluid += blood * fresnel * 1.6;
|
||||
// Sparse drifting particulate: dark flecks with occasional hot embers.
|
||||
vec2 pf = flow * 6.0 + vec2(0.0, uTime * 1.1);
|
||||
float grain = hash21(floor(pf));
|
||||
fluid *= 1.0 - 0.75 * smoothstep(0.90, 0.99, grain);
|
||||
fluid += hot * smoothstep(0.985, 1.0,
|
||||
hash21(floor(pf * 0.5) + 7.3)) * 0.7;
|
||||
lit = mix(lit, lit * 0.18 + fluid, mask * (0.80 + 0.20 * uCorruption));
|
||||
}
|
||||
|
||||
// Hit flash washes the silhouette toward hot white-red.
|
||||
lit = mix(lit, vec3(1.0, 0.62, 0.56) * (0.75 + 0.25 * bright), uFlash);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,3 +47,6 @@
|
|||
- GLTF boss puppets (the Former's hand sweeping lanes).
|
||||
- Hotline radio call-ins as a consumable.
|
||||
- "Containment Rating" leaderboards per seed.
|
||||
- First-person moments, just for the hell of it: a few short playable vignettes
|
||||
(threshold-door peeks, a Hotline call, an OoP chamber) from a ground-level
|
||||
camera, cut back to the tactical view for combat.
|
||||
|
|
|
|||
19
src/main.cpp
19
src/main.cpp
|
|
@ -32,6 +32,7 @@ struct Options {
|
|||
bool bot = false; // --bot: kiting autopilot (M6 balance-bot seed)
|
||||
bool no_damage = false; // --no-damage: stress-test mode
|
||||
bool post_fx = false; // --post-fx: opt into graded/bloomed look
|
||||
bool hiss_test = false; // --hiss-test: close-up of one Hiss Brute
|
||||
};
|
||||
|
||||
Options parse_options(int argc, char** argv) {
|
||||
|
|
@ -55,6 +56,8 @@ Options parse_options(int argc, char** argv) {
|
|||
opts.height = k720pHeight;
|
||||
} else if (std::strcmp(argv[i], "--post-fx") == 0) {
|
||||
opts.post_fx = true;
|
||||
} else if (std::strcmp(argv[i], "--hiss-test") == 0) {
|
||||
opts.hiss_test = true;
|
||||
}
|
||||
}
|
||||
return opts;
|
||||
|
|
@ -103,6 +106,20 @@ int main(int argc, char** argv) {
|
|||
Presenter presenter;
|
||||
presenter.init(game.config.arena_half);
|
||||
|
||||
if (opts.hiss_test) {
|
||||
presenter.set_hiss_test(true);
|
||||
game.player.pos = {12.0f, 12.0f};
|
||||
game.enemy_system.clear();
|
||||
game.enemy_system.spawn(EnemyType::HissBrute, Vec2{0.0f, -4.0f},
|
||||
game.corruption);
|
||||
Enemy& brute = game.enemy_system.enemies[0];
|
||||
brute.speed = 0.0f;
|
||||
brute.bob_phase = 0.0f;
|
||||
brute.mods.burn_dps = 0.4f;
|
||||
brute.mods.speed_mult = 0.6f;
|
||||
brute.mods.damage_taken_mult = 1.3f;
|
||||
}
|
||||
|
||||
// The scene renders to a texture and is blitted raw by default. --post-fx
|
||||
// opts into the corruption grade, bloom, VHS noise and damage flash from
|
||||
// assets/shaders/post_fx.fs (docs/ART_DIRECTION.md "Post FX").
|
||||
|
|
@ -163,7 +180,7 @@ int main(int argc, char** argv) {
|
|||
if (accumulator > 0.25f) accumulator = 0.25f; // avoid spiral of death
|
||||
|
||||
while (accumulator >= kFixedDt) {
|
||||
game.update(read_input(game, opts.bot), kFixedDt);
|
||||
if (!opts.hiss_test) game.update(read_input(game, opts.bot), kFixedDt);
|
||||
accumulator -= kFixedDt;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ struct Rig {
|
|||
float mode = 0.0f;
|
||||
};
|
||||
|
||||
Rig rig_for(ActorModel id) {
|
||||
Rig rig_for(ActorModel id) {
|
||||
switch (id) {
|
||||
case ActorModel::Guard: return {0.90f, 1.45f, 0.18f, 0.43f, 1.0f, 1.0f};
|
||||
case ActorModel::HissStaff: return {0.60f, 1.40f, 0.20f, 0.38f, 0.85f, 1.0f};
|
||||
|
|
@ -37,6 +37,17 @@ Rig rig_for(ActorModel id) {
|
|||
}
|
||||
}
|
||||
|
||||
float hiss_for(ActorModel id) {
|
||||
switch (id) {
|
||||
case ActorModel::Debris: return 0.5f;
|
||||
case ActorModel::Hotline:
|
||||
case ActorModel::TV:
|
||||
case ActorModel::Pedestal:
|
||||
case ActorModel::Switch: return 0.6f;
|
||||
default: return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void ModelBank::init() {
|
||||
|
|
@ -59,6 +70,7 @@ void ModelBank::init() {
|
|||
loc_rig_ = GetShaderLocation(shader_, "uRig");
|
||||
loc_rig_scale_ = GetShaderLocation(shader_, "uRigScale");
|
||||
loc_rig_mode_ = GetShaderLocation(shader_, "uRigMode");
|
||||
loc_hiss_ = GetShaderLocation(shader_, "uHiss");
|
||||
const std::string ramp = resolve("assets/textures/actor/actor_ramp.png");
|
||||
if (!ramp.empty() && loc_ramp_ >= 0) {
|
||||
ramp_ = LoadTexture(ramp.c_str());
|
||||
|
|
@ -133,7 +145,7 @@ void ModelBank::begin_frame(float time, float corruption, Vector3 camera_pos) {
|
|||
|
||||
void ModelBank::draw(ActorModel id, Vector3 pos, float yaw, float scale,
|
||||
Color tint, float flash, bool outline, float walk,
|
||||
float stagger, float phase) {
|
||||
float stagger, float phase, float hiss) {
|
||||
const float yaw_degrees = yaw * RAD2DEG;
|
||||
const int index = static_cast<int>(id);
|
||||
if (index < 0 || index >= static_cast<int>(ActorModel::Count)) return;
|
||||
|
|
@ -156,6 +168,10 @@ void ModelBank::draw(ActorModel id, Vector3 pos, float yaw, float scale,
|
|||
SetShaderValue(shader_, loc_phase_, &phase, SHADER_UNIFORM_FLOAT);
|
||||
const float glow = id == ActorModel::Shard ? 0.9f : 0.0f;
|
||||
if (loc_glow_ >= 0) SetShaderValue(shader_, loc_glow_, &glow, SHADER_UNIFORM_FLOAT);
|
||||
const float model_hiss = hiss_for(id);
|
||||
const float hiss_value = hiss > model_hiss ? hiss : model_hiss;
|
||||
if (loc_hiss_ >= 0)
|
||||
SetShaderValue(shader_, loc_hiss_, &hiss_value, SHADER_UNIFORM_FLOAT);
|
||||
}
|
||||
|
||||
// Ink silhouette: expanded back faces first, then the lit model over them.
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public:
|
|||
// `outline` adds a back-face ink silhouette (guard / bosses, not the horde).
|
||||
void draw(ActorModel id, Vector3 pos, float yaw, float scale, Color tint,
|
||||
float flash = 0.0f, bool outline = false, float walk = 0.0f,
|
||||
float stagger = 0.0f, float phase = 0.0f);
|
||||
float stagger = 0.0f, float phase = 0.0f, float hiss = 0.0f);
|
||||
|
||||
// Per-model visual height, used for health bars / floating labels.
|
||||
static float height(ActorModel id);
|
||||
|
|
@ -55,6 +55,7 @@ private:
|
|||
int loc_rig_ = -1;
|
||||
int loc_rig_scale_ = -1;
|
||||
int loc_rig_mode_ = -1;
|
||||
int loc_hiss_ = -1;
|
||||
bool shader_ok_ = false;
|
||||
bool ready_ = false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,6 +41,16 @@ float actor_flash(float timer, float scale) {
|
|||
return timer <= 0.0f ? 0.0f : std::min(1.0f, timer * scale);
|
||||
}
|
||||
|
||||
float enemy_hiss(const Enemy& e) {
|
||||
const EnemyMods& m = e.mods;
|
||||
float h = 0.0f;
|
||||
if (m.burn_dps > 0.0f) h += 0.5f;
|
||||
if (m.speed_mult < 0.99f || m.speed_mult > 1.01f) h += 0.35f;
|
||||
if (m.damage_taken_mult > 1.01f) h += 0.35f;
|
||||
if (m.immune > 0.0f) h += 0.25f;
|
||||
return std::min(1.0f, h);
|
||||
}
|
||||
|
||||
// Glow colors per world-object kind (§4.6): the scene carries a faint
|
||||
// readable signal so the player can see what they're about to catch.
|
||||
Color world_object_color(const WorldObject& obj) {
|
||||
|
|
@ -414,8 +424,13 @@ void Presenter::draw_scene(Game& game) {
|
|||
const float bound = game.config.arena_half - margin;
|
||||
const float cx = std::clamp(p.x, -bound, bound);
|
||||
const float cz = std::clamp(p.y, -bound, bound);
|
||||
camera_.position = {cx + sx * 0.6f, 18.0f + sy * 0.4f, cz + 14.0f};
|
||||
camera_.target = {cx + sx * 0.3f, 0.0f, cz};
|
||||
if (hiss_test_) {
|
||||
camera_.position = {0.0f, 3.4f, 3.2f};
|
||||
camera_.target = {0.0f, 1.4f, -4.0f};
|
||||
} else {
|
||||
camera_.position = {cx + sx * 0.6f, 18.0f + sy * 0.4f, cz + 14.0f};
|
||||
camera_.target = {cx + sx * 0.3f, 0.0f, cz};
|
||||
}
|
||||
if (tier_wave_pending_) {
|
||||
// Reusable scene wave: also callable for boss entrances / events.
|
||||
aura_.spawn_ground({p.x, 0.09f, p.y}, 11.0f, 2.6f, anim_time_);
|
||||
|
|
@ -467,7 +482,7 @@ void Presenter::draw_scene(Game& game) {
|
|||
const float flash = actor_flash(e.hit_flash, 6.0f);
|
||||
const float walk = std::min(1.0f, e.speed / 4.5f);
|
||||
models_.draw(model, {e.pos.x, bob, e.pos.y}, yaw, 1.0f, WHITE,
|
||||
flash, !mold, walk, flash, e.bob_phase);
|
||||
flash, !mold, walk, flash, e.bob_phase, enemy_hiss(e));
|
||||
}
|
||||
|
||||
// Enemy drops: small cyan Resonance crystals, spun by the crystal rig.
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ public:
|
|||
// (main.cpp renders into a texture first so post FX can run over the frame).
|
||||
void draw_scene(Game& game);
|
||||
|
||||
void set_hiss_test(bool on) { hiss_test_ = on; }
|
||||
|
||||
float damage_flash() const { return damage_flash_; }
|
||||
|
||||
private:
|
||||
|
|
@ -53,6 +55,7 @@ private:
|
|||
float damage_flash_ = 0.0f;
|
||||
float anim_time_ = 0.0f;
|
||||
float player_yaw_ = 0.0f;
|
||||
bool hiss_test_ = false;
|
||||
bool tier_wave_pending_ = false;
|
||||
Vec2 last_player_pos_{};
|
||||
std::vector<DamageNumber> damage_numbers_;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue