Changes between Version 1 and Version 2 of Basic3DImplementation


Ignore:
Timestamp:
Jun 15, 2012, 12:27:04 AM (12 years ago)
Author:
Pureon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Basic3DImplementation

    v1 v2  
    1 '''  0 A.D. basic 3D implementation guide'''  [[BR]] In this guide we will be using [http://www.blender.org/ Blender] to create the 3D model, [http://www.gimp.org/ GIMP] for textures, and [http://notepad-plus-plus.org/ Notepad++] for basic coding. All three of these programs are free and opensource, although other programs may be used to achieve similar results. You must also have an Alpha release of 0 A.D. installed on your computer. (SVN versions can also be used)
     1'''  0 A.D. basic 3D implementation guide'''  [[BR]] In this guide we will be using [http://www.blender.org/ Blender] to create the 3D model, [http://www.gimp.org/ GIMP] for textures, and [http://notepad-plus-plus.org/ Notepad++] for basic coding. All three of these programs are free and opensource, although other programs may be used to achieve similar results. You must also have an Alpha release of 0 A.D. installed on your computer. (SVN versions can be used too)
    22
    3 To keep things simple, we are going to create a simple crate.
     3To keep things simple, we are going to create a simple textured crate/box object.
    44
    55
     
    2020 * We need to change the file locations for 'mesh' and 'texture' to these:[[BR]]
    2121 <mesh>props/wrld_crate_test.dae</mesh>[[BR]]
    22  <texture>props/crate_test.png</texture>
     22 <texture>props/crate_test.png</texture>[[BR]]
     23 [[BR]]The code should now look like this:[[BR]]
     24 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/actorchanged.gif)]][[BR]]
    2325
    2426 * Save the file (as 'crate_test.xml') and close Notepad ++
     
    2729[[BR]]Here we will create a basic texture file so that we can skin it onto our model later.
    2830
    29  * First thing we need to do is find a texture we can use for 0 A.D. Remember our textures are released as [http://creativecommons.org/licenses/by-sa/3.0/ CC-BY-SA], so the texture you use must be compatible for it to be released. One of the websites we use is burningwell.org which has many public domain images. Search for 'wood' and I found [http://www.burningwell.org/gallery2/v/textures/buildings/fences/wood966.jpg.html this] texture
     31 * First thing we need to do is find a texture we can use for 0 A.D. Remember our textures are released as [http://creativecommons.org/licenses/by-sa/3.0/ CC-BY-SA], so the texture you use must be compatible with this license if you are planning for it to be released officially with the game. One of the websites we use to source textures is burningwell.org which is an online library of public domain images. Searching burningwell.org for the keyword 'wood' I found [http://www.burningwell.org/gallery2/v/textures/buildings/fences/wood966.jpg.html this] texture, which will work well for this quick example.
    3032
    31  * Download the texture and open it in Gimp. Most of our texture files are square, so we're going to crop the texture and resize it to be 128x128 pixels
     33 * Download the texture and open it in Gimp.
    3234 
    33  * Save PNG file called 'crate_test.png'
     35 * Most of our texture files are square ( [http://trac.wildfiregames.com/wiki/ArtDesignDocument#SkinsandTextures see here for more info] ), so first we're going to crop the texture to make it square.
     36 
     37 Open the texture file in Gimp by going to File > Open... and then selecting the image downloaded from burningwell.org. Once opened the editing window should look like this:[[BR]]
     38 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/textureopened.gif)]][[BR]]
     39 
     40 * Now we are going to resize the texture so that it is 128x128 pixels. To do this, go to Image > Scale Image and change the Height value to 128 pixels. Make sure the Height and Width dimensions are locked (this changes the width value to 171px) like in the image below:[[BR]]
     41 
     42 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/texturescale.gif)]][[BR]]
     43 Select 'Scale' button to perform the scale[[BR]]
     44 
     45 * We're now going to edit the canvas to make the texture 128x128. Go to Image > Canvas Size... and there change the Width to 128px. The Offset can also be set similar to how I've done it below:
     46 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/texturecanvas.gif)]][[BR]]
     47 
     48 Select 'Resize' button to perform the resize to 128x128[[BR]]
     49 
     50 * Now we're going to save a PNG file called 'crate_test.png'. Go to File > Export... and select the 'PNG image (*.png)' fileformat in the dropdown. Make the Name 'crate_test.png' and then select 'Export' to save the file. Make a note of where you saved the file for the next step.
    3451
    35  * Move PNG file to the following location: binaries\data\mods\public\art\textures\skins\props
     52 * Move the PNG file to the following location: binaries\data\mods\public\art\textures\skins\props
    3653
    3754 
     
    3956[[BR]]Here we will go through the basic requirements of creating a textured (UV Mapped) model and exporting it as a Collada DAE format 3D file
    4057
    41  * Open Blender
     58 * Open Blender (the latest version of Blender is always recommended)
    4259
    43  * Select cube
     60 * We're going to use the cube that appears by default in Blenders 3D View window[[BR]]
     61 
     62 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderstart.gif)]][[BR]]
     63 
     64 The first thing we're therefore going to do is change from  'Object Mode' to 'Edit Mode'[[BR]]
     65 
     66 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blendereditmode.gif)]][[BR]]
     67 
     68 * Once in edit mode go to Mesh > UV Unwrap... > Unwrap[[BR]]
     69 
     70 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderuvunwrap.gif)]][[BR]]
    4471
    45  * UV Map cube
    46 
    47  * Export as DAE
     72 * Surprisingly that's all we need to do in this very simple example. So now we can export the 3D model file by going back into 'Object Mode', selecting the cube, and going to File > Export > COLLADA (.dae)[[BR]]
     73 
     74 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderexport.gif)]][[BR]]
     75 
     76 * In the export window that opens up, select 'Export only selected'[[BR]]
     77 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderselectedonly.gif)]][[BR]]
     78 
     79 * Change the filename to wrld_crate_test.dae and then click 'Export COLLADA'[[BR]]
     80 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blendersave.gif)]][[BR]]
    4881 
    4982 * Move the DAE file to the following location: binaries\data\mods\public\art\meshes\props