1
$\begingroup$

I am looking for a hybrid of these two images. I want all UVs to overlap starting at the corner of the 0-1 range, but I also want all the polygons to be scaled relative to eachothers size. The first image was achieved by Smart Unwrapping each poly...one... at...a...time (not practical for large scenes.) The second image was accomplished by Smart Unwrapping all the polygons of an object all at once but this is not good for a repeating pattern. I intend to apply a repeating pattern across all polygons of a rectangle and I want it to repeat correctly no matter how big the polygon gets. The method for the first image would result in uneven scaling and take forever(very large scene,lots of objects), the method for the second image would not allow for a repeating pattern.

I want the polygons to overlap. It is efficient.

I've searched everywhere and can not find anyone trying to make a set of walls this way.

enter image description here enter image description here enter image description here

$\endgroup$
2
$\begingroup$

Make bottom LH corner of each UV (0, 0)

Script to move the closest uv coordinate of a face to (0, 0) and adjust the others accordingly. To run. Run the script in text editor to register operator. Create a UV map first, via smart uv unwrap for example, and then run the operator in edit mode. (Using space bar, and search for "Simple UV Operator")

Script is an edit of text editor > templates > python > Operator Mesh Uv

import bpy
import bmesh


def main(context):
    obj = context.active_object
    me = obj.data
    bm = bmesh.from_edit_mesh(me)

    uv_layer = bm.loops.layers.uv.verify()
    #bm.faces.layers.tex.verify()  # currently blender needs both layers.

    # adjust UVs
    for f in bm.faces:
        uvs = [l[uv_layer] for l in f.loops]
        uvs.sort(key=lambda o: o.uv.length)
        duv = uvs[0].uv.copy()
        for uv in uvs:
            uv.uv -= duv
    bmesh.update_edit_mesh(me)


class UvOperator(bpy.types.Operator):
    """UV Operator description"""
    bl_idname = "uv.simple_operator"
    bl_label = "Simple UV Operator"

    @classmethod
    def poll(cls, context):
        return (context.mode == 'EDIT_MESH')

    def execute(self, context):
        main(context)
        return {'FINISHED'}


def register():
    bpy.utils.register_class(UvOperator)


def unregister():
    bpy.utils.unregister_class(UvOperator)


if __name__ == "__main__":
    register()

    # test call
    #bpy.ops.uv.simple_operator()

Note: I've tested this whilst using 2.8, and needed to comment out #bm.faces.layers.tex.verify() . Might need to remove # for versions prior.

If you want only to move to left edge only remove the x component of the uv.

uv.uv.x -= duv.x

enter image description here Result on 2.8 after running op after smart project

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.