beyond-all-reason / beyond-all-reason/RecoilEngine
DrawUnitIconsScreen: Unit icons often missing at oblique camera angles. More info here.
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
I added some output to colorize the unit icons on failure cases of not being drawn.
Icons are colored white then they fail the
`if (modelDrawerData->iconZoomDist / unitRadiusMult < modelDrawerData->iconFadeVanish)`
Check.
Below shot demonstrates that all the units failed this check (notwithstanding those that also failed the Z checks in the air)

`
for (const CUnit* unit : units)
{
SColor color = unit->isSelected ? color4::white : SColor{ teamHandler.Team(unit->team)->color };
if (!unit->drawIcon)
color = color4::red;
//continue;
const bool canSee = gu->spectatingFullView || (unit->losStatus[gu->myAllyTeam] && (LOS_INLOS | LOS_CONTRADAR | LOS_PREVLOS) == (LOS_INLOS | LOS_CONTRADAR | LOS_PREVLOS));
if (!canSee)
color = color4::yellow;
//continue;
assert(unit->myIcon == icon);
// iconUnits should not never contain void-space units, see UpdateUnitIconState
assert(!unit->IsInVoid());
// drawMidPos is auto-calculated now; can wobble on its own as pieces move
float3 pos = (!gu->spectatingFullView) ?
unit->GetObjDrawErrorPos(gu->myAllyTeam) :
unit->GetObjDrawMidPos();
pos = camera->CalcViewPortCoordinates(pos);
if (pos.z > 1.0f || pos.z < 0.0f)
color = color4::green;
//continue;
// use white for selected units
float unitRadiusMult = icon->GetSize();
if (icon->GetRadiusAdjust() && icon != icon::iconHandler.GetDefaultIconData())
unitRadiusMult *= (unit->radius / icon->GetRadiusScale());
unitRadiusMult = (unitRadiusMult - 1) * 0.75 + 1;
// fade icons away in high zoom in levels
if (!unit->GetIsIcon()) {
if (modelDrawerData->iconZoomDist / unitRadiusMult < modelDrawerData->iconFadeVanish)
//continue;
color = color4::white;
else if (modelDrawerData->iconFadeVanish < modelDrawerData->iconFadeStart && modelDrawerData->iconZoomDist / unitRadiusMult < modelDrawerData->iconFadeStart)
// alpha range [64, 255], since icons is unrecognisable with alpha < 64
color.a = 64 + 191.0f * (modelDrawerData->iconZoomDist / unitRadiusMult - modelDrawerData->iconFadeVanish) / (modelDrawerData->iconFadeStart - modelDrawerData->iconFadeVanish);
}
`
Based
Contributor guide
Research direction
Start at the DrawUnitIconsScreen rendering path and inspect the icon visibility and fade condition shown in the report. Reproduce the missing-icon case with an oblique camera angle, then trace whether the zoom, radius, or viewport checks incorrectly suppress icons. Done means unit icons render reliably at the reported angles without breaking the existing visibility checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100