Changes between Version 4 and Version 5 of Basic3DImplementation
- Timestamp:
- Jul 1, 2012, 4:07:42 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Basic3DImplementation
v4 v5 10 10 == Actor file setup == 11 11 12 [[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.'sMap/Scenario Editor).12 [[BR]]Lets begin by creating an [wiki:Actors actor] XML file that will link our 3D model with the texture file and crucially make them visible in [wiki:Atlas_Manual Atlas] (0 A.D.'s !Map/Scenario Editor). 13 13 14 * '''STEP 1 -''' Navigate to the 'mods' folder in the game's installation directory: binaries\data\mods14 * '''STEP 1 -''' Navigate to the 'mods' folder in the game's installation directory: `binaries\data\mods` (see [wiki:Mod_Layout mod layout] for details) 15 15 16 16 * '''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. 17 17 18 * '''STEP 3 -''' Once the public zip is extracted, navigate to the following folder: binaries\data\mods\public\art\actors\props\special\eyecandy18 * '''STEP 3 -''' Once the public zip is extracted, navigate to the following folder: `binaries\data\mods\public\art\actors\props\special\eyecandy` 19 19 20 20 * '''STEP 4 -''' Make a duplicate of the actor file called 'crate_a.xml' and call it 'crate_test.xml' 21 21 22 22 * '''STEP 5 -''' Open the 'crate_test.xml' file in Notepad ++ (or any code editor). You will see this:[[BR]] 23 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/actoropen.gif)]][[BR]] 24 (Ignore the colored highlighted areas in this screenshot, that happens by default in Notepad++)[[BR]] 23 {{{ 24 #!xml 25 <?xml version="1.0" encoding="UTF-8" standalone="no" ?> 26 <actor version="1"> 27 28 <castshadow/> 29 30 <group> 31 <variant frequency="100" name="Base"> 32 <mesh>props/wrld_crate_a.dae</mesh> 33 <texture>props/celt_prop_1.dds</texture> 34 </variant> 35 </group> 36 37 </actor> 38 }}} 25 39 26 40 * '''STEP 6 -''' We need to change the file locations for 'mesh' and 'texture' to these:[[BR]] 27 <mesh>props/wrld_crate_test.dae</mesh>[[BR]]28 <texture>props/crate_test.png</texture>[[BR]]41 `<mesh>props/wrld_crate_test.dae</mesh>`[[BR]] 42 `<texture>props/crate_test.png</texture>`[[BR]] 29 43 [[BR]]The code should now look like this:[[BR]] 30 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/actorchanged.gif)]][[BR]] 44 {{{ 45 #!xml 46 <?xml version="1.0" encoding="UTF-8" standalone="no" ?> 47 <actor version="1"> 48 49 <castshadow/> 50 51 <group> 52 <variant frequency="100" name="Base"> 53 <mesh>props/wrld_crate_test.dae</mesh> 54 <texture>props/crate_test.png</texture> 55 </variant> 56 </group> 57 58 </actor> 59 }}} 31 60 32 61 * '''STEP 7 -''' Save the file (as 'crate_test.xml') and close Notepad ++ … … 44 73 45 74 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]] 75 46 76 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/textureopened.gif)]][[BR]] 47 77 48 * '''STEP 4 -''' Now we are going to resize the texture so that it is 128x128 pixels. To do this, go to Image > Scale Imageand 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]]78 * '''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]] 49 79 50 80 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/texturescale.gif)]][[BR]] 51 81 Select 'Scale' button to perform the scale[[BR]] 52 82 53 * '''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: 83 * '''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:[[BR]] 84 54 85 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/texturecanvas.gif)]][[BR]] 55 86 56 87 Select 'Resize' button to perform the resize to 128x128[[BR]] 57 88 58 * '''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.89 * '''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. 59 90 60 * '''STEP 7 -''' Move the PNG file to the following location: binaries\data\mods\public\art\textures\skins\props91 * '''STEP 7 -''' Move the PNG file to the following location: `binaries\data\mods\public\art\textures\skins\props` (see [wiki:Mod_Layout mod layout] for details) 61 92 62 93 … … 68 99 * '''STEP 1 -''' Open Blender (the latest version of Blender is always recommended) 69 100 70 * '''STEP 2 -''' We're going to use the cube that appears by default in Blenders 3D View window [[BR]]101 * '''STEP 2 -''' We're going to use the cube that appears by default in Blenders 3D View window:[[BR]] 71 102 72 103 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderstart.gif)]][[BR]] 73 104 74 The first thing we're therefore going to do is change from 'Object Mode' to 'Edit Mode' [[BR]]105 The first thing we're therefore going to do is change from 'Object Mode' to 'Edit Mode':[[BR]] 75 106 76 107 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blendereditmode.gif)]][[BR]] 77 108 78 * '''STEP 3 -''' Once in edit mode go to Mesh > UV Unwrap... > Unwrap[[BR]]109 * '''STEP 3 -''' Once in edit mode go to '''Mesh > UV Unwrap... > Unwrap''':[[BR]] 79 110 80 111 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderuvunwrap.gif)]][[BR]] 81 112 82 * '''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]]113 * '''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]] 83 114 84 115 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderexport.gif)]][[BR]] 85 116 86 * '''STEP 5 -''' In the export window that opens up, select 'Export only selected'[[BR]] 117 * '''STEP 5 -''' In the export window that opens up, select 'Export only selected':[[BR]] 118 87 119 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blenderselectedonly.gif)]][[BR]] 88 120 89 * '''STEP 6 -''' Change the filename to wrld_crate_test.dae and then click 'Export COLLADA'[[BR]] 121 * '''STEP 6 -''' Change the filename to wrld_crate_test.dae and then click 'Export COLLADA':[[BR]] 122 90 123 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/blendersave.gif)]][[BR]] 91 124 92 * '''STEP 7 -''' Move the DAE file to the following location: binaries\data\mods\public\art\meshes\props125 * '''STEP 7 -''' Move the DAE file to the following location: `binaries\data\mods\public\art\meshes\props` (see [wiki:Mod_Layout mod layout] for details) 93 126 94 127 [[BR]] 95 128 == Viewing model in Atlas == 96 129 97 [[BR]]After saving the actor file, creating the texture, and exporting the 3D model, we can now open 0 A.D.'s Atlas Editorto view the crate in-game130 [[BR]]After saving the actor file, creating the texture, and exporting the 3D model, we can now open 0 A.D.'s [wiki:Atlas_Manual Atlas Editor] to view the crate in-game 98 131 99 * '''STEP 1 -''' Run 0 A.D. and in the menu select Tools & Options > Scenario Editor[[BR]] 132 * '''STEP 1 -''' Run 0 A.D. and in the menu select '''Tools & Options > Scenario Editor''':[[BR]] 133 100 134 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/scenarioeditor.gif)]][[BR]] 101 135 102 * '''STEP 2 -''' Select the 'Object' tab[[BR]] 136 * '''STEP 2 -''' Select the [wiki:Atlas_Manual_Object_Tab Object tab]:[[BR]] 137 103 138 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasobject.gif)]][[BR]] 104 139 105 * '''STEP 3 -''' Select Actors(All) in the dropdown to view actor objects instead of entities (that require additional templating)[[BR]] 140 * '''STEP 3 -''' Select Actors(All) in the dropdown to view actor objects instead of [wiki:Entity entities] (that requires additional templating):[[BR]] 141 106 142 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasactorsallt.gif)]][[BR]] 107 143 108 * '''STEP 4 -''' In the Filter field type 'crate_test' to find the actor file we created earlier[[BR]] 144 * '''STEP 4 -''' In the Filter field type 'crate_test' to find the actor file we created earlier:[[BR]] 145 109 146 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasfilter.gif)]][[BR]] 110 147 111 * '''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]] 148 * '''STEP 5 -''' Select the actor file in the list, and then click on 'Switch to Actor Viewer' to view the object in [wiki:Atlas_Manual_Object_Tab#TheActorViewer Actor Viewer]:[[BR]] 149 112 150 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasactorviewer.gif)]][[BR]] 113 151 114 152 * '''STEP 6 -''' The finished object should look like this in Actor Viewer:[[BR]] 153 115 154 [[Image(http://i173.photobucket.com/albums/w73/purepics/0AD/atlasfinal.gif)]][[BR]]