Fix lighting for BSP model entities#1903
Open
slipher wants to merge 2 commits intoDaemonEngine:masterfrom
Open
Fix lighting for BSP model entities#1903slipher wants to merge 2 commits intoDaemonEngine:masterfrom
slipher wants to merge 2 commits intoDaemonEngine:masterfrom
Conversation
There is some code to skip a world surface if it has already been added in the current view. Don't do this for BSP entities because it is useless. Also if the gamelogic wants to draw more than one instance of a BSP entity in different places, it should be allowed to. Also skip per-surface culling for BSP entity surfaces since we already did culling for the BSP entity as a whole. This is more debatable since the entity could be huge with many sub-surfaces, but the single check seems like enough to me.
Make sure to use the model matrix in the lightMapping shader, so that they get correct normals and dynamic light locations. The bug was that a code path without a model matrix was used when the shader's USE_BSP_SURFACE macro was enabled. Change it to always use the model matrix. Fixes Unvanquished/Unvanquished#3474
Member
|
Thanks! Also it's small. So that whole Position stuff was just garbage? |
Member
Author
|
There was an attempt to optimize the BSP surface case by skipping multiplication by the model matrix, but this did not work for movable entities, since for those you need the model matrix to get the entity's position. And it wouldn't be worth having a shader variant just for the micro-optimization of skipping a couple matrix multiplications. |
Member
|
Ah I see now ! Thanks for the explanation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Unvanquished/Unvanquished#3474