Changes between Version 10 and Version 11 of Basic3DImplementation


Ignore:
Timestamp:
Mar 14, 2021, 9:26:21 AM (16 months ago)
Author:
Langbart
Comment:

added the link for burningwell

Legend:

Unmodified
Added
Removed
Modified
  • Basic3DImplementation

    v10 v11  
     1= 0 A.D. Basic Model Importing Guide =
     2[[TOC]] In this tutorial we are going to create a simple, non-animated, textured crate/box object to demonstrate the process of importing a basic model into 0 A.D. This example can be extended to work with more complex models and animated objects.
    13
    2 = 0 A.D. Basic Model Importing Guide =
    3 [[TOC]]
    4 In this tutorial we are going to create a simple, non-animated, textured crate/box object to demonstrate the process of importing a basic model into 0 A.D. This example can be extended to work with more complex models and animated objects.
    5 
    6 Your final result will look something like this:[[BR]][[BR]]
    7 [[Image(atlasfinal.gif)]]
     4Your final result will look something like this:[[BR]][[BR]] [[Image(atlasfinal.gif)]]
    85
    96== Requirements ==
     7This guide specifically uses the following free, open-source software:
    108
    11 This guide specifically uses the following free, open-source software:
    129 * [http://www.blender.org/ Blender] - to create the 3D model and UV mapping. Any version should work but the layout described on this tutorial is from version 2.6x. Other 3D modelling software supporting DAE/COLLADA export might work, too.
    1310 * [http://www.gimp.org/ GIMP] - to create the model's texture. Again any version will work but this tutorial uses 2.8.x. Other image editing software will work, the main feature required is saving PNG images.
     
    1613You must also have an Alpha release of 0 A.D. installed on your computer, or you can use the SVN development version.
    1714
    18 [[BR]]
    1915== Actor file setup ==
    20 
    21 [[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).
    22 '''Note:''' this process can also be accomplished with the the GUI-based [wiki:Actor_Editor actor editor] tool.
     16[[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). '''Note:''' this process can also be accomplished with the the GUI-based [wiki:Actor_Editor actor editor] tool.
    2317
    2418 * '''STEP 1 -''' Navigate to the 'mods' folder in the game's installation directory: `binaries\data\mods` (see [wiki:Mod_Layout mod layout] for details)
     
    4842}}}
    4943
    50  * '''STEP 6 -''' We need to change the file locations for the mesh and texture to these:[[BR]]
    51  mesh: `props/wrld_crate_test.dae`[[BR]]
    52  texture: `props/crate_test.png`[[BR]]
    53  [[BR]]The code should now look like this:[[BR]]
     44 * '''STEP 6 -''' We need to change the file locations for the mesh and texture to these:[[BR]] mesh: `props/wrld_crate_test.dae`[[BR]] texture: `props/crate_test.png`[[BR]] [[BR]]The code should now look like this:[[BR]]
    5445{{{
    5546#!xml
     
    7162 * '''STEP 7 -''' Save the file (as 'crate_test.xml') and close Notepad ++
    7263
    73 [[BR]]
    7464== Texture creation ==
    75 
    7665[[BR]]Here we will create a basic texture file so that we can skin it onto our model later.
    7766
    78  * '''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.
     67 * '''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 [http://www.burningwell.org/ 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.
    7968
    80  * '''STEP 2 -''' Download the texture and open it in Gimp. 
    81  
     69 * '''STEP 2 -''' Download the texture and open it in Gimp.
     70
    8271 * '''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.
    83  
    84  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]]
    8572
    86  [[Image(textureopened.gif)]][[BR]]
    87  
     73  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]]
     74
     75  [[Image(textureopened.gif)]] [[BR]]
     76
    8877 * '''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]]
    89  
    90  [[Image(texturescale.gif)]][[BR]]
    91  Select 'Scale' button to perform the scale[[BR]]
    92  
     78
     79  [[Image(texturescale.gif)]] [[BR]] Select 'Scale' button to perform the scale[[BR]]
     80
    9381 * '''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]]
    9482
    95  [[Image(texturecanvas.gif)]][[BR]]
    96  
    97  Select 'Resize' button to perform the resize to 128x128[[BR]]
    98  
     83  [[Image(texturecanvas.gif)]] [[BR]]
     84
     85  Select 'Resize' button to perform the resize to 128x128[[BR]]
     86
    9987 * '''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.
    10088
    10189 * '''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)
    10290
    103  
    104 [[BR]]
    10591== 3D modeling ==
    106 
    10792[[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
    10893
     
    11095
    11196 * '''STEP 2 -''' We're going to use the cube that appears by default in Blenders 3D View window:[[BR]]
    112  
    113  [[Image(blenderstart.gif)]][[BR]]
    114  
    115  The first thing we're therefore going to do is change from  'Object Mode' to 'Edit Mode':[[BR]]
    116  
    117  [[Image(blendereditmode.gif)]][[BR]]
    118  
     97
     98  [[Image(blenderstart.gif)]] [[BR]]
     99
     100  The first thing we're therefore going to do is change from  'Object Mode' to 'Edit Mode':[[BR]]
     101
     102  [[Image(blendereditmode.gif)]] [[BR]]
     103
    119104 * '''STEP 3 -''' Once in edit mode go to '''Mesh > UV Unwrap... > Unwrap''':[[BR]]
    120  
    121  [[Image(blenderuvunwrap.gif)]][[BR]]
     105
     106  [[Image(blenderuvunwrap.gif)]] [[BR]]
    122107
    123108 * '''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]]
    124  
    125  [[Image(blenderexport.gif)]][[BR]]
    126  
     109
     110  [[Image(blenderexport.gif)]] [[BR]]
     111
    127112 * '''STEP 5 -''' In the export window that opens up, select 'Export only selected':[[BR]]
    128113
    129  [[Image(blenderselectedonly.gif)]][[BR]]
    130  
     114  [[Image(blenderselectedonly.gif)]] [[BR]]
     115
    131116 * '''STEP 6 -''' Change the filename to wrld_crate_test.dae and then click 'Export COLLADA':[[BR]]
    132117
    133  [[Image(blendersave.gif)]][[BR]]
    134  
     118  [[Image(blendersave.gif)]] [[BR]]
     119
    135120 * '''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)
    136121
    137 [[BR]]
    138122== Viewing the model in Atlas ==
    139 
    140123[[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
    141124
    142125 * '''STEP 1 -''' Run 0 A.D. and in the menu select '''Tools & Options > Scenario Editor''':[[BR]]
    143126
    144  [[Image(scenarioeditor.gif)]][[BR]]
     127  [[Image(scenarioeditor.gif)]] [[BR]]
    145128
    146129 * '''STEP 2 -''' Select the [wiki:Atlas_Manual_Object_Tab Object tab]:[[BR]]
    147130
    148  [[Image(atlasobject.gif)]][[BR]]
    149  
     131  [[Image(atlasobject.gif)]] [[BR]]
     132
    150133 * '''STEP 3 -''' Select Actors(All) in the dropdown to view actor objects instead of [wiki:Entity entities] (that requires additional templating):[[BR]]
    151134
    152  [[Image(atlasactorsallt.gif)]][[BR]]
    153  
     135  [[Image(atlasactorsallt.gif)]] [[BR]]
     136
    154137 * '''STEP 4 -''' In the Filter field type 'crate_test' to find the actor file we created earlier:[[BR]]
    155138
    156  [[Image(atlasfilter.gif)]][[BR]]
    157  
     139  [[Image(atlasfilter.gif)]] [[BR]]
     140
    158141 * '''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]]
    159142
    160  [[Image(atlasactorviewer.gif)]][[BR]]
    161  
     143  [[Image(atlasactorviewer.gif)]] [[BR]]
     144
    162145 * '''STEP 6 -''' The finished object should look like this in Actor Viewer:[[BR]]
    163146
    164  [[Image(atlasfinal.gif)]][[BR]]
     147  [[Image(atlasfinal.gif)]] [[BR]]
    165148
    166149== Common Exporting Errors ==