Skip to content

Conversation

slipher
Copy link
Member

@slipher slipher commented Oct 18, 2025

Depends on: #1866

Use the lightMapping GLSL shader instead of generic to render BSP surfaces that are vertex-lit due to an explicit rgbGen vertex. This makes them use the same code path as BSP surfaces where vertex lighting is automatically selected due to the absence of a lightmap.So now it is possible to render realtime lights on explicitly vertex-lit surfaces, though they are still not as bright as they should be due to #1415.

A good chunk of code has been removed/simplified since we no longer need a duplicate code path for vertex lighting in the generic shader. In the future the newly added RSF_BSP shader flag could also help to simplify things since we could use that instead of plumbing 'is BSP surface' conditions through various places in the engine.

This targets 0.56 because it has the same effect as #1417 on the station15 plants, since the lightMapping shader never had the compatibility regression that generic did w.r.t alpha discard.

I have run my screenshot test suite against the shaders from master of https://github.com/UnvanquishedAssets/map-station15_src.dpkdir (and other maps as normal) and found no regressions.

There are no differences in my screenshot test suite as a result of
removing this. This alpha := 1 thing only existed in the `generic`
shader; its absence in lightMapping is further evidence suggesting it is
not needed.
Also add a static assert that the descriptions list has the right size.
Take pointer to stage instead of pointer to shader plus stage type.
Use the lightMapping GLSL shader instead of `generic` to render BSP
surfaces that are vertex-lit due to an explicit `rgbGen vertex`. This
makes them use the same code path as BSP surfaces where vertex lighting
is automatically selected due to the absence of a lightmap.

So now it is possible to render realtime lights on explicitly vertex-lit
surfaces, though they are still not as bright as they should be due to
DaemonEngine#1415.

In the following commit, this will let us remove some ugly code used for
applying the overbright factor to the `generic` shader.
const bool mayUseVertexOverbright, const bool vertexLit, const bool fullbright ) {
const int variant = ( mayUseVertexOverbright ? ShaderStageVariant::VERTEX_OVERBRIGHT : 0 )
const bool vertexLit, const bool fullbright ) {
const int variant = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can get rid of 0 |.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

This is unused following the previous commit which make shaders that
need overbright with `rgbGen vertex` run on the `lightMapping` shader
instead of `generic`.

Note: IS_LIGHT_STYLE was misnamed. It actually meant vertex overbright
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