Repository navigation
perf: the world and its VOBs are SRP batched again (SetPass 3100 -> 190 with shadows) - #558
Merged
Merged
Conversation
…htness was outside UnityPerMaterial and ~1900 VOBs had a MaterialPropertyBlock Co-Authored-By: Claude Opus 5.5 <[email protected]>
17 tasks
…marks get their own material (review #558) - DynamicMaterialService copies the original material for the highlight, so _VobLightTint and the lamp indices stay - StationaryLightsService writes per-renderer values only into owned materials (never the shared LoadingMaterial) - untextured color materials are per renderer (texture cached per color), so one VOB's lights no longer light all - architecture.md P4 and world-lighting.md: SRP batcher rule, no MaterialPropertyBlock on world/VOB renderers Co-Authored-By: Claude Opus 5.5 <[email protected]>
6 tasks
Contributor
Author
Review (architecture-reviewer + gothic-reviewer x2) on 6b652d2Verdicts: architecture fits with concerns, gothic run 1 and run 2 approve with changes. The main finding, from all 3 runs: the focus highlight dropped the world-light tint (a chest in a cave lit up to full day while focused). Fixed in fdfd9ca, follow-ups in #563.
Compiled in the Editor with no errors; the runtime check (a focused chest in the Old Mine) is still to be done by playtesting. |
Contributor
Author
|
Editor test of the review fixes (G2, a save in Khorinis harbour at night): a world-lit barrel ( |
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.
What
The world and its VOBs are drawn with Unity's SRP batcher again. Fewer CPU draw costs on every platform (Quest too).
Lit/Worldwasn't SRP batcher compatible:_FocusBrightnesswas a material property outside theUnityPerMaterialbuffer (ShaderUtil.GetSRPBatcherCompatibilityCodereported it). It's inside now.MaterialPropertyBlock. The SRP batcher skips every renderer with one: ~1900 VOBs in Khorinis. The tint now goes into the renderer's own materials. Every renderer has its own materials already, becauseStationaryLightsService.UpdateRendererwrites its light indices there too (measured: 4762 materials for 4771 renderers).Measured in the editor in Khorinis with the shadows of #555 on: SetPass calls went from 3100 to 190, and the opaque pass from 86 ms CPU / 44 ms GPU to 5 / 9.5 ms (sum of 4 profiler blocks). Without shadows the gain is smaller, but it's the same mistake.
Why
Found while chasing the frame rate drop of the PC shadows (#555). Every shadow pass draws the world again, and unbatched that tanked the frame rate. It's a fix on its own, independent of the shadows, so it goes first.
How to test manually
_FocusBrightness)Tested in the editor (G2 Khorinis, quality High) and in a PC build with the keyboard/mouse VR simulator. Not tested with a headset yet, and nothing on Quest 2 or 3.
Save/load
Nothing saved. The tint is set when a VOB loads, like before.
Known gaps / follow-ups
UnityPerMaterialbuffer (feat: PC shadows - sun/moon, lamps, torch and spells, the hero's own shadow, SSAO, darker nights (GD3D11-like) #555 adds them and does).