Repository navigation
Conversation
…htness was outside UnityPerMaterial and ~1900 VOBs had a MaterialPropertyBlock Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 tasks
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).