Changes between Version 2 and Version 3 of Basic3DImplementation


Ignore:
Timestamp:
Jun 17, 2012, 9:28:27 PM (12 years ago)
Author:
Pureon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Basic3DImplementation

    v2 v3  
    77[[BR]]Lets begin by creating an 'actor' xml file that will link our 3D model with the texture file and crucially make them visible in Atlas (0 A.D.'s Map/Scenario Editor).
    88
    9  * Navigate to the 'mods' folder in the game's installation directory: binaries\data\mods
     9 * '''STEP 1 -''' Navigate to the 'mods' folder in the game's installation directory: binaries\data\mods
    1010
    11  * In the mods folder you will have a 'public.zip' file that needs to be extracted into a folder also called 'public' within the 'mods' folder.
     11 * '''STEP 2 -''' In the mods folder you will have a 'public.zip' file that needs to be extracted into a folder also called 'public' within the 'mods' folder.
    1212
    13  * Once the public zip is extracted, navigate to the following folder: binaries\data\mods\public\art\actors\props\special\eyecandy
     13 * '''STEP 3 -''' Once the public zip is extracted, navigate to the following folder: binaries\data\mods\public\art\actors\props\special\eyecandy
    1414
    15  * Make a duplicate of the actor file called 'crate_a.xml' and call it 'crate_test.xml'
     15 * '''STEP 4 -''' Make a duplicate of the actor file called 'crate_a.xml' and call it 'crate_test.xml'
    1616
    17  * Open the 'crate_test.xml' file in Notepad ++ (or any code editor). You will see this:[[BR]]
     17 * '''STEP 5 -''' Open the 'crate_test.xml' file in Notepad ++ (or any code editor). You will see this:[[BR]]
    1818 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/actoropen.gif)]][[BR]]
    1919
    20  * We need to change the file locations for 'mesh' and 'texture' to these:[[BR]]
     20 * '''STEP 6 -''' We need to change the file locations for 'mesh' and 'texture' to these:[[BR]]
    2121 <mesh>props/wrld_crate_test.dae</mesh>[[BR]]
    2222 <texture>props/crate_test.png</texture>[[BR]]
     
    2424 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/actorchanged.gif)]][[BR]]
    2525
    26  * Save the file (as 'crate_test.xml') and close Notepad ++
     26 * '''STEP 7 -''' Save the file (as 'crate_test.xml') and close Notepad ++
    2727
    28 [[BR]]'''Texture creation'''
     28[[BR]][[BR]]'''Texture creation'''
    2929[[BR]]Here we will create a basic texture file so that we can skin it onto our model later.
    3030
    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.
     31 * '''STEP 1 -''' 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.
    3232
    33  * Download the texture and open it in Gimp.
     33 * '''STEP 2 -''' Download the texture and open it in Gimp.
    3434 
    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.
     35 * '''STEP 3 -''' 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.
    3636 
    3737 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]]
    3838 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/textureopened.gif)]][[BR]]
    3939 
    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]]
     40 * '''STEP 4 -''' 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]]
    4141 
    4242 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/texturescale.gif)]][[BR]]
    4343 Select 'Scale' button to perform the scale[[BR]]
    4444 
    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:
     45 * '''STEP 5 -''' 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:
    4646 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/texturecanvas.gif)]][[BR]]
    4747 
    4848 Select 'Resize' button to perform the resize to 128x128[[BR]]
    4949 
    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.
     50 * '''STEP 6 -''' 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.
    5151
    52  * Move the PNG file to the following location: binaries\data\mods\public\art\textures\skins\props
     52 * '''STEP 7 -''' Move the PNG file to the following location: binaries\data\mods\public\art\textures\skins\props
    5353
    5454 
    55 [[BR]]'''3D modeling'''
     55[[BR]][[BR]]'''3D modeling'''
    5656[[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
    5757
    58  * Open Blender (the latest version of Blender is always recommended)
     58 * '''STEP 1 -''' Open Blender (the latest version of Blender is always recommended)
    5959
    60  * We're going to use the cube that appears by default in Blenders 3D View window[[BR]]
     60 * '''STEP 2 -''' We're going to use the cube that appears by default in Blenders 3D View window[[BR]]
    6161 
    6262 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderstart.gif)]][[BR]]
     
    6666 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blendereditmode.gif)]][[BR]]
    6767 
    68  * Once in edit mode go to Mesh > UV Unwrap... > Unwrap[[BR]]
     68 * '''STEP 3 -''' Once in edit mode go to Mesh > UV Unwrap... > Unwrap[[BR]]
    6969 
    7070 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderuvunwrap.gif)]][[BR]]
    7171
    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]]
     72 * '''STEP 4 -''' 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]]
    7373 
    7474 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderexport.gif)]][[BR]]
    7575 
    76  * In the export window that opens up, select 'Export only selected'[[BR]]
     76 * '''STEP 5 -''' In the export window that opens up, select 'Export only selected'[[BR]]
    7777 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderselectedonly.gif)]][[BR]]
    7878 
    79  * Change the filename to wrld_crate_test.dae and then click 'Export COLLADA'[[BR]]
     79 * '''STEP 6 -''' Change the filename to wrld_crate_test.dae and then click 'Export COLLADA'[[BR]]
    8080 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blendersave.gif)]][[BR]]
    8181 
    82  * Move the DAE file to the following location: binaries\data\mods\public\art\meshes\props
     82 * '''STEP 7 -''' Move the DAE file to the following location: binaries\data\mods\public\art\meshes\props
    8383
    84 [[BR]]'''Viewing model in Atlas'''
     84[[BR]][[BR]]'''Viewing model in Atlas'''
    8585[[BR]]After saving the actor file, creating the texture, and exporting the 3D model, we can now open 0 A.D.'s Atlas Editor to view the crate in-game
    8686
    87  * Run 0 A.D. and in the menu select Tools & Options > Scenario Editor
     87 * '''STEP 1 -''' Run 0 A.D. and in the menu select Tools & Options > Scenario Editor[[BR]]
     88 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/scenarioeditor.gif)]][[BR]]
    8889
    89  * Open Atlas
    90 
    91  * In the Actors(all) list find props\special\eyecandy\crate_test.xml
     90 * '''STEP 2 -''' Select the 'Object' tab[[BR]]
     91 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasobject.gif)]][[BR]]
     92 
     93 * '''STEP 3 -''' Select Actors(All) in the dropdown to view actor objects instead of entities (that require additional templating)[[BR]]
     94 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasactorsallt.gif)]][[BR]]
     95 
     96 * '''STEP 4 -''' In the Filter field type 'crate_test' to find the actor file we created earlier[[BR]]
     97 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasfilter.gif)]][[BR]]
     98 
     99 * '''STEP 5 -''' Select the actor file in the list, and then click on 'Switch to Actor Viewer' to view the object in 'Actor Viewer'[[BR]]
     100 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasactorviewer.gif)]][[BR]]
     101 
     102 * '''STEP 6 -''' The finished object should look like this in Actor Viewer:[[BR]]
     103 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasfinal.gif)]][[BR]]