So I'm making a 2d animation in blender, using the z space as layers, and the camera is in orthographic view.
I'm trying to morph a square plane to be a flat circle, but I have no idea how to even approach it.
-
1$\begingroup$ Start with a circle, it is easier to go from a circle to a square than the other way. You can then reverse the keyframes $\endgroup$– J SargentCommented May 11, 2015 at 17:21
-
$\begingroup$ How would I go about morphing the circle to a square? $\endgroup$– DragonHeartCommented May 11, 2015 at 17:23
6 Answers
Add a cube to your scene, enter edit mode, and delete the top and bottom faces. Select all and press Ctrl+N and check the Inside checkbox in the Tools menu.
Now add a circle and add a Shrinkwrap modifier to it. Select the cube as the Target and set the mode to Project. Now press the Apply as Shape Key option.
You can now go to the Object Data panel and change the influence of your new shapekey. You can also animate it by hovering and pressing I. To go from a square to a circle, sart with an influence of 1
and then animate it going to 0
. You can also delete the cube mesh now, it is not needed for the animation to work.
Final Result:
-
1$\begingroup$ This one wins for flexibility as you could make any shape as a target. $\endgroup$ Commented May 11, 2015 at 22:25
The easiest way, in my opinion, is to use the 'Cast' modifier. Using a subdivided plane you can cast/warp an object from one shape, to another, preset shape:
Animating the 'Factor' allows you to switch between the original shape and the 'cast' shape.
-
3$\begingroup$ Oh my gosh! These answers are amazing! Thank you guys for your quick responses, and I love your videos, Ray Mairlot, btw. $\endgroup$ Commented May 11, 2015 at 18:08
-
$\begingroup$ + 1 for not applying any modifiers $\endgroup$ Commented May 12, 2015 at 14:51
Mapping a disc to a square
Journal of Computer Graphics Techniques Vol. 5, No. 2, 2016 http://jcgt.org
. Mappings between Sphere, Disc, and Square. Martin Lambers. outlines a number of disc to square, and square to disc mappings
One of which is the elliptical square to disc mapping
$$\begin{align} u = x\sqrt(1 - y^2/2)\\ v = y\sqrt(1 - x^2/2)\\ \end{align}$$
Test script that adds a 16 x 16 grid (basis "square" shapekey) and it's elliptical mapping as a shapekey "circle"
import bpy
import bmesh
from math import sqrt
from bpy import context
collection = context.collection
me = bpy.data.meshes.new("Squircle")
obj = bpy.data.objects.new("Squircle", me)
bm = bmesh.new()
bmesh.ops.create_grid(bm, x_segments=16, y_segments=16, size=1)
def squircle(x, y):
u = x * sqrt(1 - y * y / 2)
v = y * sqrt(1 - x * x / 2)
return u, v
bm.to_mesh(me)
sk = obj.shape_key_add(name="Square")
ci = obj.shape_key_add(name="Circle")
for v in bm.verts:
ci.data[v.index].co.xy = squircle(*v.co.xy)
collection.objects.link(obj)
Test on all mappings. Elliptic mapping above is row 1 column 4.
-
$\begingroup$ Many thanks, I've been searching for this for ages (to use with the node Animation nodes plugin and scatter random vectors on a circle / tube) $\endgroup$ Commented Apr 15, 2020 at 22:03
If all you need is a shape you can use the To Sphere tool.
Add a plane, subdivide it and press ShiftAlt S
To animate create a shape key for the square part and a second shape key for the circle and animate the value for the second shape key.
Shape keys are created in object mode.
-
1$\begingroup$ And just when the hopes were highest that nobody had mentioned the old to Sphere, Well remembered. $\endgroup$ Commented Mar 9, 2018 at 17:01
Same as the answer of Ray Mairlot, but with shrinkwrap (as Cast modifier can go too far and make it like a clover). NᴏᴠɪᴄᴇIɴDɪsɢᴜɪsᴇ pointed it out, but here's a way to do it in less steps.
- New plane
- New circle
- Extrude and fill the hole of the circle.
- Subdivide plane by 10
- Add modifier Shrinkwrap to plane
- Set the target of the Shrinkwrap to be the circle
- Apply as shape key done