Skip to content

Crosshair border: same thickness on every side (#1348) - #1350

Open
ccoventry wants to merge 2 commits into
devfrom
fix/crosshair-border-symmetric-1348
Open

ccoventry wants to merge 2 commits into
devfrom
fix/crosshair-border-symmetric-1348

Conversation

@ccoventry

Copy link
Copy Markdown
Owner

Release note: Fixed: the crosshair border is now the same thickness on every side.

Closes #1348

Cause

The border in #1348's captures isn't drawn by ds_hud_crosshair_outline_size. It's the 1-texel black border in customxhair-diceWSOD.spr's own art. That sheet's tiles 7–12 (the ones the Players table uses) are exact mirror images, centred in their 64×64 tiles. So none of the difference comes from the art.

At the game's size, a tile's pixels mirror about the middle of pixel (1280, 720) (2560×1440). ds_hud_crosshair_scale zoomed about the corner of that pixel. That moved the crosshair's middle 0.5 × (S − 1) px down and right, onto neither a pixel's middle nor its edge. Then each edge's texel was sampled at a different phase, and the outer edges are hard-cut by the alpha test (the movie cfg's gl_spriteblend 0). At 1.25 that came out as 1.5 px on the top and left and 2.3 px on the bottom and right. Scale 2 happened to land on a pixel edge, which is why it looked right.

Fix

crosshair_scale::zoom_point picks the zoom point so that the crosshair's middle lands exactly on the centre corner (W/2, H/2) at any scale. One function changed; the drawn outline (#1338) uses the same zoom and needs nothing else.

Zooming about the pixel's middle also gives a mirror image, and I tried it first. But it left each arm's two ends at 1.5 and 2.4 px. Landing on the corner gives every edge 1.7–1.85 px. The creator's crosshairs are drawn about a texel corner, so on a pixel corner all the edges fall at the same phase.

Tested

In game, both installs, Brain, wsod25_grp4_h1_m00cat_dod_railroad2_test_1 (m00cat, tile 8 of customxhair-diceWSOD.spr), 2560×1440, captured through the hook's batch. The figures are border px per side, measured along the centre row, the centre column and across each arm; each is the mean, with the smallest and largest edge after it.

Install Scale gl_spriteblend Before: top / left Before: bottom / right After: every side
POST 1.25 0 (the WSOD25 cfg's) 2.05 (1.51–2.39) 2.25 1.74 (1.68–1.85)
PRE 1.25 0 2.05 (1.51–2.39) 2.25 1.74 (1.68–1.85)
POST 1.5 0 2.25 (1.86–2.65) 2.45 2.45 (2.19–2.61)
PRE 1.5 0 2.25 2.45 2.45 (2.19–2.61)
POST 1.25 1 ~1.21 1.32–1.43 1.21
PRE 1.25 1 ~1.21 1.32–1.43 1.21
POST 1.25, outline 2 0 3.56 4.36 3.85 (every side)
POST / PRE 1 0 and 1 1.47 / 1.02, mirrored same unchanged (no zoom at 1)

With gl_spriteblend 1 the outer edge is blended instead of cut, so the border reads thinner (about 1.2 px, the texel's true 1.27) and the old shift was smaller (about 0.2 px instead of 0.8). The pink's inner edge blends into the black the same way at either value.

The red crosshair (cl_xhair_style 0, POST 1.25) moves by at most a pixel. Its arms used to sit 3 px further right than left; now the difference is 1 px. That piece's layout is DoD's own dynamic gap.

cargo test -p goldsrc-hooks crosshair_scale, rustfmt and clippy (host and i686, 1.98.1) are clean.

Frames, zoomed crops and the before/after image: D:\dodstudio-tests\crosshair-border-1348\.

🤖 Generated with Claude Code

ccoventry and others added 2 commits November 7, 2026 21:50
…r stays mirrored (#1348)

At the game's size a crosshair tile mirrors about the middle of pixel
(W/2, H/2). A zoom about that pixel's corner moved the crosshair's middle
0.5 * (S - 1) px down and right, so at 1.25 its top/left edges were sampled
differently from its bottom/right ones: a 1-texel border came out 1.5 px on
the top and left and 2.3 px on the bottom and right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er (#1348)

Zooming about the centre pixel's middle mirrored the crosshair but left each
arm's two ends 1.5 and 2.4 px at 1.25. Landing the middle on the corner puts
every edge of the creator's crosshairs at the same phase: 1.68 to 1.85 px on
POST and PRE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ccoventry

Copy link
Copy Markdown
Owner Author

Combined in-game test of #1350, #1351 and #1352

Built from dev f628957 with all three branches merged locally. They merge with no conflicts. DLL: local\test-combined\. Recorded at 2560×1440 with the user's dicewsod25.cfg on the Brain account, as an HLAE 300 fps batch capture.

Evidence is in D:\dodstudio-tests\combined-1350-1352\.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crosshair border is thinner on the top and left than the bottom and right

1 participant