Storyline, Quests, Ideas, Dialogs -manager
SearchWiki:

Project navigation

Documents

ToDo

Old stuff

PmWiki

Recent Changes Printable View Page History Edit Page
'''This page describes how you can render graphics within blender for use in FreedroidRPG. It does not cover the basics of blender, and is a bit incomplete. Feel free to help improve it.'''

Rendering an item

Open up blender and load the model. There are three type of things to render : the inventory image, the on-the-ground image, and the little rotational video. We will do things in this order.

Inventory image

As far as the inventory image is concerned, the only important thing is to pay attention to the size of your final image. The game by default uses 32x32 pixels per inventory square in game. However, creating small images only eg 32x32 or 32x64 in total size severly hampers flexibility later on for eg balancing the items size, without the image becoming ugly. So using a higher quality image eg 96 or 128px is usually an advantage.

So, place the camera the way you wish, go to the "scene" (F10) screen, and tell blender to save to inv_image.png. Don't forget to tell blender to use the PNG file format, as JPG is often the default. You can set the image size here too. Last thing to pay attention to is the actual format : you can pick between BW, RGB and RGBA. Choose RGBA (alpha means transparency, and we need it in freedroidRPG). Now we will do the rendering to the file : set "start" and "end" to 1, so you render only one frame, and hit the "anim" button. Display your inv_image.png, check that it looks good (including in game).

//we might need to explain more in detail HOW to test it "in game", possibly at the end of the tutorial.

Ground image

As far as the on-the-ground image is concerned, you have to rotate the camera and generate the image as you wish. Size is up to you. Render it in RGBA PNG, save it as ingame.png. Now is time for the offsets. Copy ingame.offset from another item and edit the values till things look good in the game.

// Not sure "size is up to you" is a good thing. Something like "resonable size compaired to other items in the game" is probably better, or we might end up with a knif the size of a house.

Shop animation

The little animation seen in the shop is where the work really starts. We will create something called an armature, tie our object to this armature, then make the armature rotate over several frames. First of all, in the 3D view, you have this red and white circle that you can move by clicking with the left mouse button. You need to place it in the center (on the rotation axis you wish to use). Do this (don't forget to rotate your 3D view by 90° after clicking once to make sure the circle really ends up in the center of the object and not two meters away on the one axis you cannot see). Hit space, "add -> armature". Here is your armature ! If it is too small compared to the object, press 's' and resize it so you see it well. Do not worry, the armature does not appear on the final render. Now, right click on your object (if it's made of several parts you need to select them all, otherwise only the selected ones will rotate). Then hold SHIFT and right click on the armature. Your object should appear in "dark" pink while the armature is brighter. Press CTRL+P. A window "make parent to" appears. Click "armature". Blender then asks you to create vertex groups - click on create from envelopes or bone heat, it's not like I understand the difference anyway :)

At this point, the object is tied to the armature. Now, split your window (move the cursor right below the top menu, it changes shape to a "resize" cursor - middle click, select "split area", split it). On the left, select the IPO curve mode, and on the right, keep the 3D view. In this 3D view, hit CTRL+SPACE, select rotate. Now you will see three circles around your currently selected armature. Clicking on one of them will start a rotation. On the bottom window you have a little selector for the current frame. It most likely is set to 1 for now - leave it as such. Select Sta: 1 and End: 32 for your animation, PNG, RGBA format, and pick up the right size (TODO). Now, back to the 3d window, select the armature, press "i" - a "insert key" menu appears. Select "rotate". Change the current frame to 8. Click on the circle that corresponds to the way you wish to rotate the object, then type 90 and hit ENTER. The object will be rotated by 90 degrees. Hit "i" and insert a "rotate" key again. Repeat this for frames 16 and 32. In the IPO curve window you now see an actual curve that is the result of the interpolation carried out by blender, for the values of the rotation. You can hold left mouse button and move horizontally in the IPO curve window to see your animation. Now is time to render - hit "ANIM" button, enjoy.

Rendering an obstacle

Rendering an obstacle is fairly similar to rendering the video for the item. However, size of the image - and the surface actually covered by the obstacle - matter a lot, and camera position is of tremendous importance.

We assume you have your model done and ready for rendering.

Camera setup

The projection used on the rendering is isometric. Read up on this if you wish - what you will have to do is to change the camera mode to orthographic, and place it correctly on the field. To do this, select the camera by right clicking on it. Press the "N" key to bring up the transform properties window. Set LocX to 1.5, LocY to -1.5, LocZ to 4, all Scale parameters to 1.0, RotX to 60, RotY to 0, RotZ to 45. Hit "F12" to check the positionning of the camera, move the object if necessary.

Bring up the "editing" panel by pressing F9. Select the camera, and look on the editing screen: click the "orthographic" button so it is enabled, and then choose the scale value so the result has the size you wish to give it. 7.35 is a good default value.

Scene setup

Now in the "scene" (F10) screen, select PNG format, RGBA, size 200x240. Do the animation stuff for 4 frames so you get the four angles (see above). Hit the ANIM button.

Cropping

The first step is to properly crop the image, and generate its offset file so it appears at its actual position in game. We have a tool called croppy that does this. cd into croppy/, then run croppy -i the_png_file.png for each of the files. It will automatically generate offset files that may need a bit of tweaking afterwards but should be mostly OK.

Integration into the game

Open up src/defs.h, look for NUMBER_OF_OBSTACLE_TYPES. Right above this line, add the symbolic names for your new object (four of them, one per angle). Now open up src/blocks.c, scroll to where obstacle descriptions are defined. Copy paste and set the values for your new obstacle. Start the game, go into level editor on the "ALL" tab, scroll till the end, place your objects.

Edit Page - Page History - Printable View - Recent Changes - WikiHelp - SearchWiki
Page last modified on January 24, 2009, at 11:40 AM