Blender shortcuts

Useful shortcuts that I tend to forget:

Both edit and object mode:

S = scale (S + (X,Y,Z ) = scale on axis only), (S + SHIFT + (X,Y,Z ) = scale other axis than… locking selected axis)

R = rotate (R+ (X,Y,Z )= rotate on axis only), (R + SHIFT + (X,Y,Z ) = rotate other axis than… locking selected axis)

5 = switch between orthographic / perspective projection

1 = front view (CTRL + 1 = back)

3 = right view (CTRL + 3 = left)

7 = top view (CTRL + 7 = bottom)

 

In edit mode:

E = extrude

ALT + A = shrink / flatten

K = cut

F = fill (make edge / face)

I = inset (faces only)

SHIFT + D = duplicate

GG = edge slide

CTRL + I = select inverse

CTRL + R = Loop subdivide

W (specials) = Smooth, etc.

CTRL + Tab = switch between select modes (vert, edge, face)

CTRL + E = Edges menu

CTRL + F = Faces menu

 

Object mode:

SHIFT + A = add (a mesh, curve etc.)

X = delete

 

General:

CRTL + Z = undo

CTRL + Y = redo

B = rectangular area select

C = circle area select

O = proportional editing

H = hide

ALT + H= unhide

M = move to layer

A = select all / unselect all

Z = switch between shading (wireframe / solid in 3d view)

 

Advertisements

Rigging characters in Blender

When I started to create models and animations with Blender in February this year (2014) I wanted to understand what it takes to create 3d models and import them into a gaming engine.

Until now I have mostly just studied how Blender works and how you create models and animations. Now I took the next step and I wanted to create a low poly character and create a rig for it. Rig is a set bones that control a mesh (a model). One could say it’s a skeleton of some kind. When you have a rig that is attached to a mesh, controlling the rig you can animate the mesh more easily.

So, I started from a very simple person who doesn’t have a facial features due to being low poly. But he/she has arms and legs, head and fingers. This should be simple enough to create the rig.

Rigging in Blender is in my opinion very easy. You can find numerous tutorials in YouTube and it’s easy to get started with beginner knowledge in Blender. Blender even has a nice add-on called Rigify which creates a simple human rig you can easily extend.

After a weekend practicing and learning I created a rig and two simple animations. One with a simple walk cycle and second one a bit more complex, a round house kick.

What you think?

Back to Blender after a long pause

It’s been a while since I opened up Blender. There’s a reason for this and it’s my new job which has been pretty exhausting at the beginning. I have been doing a lot of learning (Unity) and a lot of coding and I just haven’t had the energy to do anything in the evenings and weekends. Now I am starting to be more comfortable with my new surroundings and project I work on so I have had energy to do other stuff as well.

I created a few short animations withing few weekends. Both are based on nice tutorials on Youtube. The first has a magnification effect on a logo and the second one is an attempt to create a water simulation. The water simulation seems to be tricky to do and I really don’t know why I cannot get more detail into the animation. Every time I set higher resolution the simulation just gets stuck. It would be really interesting to hear if anyone knows why. I have tried to recalculate the mesh normals, create a bigger tube but nothing helps.

Anyways, here they are, what do you think?

 

 

Falling collectible bonus on Unity, part 2: The animation

In the last post we created the asset for the animated falling collectible bonus. In case you missed the post read it first here. In this post we use the images and create an animation in Unity for the collectible.

First you need to create a folder under “Assets” in which you will have the images. I have created a folder called “Sprites” and under “Sprites” I have a “Bonus” folder. The structure is up to you but creating a organized structure will help you later when you have more than just few assets (and asset types). Copy the images you created to the Bonus folder. You can import them by using Unity too but I don’t know how to import several images at one command so for me it was easier to use the file system copy.

When files are copied go to the folder and select all the images and drag them to the scene. Dragging the images to scene causes Unity to create an animation to the same folder the images are dragged from, in my case, folder named “Bonus”. You can rename the animation i.e. bonus. At the same time Unity creates a game object with:

  • Sprite Renderer, in which one of the images selected as Sprite (I don’t know is it random or how Unity decides this?)
  • Animator, in which the controller is newly created controller in the same folder. This also seems to have a random name but you can rename it to i.e. bonus. More about the Animator here.

We are going to need also some extra components. We are going to use BoxCollider2D so that we can check if player is colliding with the bonus. Add the BoxCollider2D component to the game object and check the “Is Trigger” check box. This way the bonus only causes trigger when colliding but do not actually collide (interfere with the physics). We don’t want the bonus to bounce or anything from the other game objects. Set the X and Y size so that it matches the sprite boundaries (for me X=0,7 and Y=0,33).

