# UV Map Scaling Issue

I have created a simple mesh in blender 2.72 and created a UV map for the mesh for exporting to another engine.

This all works and I can apply a texture to it in the third party engine but the scaling of the texture is not correct (it appears as image below does in blender without scaling UV map) ... this is because textures in the external application I would like to use are 1024x1024 and the UV map in blender by default is 1024x1024.

After much investigation I have found that you can scale UV map very easily and I can achieve the scaled texture that Im looking for such as this

My question relates to the imprecise nature of this scaling.

If I want to create many meshes to export with the same UV scaling so that the textures in the external application are all applied consistently (which I do) there does not seem to be a way to scale the UV map manually (i.e. provide manual scale parameters) you can only scale with the mouse in a haphazard way without knowing what the scale is other than eyeballing it in the 3d view?

So, is this
a) the correct way of scaling my model so that textures are rendered the way I want and
b) if so can I specify the scaling manually for the UV map (i.e scale UV by 10.0)?

Thanks in advance for any help

I have been pulling my hair out on this one for some time

• You can specify the amount to scale by typing numbers on the keyboard after pressing S. – gandalf3 Dec 10 '14 at 0:02

## Manual precise UV scaling:

In UV editor place your 2d cursor in the desired center of scaling, you can place it precisely from Properties tab N. In the header swith to 2d cursor pivot:

Select UV vertices and enter transform mode with S, in the header area type the exact number or an expression. You can constrain axes by X or Y.

## Precise UV scaling of multiple selected objects:

import bpy
import bmesh
from mathutils import Vector

# center of scaling - edit this
pivot = Vector((0.0, 0.0))
# amount of scaling in each axis - edit this
amount = Vector((2.0, 2.0))

for object in bpy.context.selected_objects:
mesh = object.data
bm = bmesh.new()
bm.from_mesh(mesh)
uv_layer = bm.loops.layers.uv.active

for face in bm.faces:
for vert in face.loops:
vert[uv_layer].uv -= pivot
vert[uv_layer].uv.x *= amount.x
vert[uv_layer].uv.y *= amount.y
vert[uv_layer].uv += pivot

bm.to_mesh(mesh)


can I specify the scaling manually for the UV map (i.e scale UV by 10.0)?

Yes, press S, type 10, press Enter

In addition, I would recommend on getting to know how the Texture Atlas Add-on works for multiple objects. It's especially suited for game texturing:

And with that, it's often useful to use 'Draw Other Objects' in the Image Viewer:

Cheers!

• Thanks very much ... I will take a look at the Atlas add on – Adam Fox Dec 10 '14 at 15:01