Skip to content

Set vertex colour attr correctly with material system#1431

Merged
slipher merged 2 commits intoDaemonEngine:masterfrom
slipher:material-vertexlit
Nov 13, 2024
Merged

Set vertex colour attr correctly with material system#1431
slipher merged 2 commits intoDaemonEngine:masterfrom
slipher:material-vertexlit

Conversation

@slipher
Copy link
Copy Markdown
Member

@slipher slipher commented Nov 10, 2024

Cherry-picked from #1406.

Before:
unvanquished-station15-vertexlight-tree

After:
unvanquished-station15-vertexlight-tree

I think this is still not complete actually, as there are also implicitly vertex lit surfaces that don't have CGEN_VERTEX set. Vertex lighting can be automatically selected when there is no lightmap. The computer console in Vega is an example. It uses an image loaded as shader.

@slipher
Copy link
Copy Markdown
Member Author

slipher commented Nov 10, 2024

The previous screenshots were with full-range overbright. Although this commit makes the material system match the standard renderer, the result is wrong (too dark).

With clamping enabled, the 'before' picture remains the same (too bright). But clamping + this commit looks just right:
unvanquished-station15-vertexlight-tree

Copy link
Copy Markdown
Member

@illwieckz illwieckz left a comment

Choose a reason for hiding this comment

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

LGTM.

The reason why it's too dark is because the overbright code is buggy, something that will be fixed with #1406. So actually getting it too dark is what is expected.

@slipher slipher marked this pull request as ready for review November 11, 2024 06:50
@slipher
Copy link
Copy Markdown
Member Author

slipher commented Nov 11, 2024

I figured out why implicitly vertex lit surfaces were unaffected. It's because the lightMapping shader forces the color attribute to always be enabled, but the generic shader doesn't. So only stages rendered with generic could suffer from the missing attribute. While implicit vertex lighting only happens for lightmapped stages.

Added a commit commenting out a part of the code that doesn't really work.

@illwieckz
Copy link
Copy Markdown
Member

What is “implicit vertex lighting”?

@slipher
Copy link
Copy Markdown
Member Author

slipher commented Nov 11, 2024

I mean when the shader does not have rgbgen vertex, but vertex lighting is selected because it's a lighting stage of a BSP surface that has no lightmap.

Copy link
Copy Markdown
Member

@illwieckz illwieckz left a comment

Choose a reason for hiding this comment

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

LGTM.

@slipher slipher merged commit 9ce4b22 into DaemonEngine:master Nov 13, 2024
@slipher slipher deleted the material-vertexlit branch January 9, 2025 06:47
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.

3 participants