Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong realtime lighting for vertex-lit surfaces #1415

Open
slipher opened this issue Nov 4, 2024 · 2 comments
Open

Wrong realtime lighting for vertex-lit surfaces #1415

slipher opened this issue Nov 4, 2024 · 2 comments

Comments

@slipher
Copy link
Member

slipher commented Nov 4, 2024

With vertex lighting, the wrong diffuse color is used for realtime lights. Instead of the basic diffuse texture, the result of multiplying the diffuse with the vertex color is used. This comes from the line diffuse *= var_Color; in lightMapping_fp.glsl. So dynamic lights are practically impossible to see on dimly lit vertex-lit surfaces such as parts of the station15 evergreen trees.

I guess it's structured this way because vertex lighting is a type of "rgbGen", at least in explicitly specified vertex lighting shaders where the syntax is rgbGen vertex. In principle, any rgbGen operation should be included in the diffuse. But obviously this is the wrong idea for vertex lighting, so we should try to detect the vertex lighting case and exclude that calculation from the diffuse used for lighting purposes. I guess the criteria for detecting vertex lighting can be rgbgen vertex + is bsp surface + no lightmap, in a lightmap stage.

@VReaperV
Copy link
Contributor

VReaperV commented Nov 4, 2024

Isn't vertex lighting supposed to be part of diffuse? If not, how is it expected to contribute to the final colour?

@slipher
Copy link
Member Author

slipher commented Nov 4, 2024

Diffuse color multiplied by vertex color. Vertex color is a light color serving the same function as lightmaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants