Changes between Version 2 and Version 3 of Basic3DImplementation
- Timestamp:
- Jun 17, 2012, 9:28:27 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Basic3DImplementation
v2 v3 7 7 [[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). 8 8 9 * Navigate to the 'mods' folder in the game's installation directory: binaries\data\mods9 * '''STEP 1 -''' Navigate to the 'mods' folder in the game's installation directory: binaries\data\mods 10 10 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. 12 12 13 * Once the public zip is extracted, navigate to the following folder: binaries\data\mods\public\art\actors\props\special\eyecandy13 * '''STEP 3 -''' Once the public zip is extracted, navigate to the following folder: binaries\data\mods\public\art\actors\props\special\eyecandy 14 14 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' 16 16 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]] 18 18 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/actoropen.gif)]][[BR]] 19 19 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]] 21 21 <mesh>props/wrld_crate_test.dae</mesh>[[BR]] 22 22 <texture>props/crate_test.png</texture>[[BR]] … … 24 24 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/actorchanged.gif)]][[BR]] 25 25 26 * Save the file (as 'crate_test.xml') and close Notepad ++26 * '''STEP 7 -''' Save the file (as 'crate_test.xml') and close Notepad ++ 27 27 28 [[BR]] '''Texture creation'''28 [[BR]][[BR]]'''Texture creation''' 29 29 [[BR]]Here we will create a basic texture file so that we can skin it onto our model later. 30 30 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. 32 32 33 * Download the texture and open it in Gimp.33 * '''STEP 2 -''' Download the texture and open it in Gimp. 34 34 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. 36 36 37 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 38 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/textureopened.gif)]][[BR]] 39 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]]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]] 41 41 42 42 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/texturescale.gif)]][[BR]] 43 43 Select 'Scale' button to perform the scale[[BR]] 44 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: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: 46 46 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/texturecanvas.gif)]][[BR]] 47 47 48 48 Select 'Resize' button to perform the resize to 128x128[[BR]] 49 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.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. 51 51 52 * Move the PNG file to the following location: binaries\data\mods\public\art\textures\skins\props52 * '''STEP 7 -''' Move the PNG file to the following location: binaries\data\mods\public\art\textures\skins\props 53 53 54 54 55 [[BR]] '''3D modeling'''55 [[BR]][[BR]]'''3D modeling''' 56 56 [[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 57 57 58 * Open Blender (the latest version of Blender is always recommended)58 * '''STEP 1 -''' Open Blender (the latest version of Blender is always recommended) 59 59 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]] 61 61 62 62 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderstart.gif)]][[BR]] … … 66 66 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blendereditmode.gif)]][[BR]] 67 67 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]] 69 69 70 70 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderuvunwrap.gif)]][[BR]] 71 71 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]] 73 73 74 74 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderexport.gif)]][[BR]] 75 75 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]] 77 77 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderselectedonly.gif)]][[BR]] 78 78 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]] 80 80 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blendersave.gif)]][[BR]] 81 81 82 * Move the DAE file to the following location: binaries\data\mods\public\art\meshes\props82 * '''STEP 7 -''' Move the DAE file to the following location: binaries\data\mods\public\art\meshes\props 83 83 84 [[BR]] '''Viewing model in Atlas'''84 [[BR]][[BR]]'''Viewing model in Atlas''' 85 85 [[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 86 86 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]] 88 89 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]]