Here’s a tutorial explaining how I approached a particular challenge for a recent job. This particular job required a leaf to break apart and re-form into a map of the world which then turned into a spinning globe. Here’s a version of the finished clip.
I may cover the breaking apart and re-forming in another tutorial, but for this post I want to show how I turned the flat map of the world into the 3D globe version using 3dsMax.
To begin with it seemed that it was going to be easy (and the solution I chose was indeed easy, once I’d thought it through) but the first few methods I researched proved fruitless. After Effects, for example, has the excellent CycloreFX ‘sphere’ effect but there was no way I could transition neatly into the sphere from flat. I also looked at the Sphereize modifier in Max itself, but it would not turn a flat plane into a sphere. Now, if anyone else can think of a nifty off-the-shelf solution then please let me know, but I was on a tight deadline, so I chose to do it by “hand” using morph targets.
So there you go. If you’re an advanced Max user then you probably already thought of that solution and I’ll bet you can already think through the process. If that’s the case you can skip the rest of this post and continue looking for lolcats, checking your email, and looking at what your friends are doing on Facebook. For the rest of you I’ll explain how I did it.
So, in order to use the Morpher modifier in Max and animate the transition from one to another I need two meshes containing the same amount of vertices. These meshes are the morph targets. The morpher plots the motion between, say, the coordinates of vertex #245 in mesh A to the coordinates of vertex #245 in mesh B. That’s why there should be the same amount of vertices in both target meshes. The modifier simply won’t work if mesh B has ten more vertices than mesh A. Also, unless you want the animation to be a huge mess, you’ll need the arrangement of those vertices to make some kind of visual sense. In this case it means starting with a sphere and peeling it (sort of like an orange) and laying out the surface flat. The idea being that the morpher will reverse the process and turn the flat plane into a round sphere. If you think about it, this is the simplest way; the reverse is much more fiddly.
Remember I said this process was by “hand”? That’s right, you have to push quite a few vertices into position, so you want to keep that chore to a minimum. This means using our old friend the Turbosmooth modifier to make a simple sphere look like a higher poly smooth version. The only problem is that a low poly sphere isn’t very round. Take a look at the picture below and you’ll see what I mean.
As you can see in the picture I have three 50cm radius spheres, all with differing segments and Turbosmooth settings. Despite being the same radius and diameter you can see that the the higher the amount of underlying segments are included in the sphere the more round the result. Seen from the left it becomes obvious that lowering the segments leads to a more distorted and pinched sphere.
It’s your call; how much distortion can you tolerate for your project? I settled upon 32 segments as a manageable amount of vertices to push around while still maintaining a decently round sphere.
Set the Scene
Now that technical decision is made we can set up our scene.
I’ve added a target plane behind the sphere. This is a visual reference and provides something to snap to when I’m pulling the sphere apart. Consider it a custom grid. It is important that it contains the same amount of rows and columns that the sphere contains. In this case that is 16 rows (length segs) by 32 columns (width segs). The aspect ratio of the plane is up to you but I’ve chosen a 2:1 aspect which means square segments = least distortion for the texture map of the world that I’ll be using.
On the subject of texture maps, I’m using a low resolution version of one of the excellent maps that NASA have released into the public domain. They are in the same 2:1 ratio with stretching at the poles, so they good when mapped on to spherical geometry. If you use any of these maps in your own projects be sure to credit NASA. For my client in the video at the top of this post the NASA map was turned into a highly stylised version, with only the outline and proportion of the continents remaining recognisably realistic.
You might notice I’ve put a point helper in the scene. This is another piece of visual reference. It’s easy to get disorientated in perspective mode when rotating geometry, especially something perfectly symmetrical like a sphere. The point just helps to remind me which side I’m treating as the ‘front’ without having to decide on a camera position just yet, or coming out of perspective view to check.
Peeling the Sphere
Currently the sphere is closed, solid geometry and we need to peel it. The sphere won’t burst apart by itself. So the next step is to make a seam up the back of the sphere and pull it apart, much like un-zipping a lady’s dress.
Convert the sphere to an editable poly and for each ‘pole’ vertex, in turn, select and break the vertex. Each pole should then divide into 32 separate vertices. It won’t look any different because the new verts occupy the same space as the original.
Then switch to edge sub-object mode and select all the edges down the back of the sphere between the two poles. Choose ‘split’ from the command panel.
Again, it doesn’t look like anything much has happened. Re-select one of the edges along that seam and select the rest of the loop by hitting the ‘loop’ button on the command panel or SHIFT-clicking on one of the other edges in the seam (if your version of 3ds Max supports it).
You should see the loop selection extend from pole to pole.
At this stage you have one of your morph targets complete. You need a minimum of three objects, each with the same vertex count: one object as a morph target in the ‘before’ state(un-peeled); one object in the ‘after’ state(peeled); and a clone of either morph target to be the object that animates between the two. So clone this pre-peeled sphere and hide it for now. Continue peeling the original.
From this point it is easiest to begin pulling apart the sphere from the poles. From the front viewport select a pole and pull it a little away from the sphere’s centre; up (Z) in this case.
Then click and drag one vertex at a time away from the centre axis (sideways, in X). Do this for all vertices at each pole. The exact order doesn’t matter too much, so long as you can make sense of them and select them easily. For clarity I’m doing one side of the sphere to begin with.
Repeat this for both poles and then go back to edge mode. Your previous edge selection will still be intact, but if it isn’t re-select edges in the seam you made running from pole to pole.
Pull the edges away from the sphere.
You’ll need to pull them a fair bit further than your custom grid plane (remember that?) might suggest. Repeat this with the other north to south edge loops until the sphere is completely peeled.
The picture (below) shows this half complete.
Next start pulling columns of verts away from the sphere in order to straighten them out. Ultimately we’re aligning them to out target custom grid in the background. I pull out a column, use the X and Y ‘Make Planar’ buttons, snap them to a vertex on the grid and right-click on the Y coordinate transform spinner at the bottom of the UI. That’s just to have it in 0 Y coordinates, laying proud of the grid I placed in the background. Using 2.5d snap to vertex keeps the verts away from the grid but still in alignment. You could snap in full 3D, and there’s nothing wrong in doing so, but I didn’t so I could see the mesh more easily.
Continue until you have a plane that is flat, although still a bit ragged and uneven in one axis.
At this stage it is now a simple case of selecting rows of verts and using the ‘Make Planar’ Z button then snapping them to the correct grid spacing in the Z axis. Once this is done you should have a peeled sphere that resembles the guide plane/grid that you placed behind. The only thing that differentiates the two are the missing triangles from where the North and South poles once met.
Essentially that’s it! You’ve done all the hard work of pushing pixels into the shape you want, so the only thing now is to un-hide your other (non-peeled) morph target, clone it again and you have all three objects needed for the animation.
It’s easy to get confused as to which object is which so I advise naming them something sensible so you can keep track. I’ve used this naming convention: morph (animating) object = “Morph_Object”; flattened sphere = “Peeled”; un-flattened sphere = “No_peel”.
It’s at this point of animating the morph from one target to another that you will probably run into a problem. It’s very easy, while pulling around scores of vertices, to lose track of where the centre of the object is. In my case I had pulled all the vertices to the left (minus x) of the original sphere’s centre pivot. The effect of this is to see the morph target animate away from the centre spherical shape to the flattened shape offset from the centre. It seems to wander off from where you intended. In most cases this is probably not what you want. So how do you prevent this?
You could offset the morph target with the wonky pivot point to compensate for its wanderings during the animation but that’s a bit unintuitive, in my opinion. It’s making a wrong to add to the wrong to make a right.
A much better solution is to reset the object’s transform before loading it into the Morpher modifier. Be aware that using the ‘Transform’ button from the ‘Reset’ group in the ‘Hierarchy’ Tab of the object’s Command Panel won’t work!
Instead do this:
Select the peeled, flat version and choose the ‘Affect Pivot Only’ toggle button from the Hierarchy tab in the Command Panel. Then press ‘Center to Object’ on the same panel.
That’s re-set the pivot to the middle, but it won’t ‘stick’ until you do the following:
With the object still selected go to the ‘Utilities’ tab in the Command Panel.
Click on the ‘Reset X-Form’ button and another button labelled ‘Reset Selected’ appears below. Click on it; it adds an XForm modifier to the stack.
Then click on the ‘Collapse’ button on the same panel. Some options appear below; choose ‘Modifier Stack Result’ below ‘Output Type’ and click on the ‘Collapse’ button.
I described this method, using the ‘Utilities’ tab, because it requires fewer button clicks than applying an XForm modifier and collapsing it using the stack yourself. It’s something I’ve have to do for my work in games countless times.
Applying the Morpher modifier
Arrange your two morph targets and the morph object in you scene as you wish. It’s not important where the two targets sit in the scene as we will hide them for rendering or turn their rendering off. The important node is your morph target mesh. Remember, this is a clone of your original sphere but with a seam down it’s back, so it still looks spherical. To keep things neat I have all three objects on the origin (0,0,0).
Select the morph target mesh and apply the ‘Morpher’ modifier from the ‘Modify’ tab of the Command Panel.
Choose each target mesh for the top two slots in the Morpher’s rollout (see picture, below).
With Auto Key toggled in the ‘on’ state animate the spinners (from 0% to 100% for one channel and 100% to 0% for the other) over your target amount of frames. This produces a cross-fade effect.
Change your keys and spinner weights for the exact effect you need. In this case a simple 100% cross-fade from one state to another is adequate.
The above picture shows the morph target mesh mid-animation. The two target meshes are hidden.
The originally UV mapping applied by default to the sphere primitive should still be intact but, if for any reason it isn’t or you simply need to tweak or change it then it is very simple to apply new mapping to the morphing mesh, especially when it’s flat!
Finally add a Turbosmooth modifier to make the globe appear rounder when it is morphed into its sphere shape.
It’s slowly coming together.
The screenshots I had previously formatted for my custom site need to be re-visited for the new site and I’ve taken the opportunity to upload a couple more things to Vimeo, which should appear in the portfolio gallery shortly. It’s taking longer than I thought, and hoped, but it always does when you want to get things right. I have to give myself a bit of slack, as I am new to WordPress, after all. With my previous site I would simply splice a new bit of PHP code into an include, or make a whole new include PHP file, and upload it. A bit of testing on the browsers and that was it. WordPress, in order to make itself accessible, has its own way of doing things and I’m aware that if I get too hands on I might break things. That would probably lead to a large mess and a big headache, so I’m being careful to play by WordPress’s rules and do things by the WordPress book. The downside is the learning curve, which isn’t steep, by any means, but takes some time nonetheless.
So, the portfolio gallery is up next. I’ll try and get that live as soon as I can.
Okay, I’ll lose the exclamations from my post titles in future.
Actually it’s not so much of a stumble as a re-think. I’m new to WordPress but it seems a good solution for an individual such as myself. So good that I’ve decided to ditch my self-penned custom built web site and try WordPress for the whole she-bang. It’s a bit of a trial, as I’ll re-instate the old site if I can’t get what I want out of WordPress. So it’s going to look a bit rough and crazy here for a day or two until I manage to get my visual theme sorted out.
The 3D stuff will start soon – honest.
A blog is born.
This is something I’ve been thinking about for a while now. For many years I’ve benefited from the wisdom and knowledge of many generous people around the web, and now the time feels right to try and give something back. If anybody out there is able to take anything of value from my future posts then I’ll consider it a success.
I’m still setting up the blog so this opening post is very short, but stay tuned.