We are going to need also a Rigidbody2D component. You can leave the default values for this component. If the game object do not have Rigidbody2D component it will be ignored by the physics engine. If you are not having this component you need to take care of the movement of the bonus in the scene, plus I think you need to check the collision manually. In my game I wanted the bonus to “fall” so I use gravity to move the object. Your case might be different and require other type of approach.

Now you should have an animation called bonus and controller named bonus in your bonus folder along the sprites and a game object with Sprite Rendered and Animator in which the controller is the “bonus” -controller. You should also have a BoxCollider2D and Rigidbody2D components.

We are also going to add a Script. Add component and select “New Script”, type the name i.e BonusScript and select the type CSharp. This script is going to have the code which is triggered when bonus is collected. The Rigidbody2d has a method:

void OnTriggerEnter2D(Collider2D other) {

// write your bonus handling here or send message to appropriate game object

}

If you are familiar with the tag concept you can check if the object the bonus is colliding with is a player with this type of clause:

if(other.gameObject.tag == “Player”){

}

Using gravity increases the speed of the bonus so it’s more realistic, but if you want to move the bonus object same speed all the time then you can use the following script:

void Update () {
gameObject.transform.Translate (Vector3.down * Time.deltaTime);
}

When you are done with the game object in the scene, drag it from the hierarchy to the folder where you store your prefabs and delete the game object from the scene. This way you can use the prefab to instantiate the actual bonus object in your game.

Until next time, happy coding!

Falling collectible bonus on Unity, part 1: The asset

I thought writing this down already a month ago when I was playing around with Unity and I wanted to create an animated collectible bonus which is instantiated at the certain coordinates at the screen and it starts then to fall “down” (usually Y axis). Now I will create a blog post about the whole thing so I will remember how to do it and maybe help someone else too.

Bonus itself will be a simple small block, a sort of a tile with a letter so that the player can decide if he/she wants to collect the bonus or just let it drop out of the screen. So the bonus tile looks something like this:

r001

This is a simple PNG sized 77 x 38 created with GIMP. The trickier part is the letter and the animation. I want the bonus to be without the letter at the first frame and then frame by frame the letter should be revealed from top of the block so that it will look that it’s kind of rolling down. This means that the letter rendered on the tile should be transformed just a little bit “roundy” so that it would have an illusion of 3rd dimension.

To create the letters (by using GIMP):

  1. Create a new layer of the same size as the original layer (77 x 38 in my case). Have the background as white. This is needed because when mapping the layer we don’t want it to be transparent.
  2. By using the text tool create a letter of size 24 px (size 24 looks balanced in the tile) . I will be using letter M in this example.
  3. Rotate the layer 90 degrees clockwise (layer -> transform -> rotate). We need to do this because the GIMP map object filter cannot (at least I don’t know how) map layer to horizontally aligned cylinder aka pipe.
  4. Center the rotated layer by using the alignment tool.
  5. Merge letter layer to the white background layer of the same size as original.
  6. Take the filters -> map -> map object filter up.
  7. Options: map to cylinder, create new layer check box on, transparent background off, no light. In the orientation tab: set the Z rotation to -90 degrees. This now rotates the cylinder horizontally. Leave X and Y to 0 degrees. On the Cylinder tab: images can be what ever, we don’t use them. IMPORTANT: the radius of the cylinder should be a little bigger what your layer is, mine is 0,42 pixels I presume. Check the length so that the letter looks good. (for me 0,65)
  8. Try creating the new layer and check the result. It should look somewhat normal letter M with a little bit of “rounding”, that meaning it do not look completely flat. You can delete the layer and adjust the parameters and create new if it do not look good.
  9. When the letter looks good, you need to start creating the frames. This is done by adjusting the X rotation on the Orientation tab. Start from somewhere -100. It should rotate the letter almost hidden in the top only the bottom of the letter should be visible in the top. Most of the letter is hidden behind the camera and this is why we didn’t want the transparency.
  10. Hide the original layer of the rotated letter (this is done to prevent the export render it as part of the final image)
  11. Select the created frame with the letter just barely showing on the top and select colors -> color to alpha. And select white. If done correctly now the tile and letter should be aligned correctly and look something like this: r002
  12. Export the image in PNG format and name the image something you are comfortable with. I named all my images xxx001.png, xxx002.png and so on so that the numbering is the frame order. For me the first frame was the clear one.
  13. Now increment the X rotation by 10 degrees (this depends how many frames you want to have and how big steps the letter should be rolling). Hide the layers not needed and go to step 11.

In the end of the process you have something like 22 images / frames. The result should be something like this if exported as an animated GIF:

bonus_animated

 

When this is animated so that it moves along the Y axis it looks like it’s falling and rolling at the same time. In the next post I will explain how to use this in Unity. Until next time!