Skip to content

Shadows on water surfaces#1965

Open
AdamTadeusz wants to merge 5 commits into
NeotokyoRebuild:masterfrom
AdamTadeusz:361_waterfogshadowsonsurface
Open

Shadows on water surfaces#1965
AdamTadeusz wants to merge 5 commits into
NeotokyoRebuild:masterfrom
AdamTadeusz:361_waterfogshadowsonsurface

Conversation

@AdamTadeusz
Copy link
Copy Markdown
Contributor

@AdamTadeusz AdamTadeusz commented May 17, 2026

Description

neo assets pr NeotokyoRebuild/neoAssets#120

Adds support for the $lightmapwaterfog water texture param used in games post l4d2. I wasn't able to get the scale to which the shadow is applied to the fog colour, so I made it depend on the alpha value of the water fog colour.

Keep in mind, water with this parameter needs to have a lightmap. Depending on the bsp compiler used, setting $lightmapwaterfog before compiling may be enough, or you may have to add a compiler flag like "%compileKeepLight". You can check if a water surface has a lightmap with the mat_luxels 1 command. If the surface is entirely filled in in blue, there is no lightmap. If instead you can see a square grid pattern corresponding to the lightmap resolution, the water has a lightmap.

Some example images
$lightmapwaterfog 0
image

$lightmapwaterfog 1 $fogcolor" "{52 49 44 0}
image

$lightmapwaterfog 1 $fogcolor" "{52 49 44 1}
image

Toolchain

  • Windows MSVC VS2022

@AdamTadeusz AdamTadeusz changed the title Shadows on water surface Shadows on water surfaces May 17, 2026
@AdamTadeusz AdamTadeusz marked this pull request as draft May 17, 2026 16:12
@AdamTadeusz AdamTadeusz added the Changes in neoAssets This PR depends on changes in the neoAssets repository. The relevant PR should be in the description label May 19, 2026
@AdamTadeusz AdamTadeusz marked this pull request as ready for review May 19, 2026 13:32
Copy link
Copy Markdown
Contributor

@DESTROYGIRL DESTROYGIRL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, didn't seem to create issues for existing materials, tested on rogue:

Image

Comment on lines +270 to +272
#else // Still custom NEO code
SET_STATIC_PIXEL_SHADER_COMBO(LIGHTMAPWATERFOG, 0);
#endif // NEO
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was a lil confused by this until I realised it's because we can't #ifdef stuff in the shader code correct?
I don't think I was mindful of that when changing lightmappedgeneric. I wonder if it's the correct thing to do or we should just pull the original shader sources if you want to do a non-NEO build?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was the thought process yes. And you're probably right, if anyone is building without the NEO define for whatever reason they should just pull the original shaders

@DESTROYGIRL DESTROYGIRL requested a review from a team May 22, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes in neoAssets This PR depends on changes in the neoAssets repository. The relevant PR should be in the description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants