5
$\begingroup$

Background

I am doing some 3D design work with photographs and will need to do some cropping in Blender as I work. For example, as I try out designs I may need to make an image vertically cropped or horizontally cropped like this:

enter image description here

My current workflow is to use the loop cut tool with correct uvs enabled to crop quickly, but this also seems to be destructive modeling.

enter image description here

I have tried to use the vertex slide tool, and it appears to work in some directions, but not all. If clamp is disabled, it seems to struggle with which edge to slide along.

Works here:

enter image description here

But not here:

enter image description here

Question

Is there any way to "undo" a crop easily like how the loop cut tool corrects the uvs automatically?

$\endgroup$
4
$\begingroup$

Import your "image as plane", in your material nodes (cycles) select the image and add a "texture coordinates" node, plug the "generated" input to the vector of you image.
coordinates

Now edit your object (tab in 3D view), Change the selection mode to vertices+faces with Shift+LMB.

select mode


Note: The next part can be done instead with the following script.

import bpy
import bmesh

# select, duplicate, and delete face
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.duplicate_move()
bpy.ops.mesh.delete(type='ONLY_FACE')
bpy.ops.object.mode_set(mode='OBJECT')

# select the face
mesh = bpy.context.object.data
bm = bmesh.new()
bm.from_mesh(mesh)
bm.faces.ensure_lookup_table()
bm.faces[0].select = True
bm.to_mesh(mesh)
bm.free()
bpy.ops.object.mode_set(mode='EDIT')

# select the verts in the corners
bpy.ops.mesh.select_all(action='INVERT')
bpy.ops.mesh.hide(unselected=False)

Select all with A then duplicate with Shift+D, hit X and select "only faces".

Now click in the middle of your object to select the face, Ctrl+I to invert the selection (select the vertices of the deleted face) and hit H to hide the remaining vertices. They will act as invisible bounds for your texture mapping, but you don't want to select them (or modify them), that's why we hide them.


Now you can do anything inside your object (add/remove/move/rotate/scale faces/edges/vertices) as long as you keep them inside the original bounds.
If you need to see the borders in edit mode, go in properties panel, object tab and check "texture space".

texture space

Work in material view to see it in real time.

result

Basically, the image as plane creates a plane mesh with the image's XY ratio and UV unwrap it, so UV=Generated coordinates inside the original mesh bounds.

$\endgroup$
  • $\begingroup$ Very cool idea, but I prefer the other answer with the edge slide method because it is simpler for my case. Nonetheless, your solution will work for more cases than the other answer (more than rectangular meshes) so I will accept it anyway. $\endgroup$ – JakeD Dec 3 '16 at 21:06
  • $\begingroup$ Feed Pycoder with an answer, he'll give you a script :) $\endgroup$ – Bithur Dec 4 '16 at 2:34
5
$\begingroup$

The edge slide tool can do this very easily without the limitation of the vertex slide tool. Just disable "clamp" and enable "correct uvs" to use it. Beware, of extending past image bounds, however, because it will not clamp it at the image bounds manually.

enter image description here

Furthermore, it would be easier to "crop" using this than the loop cut tool that you are using.

$\endgroup$
  • 1
    $\begingroup$ I've always thought it was the same tool, just select vertex or edge and double hit on G. $\endgroup$ – Bithur Dec 4 '16 at 2:33
  • $\begingroup$ @Bithur Didn't know about the double G trick. Good to know, thanks. $\endgroup$ – JakeD Dec 4 '16 at 2:35

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.