I'm trying to find the total UV area used relative to the image bounds - i.e. a percentage/ratio of used space vs. available space.
I know you can use sum(f.calc_area() for f in bm.faces)
for a bmesh, but I'm unsure how to do this for the UV data instead of the actual 3D mesh data.
This UV map should give an output of 1.0
:
While this UV map should give an output of 0.25
:
The purpose of this question is to determine (and fix) the accuracy of image textures of known dimensions when applied to surfaces.
E.g. if we know a particular brick texture should be 2 meters wide, we should be able to use the mesh surface area in combination with the UV area utilized to calculate a multiplier to scale the texture up or down to be the correct size.
Some edge cases I'm not sure how to handle:
- Overlapping UVs
- UVs outside the image area