Skip to content

Conversation

@xezon
Copy link

@xezon xezon commented Sep 14, 2025

Merge with Rebase

This change fixes the initial shadow states of draw modules and implicitly removes shadows from build preview objects.

While inspecting rendering issues I noticed that the shadows on build placement preview objects look a bit bad.

Shadows on build placement preview objects

shot_20250914_123146_1

shot_20250914_123158_2

After investigating model shadow settings, I noticed that the model shadows in drawables are not correctly initialized: Even if a Drawable, such as the build placement preview object, is created without shadows, it will draw shadows.

The constructor of W3DModelDraw sets m_shadowEnabled = TRUE and ignores the DRAWABLE_STATUS_SHADOWS of the owning Drawable object. Pretty much all objects got initialized without shadows, but have shadows enabled on the first update during game start.

Accordingly, I streamlined the implementation and made the shadow initialization consistent. As a result, the build placement preview object no longer casts shadow.

With Shadow

shot_20250914_190933_1

Without Shadow

shot_20250914_185404_2

Without shadow, the object is far less visible than before, because the shadow does give it additional contrast.

To compensate, I adjusted the opacity value from 0.45 to 0.60.

Without Shadow and 0.60 opacity

shot_20250914_191345_1

shot_20250914_192209_2

If we want the shadow to remain, then we can adjust the flag and revert the opacity change.

TODO

  • Replicate in Generals
  • Add pull id to commits
  • Make placement drawable settings configurable

@xezon xezon added 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 Sep 14, 2025
@Stubbjax
Copy link

What user-facing bug does this fix? Is it accurate to call placement object shadows a bug?

@xezon
Copy link
Author

xezon commented Sep 15, 2025

What user-facing bug does this fix? Is it accurate to call placement object shadows a bug?

Basically the translucent preview objects no longer cast weird shadows. But this was only noticable when looking closely.

Another option here would be to also have 45% translucent shadows, if that is possible. Right now the shadows casted on terrain by these preview objects are identical to those of normal world objects.

We can bring back the shadows, in which case this would be just a technical fix and the shadows would be enabled explicitly. Note that originally EA did not enable shadows for these preview objects explicitly, but the shadows were enabled by a bug.

@xezon
Copy link
Author

xezon commented Sep 15, 2025

After thinking more about this, I think it would be better to make placement opacity and shadows configurable in GameData.ini or InGameUI.ini. Then we can leave defaults as per original game but configure in Patch data.

@xezon
Copy link
Author

xezon commented Sep 17, 2025

After thinking more about this, I think it would be better to make placement opacity and shadows configurable in GameData.ini or InGameUI.ini. Then we can leave defaults as per original game but configure in Patch data.

This change has been obsoleted by replacements

@xezon xezon closed this Sep 17, 2025
@xezon xezon deleted the xezon/fix-drawable-shadows branch September 17, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants