Skip to content

Shader-Based Crosshair#183

Merged
themrdemonized merged 8 commits intothemrdemonized:landerfrom
Lander-Modding:shader-crosshair
Apr 27, 2025
Merged

Shader-Based Crosshair#183
themrdemonized merged 8 commits intothemrdemonized:landerfrom
Lander-Modding:shader-crosshair

Conversation

@ProfLander
Copy link
Contributor

Replaces CHUDCrosshair with an upgraded version that supports 3D projection, wireframe and shader modes, and controllable depth sizing.
New options are exposed via globals, with entries in the settings menu for mode and size, and texture / shader string console commands for user and modder customization.

Should be 100% compatible save for the DLTX patch, which introduces a ~1px visual difference for the sake of a nicer scaling visual in wireframe mode.

@ProfLander ProfLander changed the title Shader-based Crosshair Shader-Based Crosshair Apr 25, 2025
@ProfLander ProfLander changed the base branch from all-in-one-vs2022-wpo to lander April 25, 2025 15:38
- Seemed more sensible to use the HUD flags instead of further jamming up the Actor flags
- Now authoritative over both wireframe and texture crosshair rendering
- Takes a transform and projects itself into 3D with a customizable depth-size metric
- Performs vertex transformation to allow arbitrary 3D positioning and rotation
- Uses new HUD flag to switch between wireframe and shader modes
- Shader mode reinits whenever its shader or texture are changed
- Opted to omit g_crosshair_shader and g_crosshair texture, as they're intended for runtime mod use
- Removes unused old options
- Update min / max radius to improve visual when using near size
@ProfLander
Copy link
Contributor Author

ProfLander commented Apr 26, 2025

Checked myself on the weighty claim of 100% accuracy: Dispersion was in fact having an effect, but was (wilfully?) minimized into irrelevance via default LTX values.

Have plugged it in as a near-size offset, scaled by the far plane to bring it into a reasonable coordinate space, allowing it to be hidden until the user raises the respective setting above 1. This seems mildly more accurate to weapon spread in practice versus the original impl; I don't think either is mathematically watertight, but it should suffice to fool the eye for cl_dynamic_crosshair users.

I also double-checked the point about the 1px visual change versus via GIMP, and got the same 3x3px cross as vanilla under default settings, so I'm pretty happy with this compatibility-wise now.

@themrdemonized themrdemonized merged commit 9aa31e8 into themrdemonized:lander Apr 27, 2025
@ProfLander ProfLander deleted the shader-crosshair branch May 24, 2025 06:12
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.

2 participants