You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem was that the opacity of the river visuals ("sparkles") did not get scaled by the shroud level. To apply this alpha scaling only to the sparkles a change to the river shader was made.
Observe that the sparkles are now also less bright inside the fog.
This PR fixes river visual highlights (sparkles and edge alpha) being rendered at full brightness inside fog/shroud by propagating the shroud scale through both the CPU-side vertex colour computation and the GPU-side ps.1.1 pixel shader.
In getRiverVertexDiffuse, the vertex alpha (previously left unscaled) now multiplies by shroudScale, so the alpha packed into the diffuse colour reflects the shroud level consistently with the RGB channels.
In the m_riverWaterPixelShader pixel shader, the base water RGB multiply is split from the alpha write (mul r0.rgb + mov r0.a), and the highlight registers r1 (sparkles × noise + edge alpha) are scaled by v0.a via mul r1.rgb, r1, v0.a before being added to the base water, ensuring river highlights dim inside the shroud.
Confidence Score: 5/5
Safe to merge; changes are isolated to river water rendering and correctly fix shroud-level propagation without touching any game logic or data paths.
The CPU fix (getRiverVertexDiffuse alpha scaling) and the GPU fix (ps.1.1 highlight scaling via v0.a) are both straightforward and directly address the stated visual regression. No game state, data structures, or other rendering paths are affected.
Two-part fix: (1) getRiverVertexDiffuse now scales the vertex alpha by shroudScale (matching RGB channel treatment), and (2) the ps.1.1 river water pixel shader separates RGB/alpha multiplication so river highlights (sparkles + edge alpha) are multiplied by v0.a (the shroud-scaled vertex alpha) before being composited onto the base water. Logic is correct; one minor inconsistency: the alpha argument to GameMakeColor lacks the (Int) cast used by all three RGB arguments.
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["getRiverVertexDiffuse()"] --> B["shroudScale = level / 255.0f"]
B --> C["GameMakeColor(R*shroud, G*shroud, B*shroud, A*shroud)"]
C --> D["Vertex diffuse written to river mesh"]
D --> E["ps.1.1 Pixel Shader"]
E --> F["mul r0.rgb, v0, t0\n(base river x vertex RGB)"]
E --> G["mov r0.a, t0\n(keep river texture alpha)"]
E --> H["mul r1, t1, t2\n(sparkles x noise)"]
H --> I["add r1.rgb, r1, t3\n(+ edge alpha)"]
I --> J["mul r1.rgb, r1, v0.a\n(scale highlights by shroud alpha)"]
F --> K["add r0.rgb, r0, r1\n(composite final river colour)"]
J --> K
LoadingPrompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---### Issue 1 of 1
Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp:182
The alpha argument is missing the explicit `(Int)` cast that all three RGB arguments use. All other arguments cast the `Real` multiplication result to `Int` before the implicit narrowing to `UnsignedByte`, which is the standard pattern here and avoids `-Wconversion` warnings. Leaving the alpha channel without the cast is inconsistent and may produce a compiler diagnostic.
```suggestion (Int)(((diffuse >> 24) & 0xff) * shroudScale));```
The second image looks strange, almost as if the water is gone. The blue color is missing from the water.
Fixed. The alpha affected the base water instead of only the sparkles.
xezon
added
Rendering
Is Rendering related
Bug
Something is not working right, typically is user facing
Minor
Severity: Minor < Major < Critical < Blocker
Gen
Relates to Generals
ZH
Relates to Zero Hour
labels
May 28, 2026
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
BugSomething is not working right, typically is user facingGenRelates to GeneralsMinorSeverity: Minor < Major < Critical < BlockerRenderingIs Rendering relatedZHRelates to Zero Hour
2 participants
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.
The problem was that the opacity of the river visuals ("sparkles") did not get scaled by the shroud level. To apply this alpha scaling only to the sparkles a change to the river shader was made.
Observe that the sparkles are now also less bright inside the fog.
Before:
After:
