Conversation
themuffinator
left a comment
There was a problem hiding this comment.
Thanks for digging into this — but I don't think this change does what the description says, and as written I believe it removes a feature rather than fixing a leak. Three things, in order of how much they matter.
1. viewID > 0 is every normal player view, including the join screen's own
idPlayer::CalculateRenderView sets renderView->viewID = entityNumber + 1 for the first-person view (openQ4-game/src/game/Player.cpp:13519 and :13539). So parms->renderView.viewID > 0 is true for ordinary gameplay and for the live map that the join card is deliberately drawn over. The join screen has no separate view — the panel is a GUI on top of the player's view.
That means the new guard strips SPECIAL_EFFECT_BLUR on the first frame the join card is up, which is exactly the soft focus the card is supposed to have. It looks like a fix because the effect does stop appearing, but the reason is that the feature has been switched off.
The arena presentation survives only by accident: idMultiplayerGame sets view->viewID = 0 for its presentation cameras (MultiplayerGame.cpp:14254, :14346), and its strength parm is clamped to 0.45, just under the >= 0.5f in the heuristic. A small retune of either would take the ceremony DoF out with it.
2. The parm test is a fingerprint of game-module constants, read from the engine
focus < 0.02f && distanceScale >= 256.0f && strength >= 0.5f is not a general description of "menu soft focus" — it is the numeric signature of four constants that live in the game DLL:
JOIN_SCREEN_DOF_FOCUS = 0.004f
JOIN_SCREEN_DOF_STRENGTH = 0.85f
JOIN_SCREEN_DOF_DISTANCE_SCALE = 512.0f
(openQ4-game/src/mpgame/MultiplayerGame.cpp:65-68). The engine has no way to know those numbers are special, and openQ4 ships its own game modules that are free to retune them. Anyone changing the join card's look would silently un-fix this, with no build error and no test failure.
3. The leak this targets is already guarded on the game side
idMultiplayerGame::Clear() and ::ClearMap() both call SetJoinScreenSoftFocus( false ) before resetting joinScreenSoftFocusEnabled, specifically so an interrupted handoff cannot leave the renderer's pass enabled on the next screen or map. HandleGuiCommands clears it when the player answers the offer. If you have found a path that escapes all of those, that path is the bug and it belongs in the game module's ownership bookkeeping — please post the repro and we will fix it there.
Smaller points
R_AddSpecialEffectsnow writes totr.specialEffectsEnableditself. That global is the game's state, not the view walk's; clearing it from inside a per-view function means the game and the renderer disagree afterwards, andSetJoinScreenSoftFocus( false )becomes a no-op because its ownjoinScreenSoftFocusEnabledguard still reads true.- The same heuristic is copy-pasted into four places. If a rule like this is ever needed it should be one predicate, next to the state it describes.
r_specialEffectsas a new archived cvar is reasonable on its own, and so is honouringr_skipPostProcessin these paths. Those parts I would take happily in a separate PR.
On the link to #171
The description here is about a menu blur leaking into gameplay, but #171 is titled "distant rendering very blurry/double pixelated" and its log is a fresh boot with no map and no multiplayer session, on the Apple GL 2.1 compatibility path. Those read like two different problems to me. The log also shows a Retina display reporting contentScale 1.00 with pd=2.00, which is the shape of a drawable-size mismatch — render at point size, present into a 2x pixel drawable — and that would look exactly like "double pixelated" softness in the distance.
I have asked on #171 for the detail that separates the two. If it turns out the join soft focus really is leaking on your machine, I would still want the fix in the game module's ownership, not a parm fingerprint in the renderer.
Happy to keep this open while you rework it.
|
Closing in favour of #178. The review holds. The leak itself is real, though, and it is renderer-side. With the card answered and both of those cleared, the GL backend kept compositing the blur. #178 fixes that in six lines, with a repro and before/after measurements. It needs no game-module change and leaves the card's soft focus intact. The |
Fixes #171
Problem
When navigating the main menu or join game screens, Quake 4 enables a cinematic soft-focus distance blur pass (
SPECIAL_EFFECT_BLUR). In certain transitions into active gameplay (or after level disconnect/reconnect), the blur bitmask and distance blur parameters remained active intr.specialEffectsEnabled, causing 3D world geometry to render permanently blurred with an unwanted depth-of-field effect during live gameplay.Solution
isJoinSoftFocus: low focus distance, large distance scale, high strength) across the render passes (RenderSystem,draw_common,ScenePackets, andvk_GuiExecutor).SPECIAL_EFFECT_BLURwhenever active 3D gameplay is rendering (viewDef->renderView.viewID > 0or!session->IsGUIActive()).r_specialEffects(default 1) and expandr_forceSpecialEffects(-1 to force all off) for diagnostics and user control.Validation