Repository navigation
insert: compact bakes, eight-bit optical maps - #582
Merged
Merged
Conversation
A bake kept its UVs and tangents as a YAML line per triangle corner, a megabyte of text for a ringed insert. Each distinct UV and tangent is now saved once, the UV in 16 bits per axis and the tangent in 8 per component, as fine as the normal map baked against it, with a 16-bit index per corner, all as hex: 30 lines and 88 KB for the same insert. What is saved is what the insert wears, also before a reload. Bakes in the old form are read and take the new one on their next save. The optical normals are baked in eight bits like the normal map, and the optical response in eight bits with the sRGB curve, which its importer takes off again, so the glow's dim tail doesn't band. The maps shrink to about a quarter, and renders of the showcase inserts differ by a pixel here and there.
|
A bake whose corner data was cut short or half merged threw while it loaded. Its index width has to be two or four bytes now, its records whole and every index within them, or it reads as no bake and the generated mesh stays as it is. Tests reload a saved bake from disk at 65,536 distinct pairs, the last that fit 16-bit indices, and one more, both with repeated pairs, and read a damaged bake.
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.
Insert bakes were the bulk of a table's diff:
InsertBakeDatakept its UVs and tangents asVector2[]/Vector4[], which Unity writes as one YAML line per triangle corner. A ringed 1" insert's bake was 23k lines and 1 MB of text.Compact UVs and tangents
byte[], which Unity writes as one hex line.UvsandTangentsstay as they were for the baker,TryApplyand the packaging payload. On save they take the stored precision in place, so what the insert wears is what's saved, before and after a reload.FormerlySerializedAsand take the compact form on their next save.The LookDev bakes: 1.04 MB to 88 KB for the rings, 23k lines to 30 for each.
Eight-bit optical maps
The HDRP exporter records the response's colour space from the texture (VisualPinball/VisualPinball.Unity.Hdrp#30), so older 16-bit linear maps keep exporting as linear.
Tests
InsertBakeDataTests: a compact save and read round trip, and reading a bake in the old form.test_bake_insert.py,test_insert_optics.py) pass in Blender 5.2.