Repository navigation
Civilization banner: the flag cloth's shader on Metal/Vulkan, the banner's framing and fringe as the original's - #74
Closed
MortenLyhr wants to merge 13 commits into
Closed
MortenLyhr wants to merge 13 commits into
MortenLyhr wants to merge 13 commits into
Conversation
# Conflicts: # apps/oc4core/MapCapture.cpp # apps/oc4core/MapCapture.h
TFlagShader takes no light: the player's colours times the cloth's base map. Lit, the flags came out about a quarter darker and bluer than the original's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A ship's damage atlas moves along U by +0.5 to its lightly damaged left half (unchanged); a flag's medallions move along V by -0.2 a row, up their strip from its empty bottom row, which only works with V flipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Over each flag, a medallion for each unit on the plot (Art/Units/Flag/ Medallions.kfm, up to 7): white, green/yellow/red for selected units by how they can move. The promotion coin in the same model stays hidden. - Health bars as the original's billboards: HEALTH_BAR_WIDTH over the UNIT_HEALTH_BILLBOARD_SCALE fader long, behind the unit and above the ground (..._RADIUS, ..._Z), drawn in the scene so the figures hide part of it. - The flag by the minimap is the player's era flag model, waving, its cloth in the player's two colours, instead of a flat picture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured in the original with hurt units (Swordsmen at 100 % to 10 %, units from Strength 2 to 40): the bar's length is what the engine gets from the DLL, the unit's current strength times CvUnit::getHealthBarModifier (HEALTH_BAR_WIDTH over twice the best land unit's strength), so units without strength have none. Green from two thirds of the hit points, yellow from a third, red below; as thick at every length. It is a billboard: the _Z fader moves it up the screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The flag cloth's colours times its base map (flags bit 4096, from bssth#56) was only in the HLSL; Metal and Vulkan still laid the composed decal over the cloth, so every flag there was one flat colour, without the cloth's folds and its cut edge. Regenerated with tools/shaders/gen_msl.py and gen_spirv.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The main interface's flag is seen from the front with its pole in the middle, 1.06 of the model's height filling the 250 px picture, centred 0.53 of it up (was fitted to the model's box: some 4% smaller, 4 px higher and 5 px left of the original's at 1600x900). Its blended parts cover the panel with their alpha counted twice, as the original's widget pictures do: the fringe comes out faint over the panel instead of bright gold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A flag's cloth (the civilization's decal in the player's colours) was one level only, so a small flag sampled its 128 px emblem texel by texel; the original's decals are DDS files with all their mips, sampled trilinearly (Civ4FlagDecal.fx). Both the map's flags and the banner by the minimap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The model shader's flag branch (from bssth#56) was not yet in the generated shaders: tools/shaders/gen_msl.py and gen_spirv.py (glslang 16.6.0, SPIRV-Tools v2026.4, as CI's). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CvGame::getBestLandUnitCombat is not exported from the Windows DLL. The exported CvUnit::getHealthBarModifier already divides by it: a modifier that is not finite means there is no best land unit yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # src/render/MslShaders.inc # src/render/SpirvShaders.inc
This was referenced Nov 20, 2026
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #73 (which builds on #56): this branch contains #73 (merged in, up to its Windows link fix) and adds three commits on top (4d9fe88, b835acc, b9721e2). Please merge #56 and #73 first.
What it changes
The banner by the minimap (
addFlagWidgetGFC) and the flag cloth, compared with the original (Beyond the Sword under Wine, the same scenario, 1600×900):MslShaders.incandSpirvShaders.incstill laid the composed decal over the cloth, so every flag there, on the map and by the minimap, was one flat colour, without the base map's folds and cut edge. Regenerated withtools/shaders/gen_msl.pyandgen_spirv.py(--checkwas failing). The banner's cloth now measures 166,73,215 against the original's 166,67,214. Civilization flags as the original's: unlit cloth, medallions, health bars, the minimap's banner (builds on #56) #73 has since regenerated them too (be25b12); after Civilization flags as the original's: unlit cloth, medallions, health bars, the minimap's banner (builds on #56) #73 is merged this commit adds nothing of its own.ModelView::frameAsFlag). That puts it within 1 px of the original in size and place.Medieval_Flag_Trim.dds, alpha about 0.5, SrcAlpha/InvSrcAlpha) shows faint over the panel in the original: colour × ~0.2 + panel × ~0.72. That fits a widget drawn into a target whose alpha is blended too (a²) and then laid down by that alpha again (colour × a³ + panel × (1 − a²)). OpenCiv4 composited it correctly, so the fringe was bright gold.Renderer::beginViewtakesalphaTwice(flags bit 8192) for the banner only.FlagDECAL_Laurels.dds: 128×128, 8 mips), sampled trilinearly. NowRenderer::createMipmapped, for the map's flags and the banner.Unchanged, because they already match: the animation is the flag KFM's only clip (
*_MD_Idle.kf, 3.33 s, looped); the original's banner repeats every ~3.4 s in 0.263 s bursts. Hover showsparseFlagHelp(civilization, leader, traits); a click runsCONTROL_SELECTCAPITAL.ctest passes 14/14 and the 100-turn checksums (
--turns 100 --map Fractal --size STANDARD --seed 7) equal master's.Not done: the original's emblem still looks a little bolder, probably its texture detail setting dropping the top mip.
🤖 Generated with Claude Code