5
$\begingroup$

How can the Blender User reshape a Distorted Cylinder to a Regular Cylinder in a minimum number of steps in situ, no adding or deleting of vertices?

  • Requirement. Move only the vertices currently selected in edit mode.

This is in the context of Shape Keys, therefore deleting vertices and adding them back is not allowed since it would affect pre existing shape keys. Assume the connectivity of the starting shape vertex selection in edit mode is topologically equivalent to a cylinder with out caps. The current selection consists only of edge loops in parallel connectivity. In other words the task is possible without adding or deleting any vertices or changing topology. We just need to change position of vertices.

enter image description here

In the image above the left most yellow mesh is the starting point. The second yellow mesh in edit mode depicts the vertices or vertex group whose members may be moved. That is a requirement. Please note 1 or more vertices are NOT selected.

The blue mesh is the goal shape within a constant factor in XYZ dimensions of the edit mode selection, with standard edge loops in circle, other edges parallel to z-axis. In the result, one time user scaling in the XYZ global axis is acceptable. In the result, one time user rotation of (N*90) degrees is acceptable where is N is an integer.

enter image description here

In the image above we see a successful edit. Cyan Shape show results according to the steps below. Edit Mode and Object Mode.

Best candidate at the moment. Minimum of artistic maneuvers was one goal. Assume target cylinder in standard z-axis position.

Edit Mode Vertex Position Steps

  • Loop Tools Addon is enabled.
  • Edit Mode with valid selection.
  • Take note of current selection and with virtual/discussion/[vertex group] name BS0 .. Blender Selection 0.
  • Agree that each edge loop in BS0 has a virtual name EL0N. There are integer K > 1 edge loops. N is an integer whose range is [0,K]. EL0N is connected to EL0(N-1) if N > 0. EL00 is the edge loop whose target Z-coordinate is maximum. EL0(K-1) is the edge loop whose target Z-coordinate is the minimum.
  • Agree EL00 is the top in target. EL0(K-1) is the bottom in target.
  • Select edge loop EL00 of BS0. Scale Z axis to zero.
  • Loop Tools Circle to achieve Regular Circle in XY Plane. Keystroke WLC.
  • New Selection of one edge loop virtual name EL01 adjacent to EL00. Scale Z-axis 0. Grab/Translate selection on Z-axis so EL01 is below EL00. Loop Tools Circle. These micro steps are to insure predictability in extreme cases with the next step.
  • [Vertex Slide] EL01 coincident to EL00. Accept the action. Move EL01 on Z-axis back to some reasonable position visually distinct from EL00.
  • Repeat the step above for all adjacent edge loops.
  • Explanation. Each edge loop EL0(N) is corrected by EL0(N-1) in the XY coordinates for N in the range [1, K]
  • At this point we have a reasonably acceptable cylinder with potentially uneven distance between edge loops.
  • Select one edge ring spanning all edge loops of BS0.
  • Loop Tools Relax [Linear Parallel] ... Keystroke WLR. Parallel edge loops are equally spaced.

enter image description here

In the image above unselected vertices are hidden for ease of explanation.

Can these steps be streamlined?

Perhaps a Script would be preferable to copy points from a fresh cylinder calculation. Please correct my understanding of the problem in the comments in case I have under specified / over specified requirements.

Low priority Failure category in the context of some current goals

enter image description here

In cheery Winter Mesh colors left to right.

  • The 01 green mesh shows a Cast [Cylinder] modifier result.
  • The 02 red mesh shows a To Sphere result.
  • The 03 green mesh shows a Shrink Wrap Modifier to a cylinder result.
  • The 04 red mesh shows a Shrink Wrap Modifier to a sphere result.
  • Note the undesirable curved edge rings in some results.
  • Proportional Editing
  • Custom Normals under low priority consideration
  • [Data Transfer] under low priority consideration

Thanks.

$\endgroup$
  • $\begingroup$ The single answer below does not meet the requirements. $\endgroup$ – atomicbezierslinger Dec 25 '15 at 5:15
  • $\begingroup$ How was this cylinder created, the verts order(indicies ) could be used in a script ( knowing the diameter and nbr of verts in a circle ) to reshape it, check the default cylinder verts indicies $\endgroup$ – Chebhou Dec 25 '15 at 11:09
  • $\begingroup$ I somehow forgot all about this. $\endgroup$ – atomicbezierslinger Aug 6 '17 at 15:23
  • $\begingroup$ Details. Add .. A rotation of 0-360 degrees about the Z-axis is acceptable. $\endgroup$ – atomicbezierslinger Aug 6 '17 at 15:42
  • $\begingroup$ For the reader, investigate BSE references to LoopTools. For sometime the [vertex slide] above is probably not necessary. I probably did not use all the features of LoopTools at the time of writing. I did not keep track of the history of LoopTools. There are many references to LoopTools by myself and other at BSE. $\endgroup$ – atomicbezierslinger Aug 6 '17 at 16:01
3
$\begingroup$

I'd use a script.

import bpy

objects = bpy.data.objects

origin_obj = objects['Cylinder']
modified_obj = objects['Cylinder.001']  # select verts on this object

def revert_percentage(amount, origin_obj, modified_obj):

    bpy.ops.object.mode_set(mode='OBJECT')

    origin_verts = origin_obj.data.vertices
    for v in modified_obj.data.vertices:
        if v.select:
            idx = v.index
            # linear interpolation between original coordinate
            # and modified coordinate. the amount is passed during
            # the function call.
            v.co = v.co.lerp(origin_verts[idx].co, amount)

    bpy.ops.object.mode_set(mode='EDIT')

# between 0.0 and 1.0 of original. 1.0 is total reset of selected verts.                
revert_percentage(1.0, origin_obj, modified_obj)

This assumes your modified object is in edit mode, like you said.

enter image description here

becomes this:

enter image description here

$\endgroup$
  • $\begingroup$ Please excuse the delay. I am not quite sure if I had seen this proposed answer. Memories. $\endgroup$ – atomicbezierslinger Aug 6 '17 at 15:31
6
$\begingroup$

Join as Shapes

If the two object shares the same number of vertex and similar same edges & polygons list, you should be able to convert a "target shape object" to a Shape Key for an other object.

Obiuvsly "good" results are achievable only if they have matching topologies (e.g. a T shape will not easily became a I even even if the vertex count is the same), but your case seems one of them.

enter image description here

First of all you should create a "basis" shape key for wanted object, just for safety.

After that, pick the "target shape" object and then the other object.

In the drop down menu as shown in the picture above you can find the command that will add the selected object's active shapekey (the basis in this case) to the active object.

enter image description here

Raise the Shape Key influence factor in order to see the change of vertices coordinates.

$\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.