# UV Unwrap: Unwrap Mesh to fixed pixel per unit

I'm building a game asset and want to keep an eye on equal mapping aspect ratio.

So my question is: how can I unwrap my object so that blender keeps a fixed ratio of 1 unit = 20px in the UV map. It doesn't matter if the UV mesh extends the UV texture, I will rearrange and scale manually.

Google or Stack Exchange didn't give me a good answer.

• Check out the Texel Density tool in the TexTools addon. Mar 17, 2018 at 16:50
• Thx David, TexTools is the solution. It offers an option to scale the UV Islands to a desired Pixel per unit size. :) Apr 8, 2018 at 6:04

David's comment was the answer I was looking for.

TexTools is perfect for that. While in UV Editing mode it allows you to calculate the actual Texel-per-Unit-Ratio. You can also set a specific texel density manually which scales the UV islands to that specific size. It also offers many more options for UV editing.

A smaller version only to change the texel density ist the Texel Density Checker on Gumroad.

Both tools work together without interfering each other.

• Do you mind explaining in detail why? Dec 14, 2020 at 13:51

1. Load texture with desired size

First note that UV coordinates are relative to the width and height of the loaded texture. So in order to define your UVs in pixel-units especially if your texture isn't square you should first load the image-texture and use the option "correct aspect" that some unwrapping methods have.

If no image is selected, blender will assume 256x256.

2. Evaluate Stretching

To get an even pixel-per-blenderunit ratio across the asset your unwrap should have no stretching in angle and area. No stretch means if you print the UVs on paper and cut out you should be able to build the 3d modell out of it.

To evaluate stretching activate Display->stretch:

Note the concave/convex parts of the model in the screenshot: More seams need to be added or a method like "Smart UV Project" could be used. In addition the function "minimize stretch" can optimize the result.

3. Find out the pixel-per-blenderunit ratio

There might be other methods/addons for this but it's not so hard to calculate by hand:

1. Messure the length of an edge in 3d viewport by calculating the distance between the two vertices:
$d_{3D} = \sqrt{(x_{v1}-x_{v2})^2+(y_{v1}-y_{v2})^2+(z_{v1}-z_{v2})^2}$
2. Messure the length of the same edge in UV-Map by calculating the distance of the two UV-vertices:
$d_{UV} = \sqrt{(x_{v1}-x_{v2})^2+(y_{v1}-y_{v2})^2}$
3. Calculate the pixel-per-blenderunit ratio with:
$currentratio = {d_{UV} \over d_{3D}}$

In a UV without stretching this ratio should be the same for every edge.

4. Scale UV

Having found out the current px/bu ratio you can scale your UV by a factor s to get the desired ratio:

$currentratio \cdot s = desiredratio$

$s = {desiredratio \over currentratio}$.
• One very convenient way to find distance with vectors is (v1.co - v2.co).length (where v1 is a vertex, and v1.co its vector coordinate) Vector math pretty much removes the need to use Euclidean distance formula. Mar 17, 2018 at 17:08