 |
 |
 |
|
Project navigation
Documents
Old stuff
|
|
 |
 |
 |
|
 |
 |
 |
|
Main.RenderingGraphics History
Hide minor edits - Show changes to markup
December 28, 2009, at 11:24 AM
by Stedevil -- Small update to atlas generation (formating and debian packages)
Changed lines 150-156 from:
The second step is to integrate the new tile into the texture atlas for floor tiles. The game currently requires the floor tiles to be in the atlas, we are aware that this is annoying. You only need to recompute the atlas the first time you add a given file, and every time its dimensions change (with the Inkscape method, this is never the case).
To recompute the atlas, go into graphics/floor_tiles/. Make sure you have pil (python imaging library) installed, and, if you are on x86, psyco (a JIT compiler for python that will speed up computations). Type ../make_atlas.py "*.png" atlas.txt, and wait. It can take as long as ten minutes on a 600MHz CPU.
to:
The second step is to integrate the new tile into the texture atlas for floor tiles. The game currently requires the floor tiles to be in the atlas, we are aware that this is annoying. You only need to recompute the atlas the first time you add a given file, and every time its dimensions change (with the Inkscape method, this is never the case). To recompute the atlas:
1) Go into graphics/floor_tiles/ 2) Make sure you have pil (python imaging library) installed, and, if you are on x86, psyco (a JIT compiler for python that will speed up computations). On Debian based systems: sudo apt-get install python-imaging python-psyco 3) Type ../make_atlas.py "*.png" atlas.txt And wait. It can take as long as ten minutes on a 600MHz CPU.
December 28, 2009, at 10:05 AM
by ahuillet -- document integration of floor tiles
Added lines 130-131:
DO NOT USE THIS TECHNIQUE, BUT USE INKSCAPE! NOT DESCRIBED YET
Changed lines 148-157 from:
TODO!!!
to:
Once you have the PNG file for your new tile, you have to make an offset file for it. The offset specifies the position of the center of the tile in the image. If you followed the Inkscape procedure, simply copy the 0023.offset file to <yourtile>.offset.
The second step is to integrate the new tile into the texture atlas for floor tiles. The game currently requires the floor tiles to be in the atlas, we are aware that this is annoying. You only need to recompute the atlas the first time you add a given file, and every time its dimensions change (with the Inkscape method, this is never the case).
To recompute the atlas, go into graphics/floor_tiles/. Make sure you have pil (python imaging library) installed, and, if you are on x86, psyco (a JIT compiler for python that will speed up computations). Type ../make_atlas.py "*.png" atlas.txt, and wait. It can take as long as ten minutes on a 600MHz CPU.
Then, you have to integrate the floor tile in the sourcecode.
To do this, open up defs.h, vars.h, and lvledit/lvledit.h. In defs.h, grep for ALL_ISOMETRIC_FLOOR_TILES, and add the symbolic name of your floor tile right above it. In lvledit/lvledit.h, look for grep for floor_tiles_list, and add the symbolic name wherever you like (not necessarily last).
In vars.h, grep for floor_tile_filenames, and add the filename of your tile at the end.
Rebuild the game, start the level editor, go to the FLOOR panel, you have your tile ready for use.
December 13, 2009, at 12:16 PM
by 127.0.0.1 --
Changed line 138 from:
Set LocX to -2.828, LocY to -2.828, LocZ to 4, all Scale parameters to 1.0, RotX to 60, RotY to 0, RotZ to 45.
to:
Set LocX to -2.828, LocY to -2.828, LocZ to 4, all Scale parameters to 1.0, RotX to 60, RotY to 0, RotZ to -45.
December 13, 2009, at 12:12 PM
by 127.0.0.1 -- add information about floor tiles
Added lines 4-8:
In this page, you will learn how to:
- Make items
- Make obstacles (map elements)
- Make floor tiles
Added lines 121-146:
Making floor tiles
Drawing the texture
Using your favorite drawing tool, prepare a good quality texture to use. Recommended size is 100x100 or more. The texture must tile: this means that if you repeat your texture, by sticking it next to itself, the transition must not be seen. Textures that don't tile will lead to floor tiles that cannot be accepted into FreedroidRPG?.
Rendering the floor tile
Open up blender, make a new scene. Delete the default cube (press X) and create an horizontal plane (SPACE -> add -> mesh -> plane).
Select your plane (right click on it), and go into the shading panel (F5). Click "add new" to add a material - a bunch of new options appear. You will see R G and B sliders, and below, a A slider. Pull that A slider to 0.
Go into the texture panel (F6), click add new to create a texture, and select "image" in the texture type list. At the right of the panel, click "load" and select the texture you made in the previous step.
Go back to the shading panel, at the very right click " MapTo?" tab, and click Alpha (once).
Set up the camera by selecting it and pressing the N key.
Set LocX to -2.828, LocY to -2.828, LocZ to 4, all Scale parameters to 1.0, RotX to 60, RotY to 0, RotZ to 45.
With the camera still selected, go into the "edit" panel (F9), and click the "Orthographic" button. The camera must use a scale of 7.31.
Go into the shading panel (F5), you will see a World list - click on the cross next to it to delete it.
In the scene screen (F10), select PNG format, RGBA mode, width 200 height 240.
Hit F12 to check that your plane renders well, and if everything is fine hit ANIM to render your floor tile to a file.
Integrating the floor tile into the game
TODO!!!
January 24, 2009, at 11:40 AM
by ahuillet -- more info on adding obstacles
Changed lines 93-97 from:
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.
to:
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
Added line 99:
Changed lines 101-115 from:
Now in the "scene" (F10) screen, select png format, RGBA, the right size (TODO), do the animation stuff for 4 frames so you take the four angles, render, use croppy (TODO).
to:
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.
December 16, 2008, at 08:10 AM
by ahuillet --
Changed lines 1-2 from:
This page describes how you can render graphics within blender for use in FreedroidRPG.
to:
'''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.'''
December 16, 2008, at 08:04 AM
by ahuillet -- formatting
Changed line 1 from:
This page describes how you can render graphics within blender for use in FreedroidRPG?.
to:
This page describes how you can render graphics within blender for use in FreedroidRPG.
Changed line 3 from:
Rendering an item :
to:
Rendering an item
Changed line 10 from:
A)
to:
Inventory image
Changed line 24 from:
transparency, and we need it in freedroidRPG).
to:
transparency, and we need it in freedroidRPG).
Changed line 32 from:
B)
to:
Ground image
Changed lines 43-44 from:
C)
The little video/animation seen in the shop is where the work really
to:
Shop animation
The little animation seen in the shop is where the work really
Changed line 90 from:
Rendering an obstacle :
to:
Rendering an obstacle
Changed line 93 from:
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 parameterst 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.
to:
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.
December 16, 2008, at 07:58 AM
by ahuillet -- first import
Changed lines 1-95 from:
to:
This page describes how you can render graphics within blender for use in FreedroidRPG?.
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.
A)
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.
B)
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.
C)
The little video/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.
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 parameterst 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.
Now in the "scene" (F10) screen, select png format, RGBA, the right size (TODO), do the animation stuff for 4 frames so you take the four angles, render, use croppy (TODO).
| |
 |
 |
 |
|