public static class UvDensityTexel density as a constraint: uniform by default, with an override and a multiplier.
Remarks
docs/plan/42 § D9. Islands are scaled to a uniform texels-per-world-unit, and this is where "except this material" and "except this chart" are said. ⚠ The default has to be uniform, because non-uniform density is invisible in the atlas and glaring in the game — the classic symptom being a character's face at half the resolution of their boots, which nobody notices until the asset is in a scene next to something correct.
⚠ Everything here is a change to an island's Scale and never to its coordinates. Scale is coordinates per world unit and it is the only thing TexelDensity divides by, so telling the packer an island is twice the size it said it was is exactly "give this island twice the texels per metre" — and it is the one way to say it that leaves the island's own shape untouched, which is docs/plan/42's exit criterion 7.
⚠ Measured: uniform mode holds every chart to 0.0000 % of the mean, and the default does not. Criterion 5 asks for 2 %. With TexelDensity set, an independent recomputation off the placements and the mesh — atlas texels over world area, per island — comes out identical across every chart on every fixture. With it left at its default of zero, which keeps each island at whatever scale the flattener gave it, the same measurement spreads by 22.9 % on a hemisphere and 12.9 % on a saddle. The zero is not a density; it is the absence of one, and § D9's default is the other value.
Methods (5)
public static float Reference(IReadOnlyList<UvIsland> islands)A texels-per-world-unit that keeps the islands about the size they arrived at.
public static IReadOnlyList<UvIsland> Weight(IReadOnlyList<UvIsland> islands, IReadOnlyList<float> multipliers)The same islands, with a per-chart multiplier on the density each one will get.
public static IReadOnlyList<UvIsland> Override(IReadOnlyList<UvIsland> islands, IReadOnlyList<int> materials, IReadOnlyList<float> densities, float reference)The same islands, with a density override per material rather than per chart.
public static IReadOnlyList<float> Measure(IReadOnlyList<UvIsland> islands, IReadOnlyList<UvPlacement> placements, int resolution)What density each island actually got, measured off the placements rather than asked for.
public static float Spread(IReadOnlyList<float> densities)How far from uniform a set of measured densities is, as a fraction of its mean.
Used by (1)
- UvDensityTestsVixen.Geometry.Uv.Tests