Skip to main content
Notice removed Canonical answer required by CommunityBot
Bounty Ended with Sietse Brouwer's answer chosen by CommunityBot
added context
Source Link
Greg Zaal
  • 10.9k
  • 3
  • 49
  • 86

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:

filled UV map

While this UV map should give an output of 0.25:

partial UV map

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

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:

filled UV map

While this UV map should give an output of 0.25:

partial UV map

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:

filled UV map

While this UV map should give an output of 0.25:

partial UV map

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
Notice added Canonical answer required by Greg Zaal
Bounty Started worth 200 reputation by Greg Zaal
Tweeted twitter.com/StackBlender/status/1593982448970366976
Source Link
Greg Zaal
  • 10.9k
  • 3
  • 49
  • 86

How to calculate the total UV area used?

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:

filled UV map

While this UV map should give an output of 0.25:

partial UV map