3DModels:AssimpWorkflow: Difference between revisions

From Spring
Jump to navigationJump to search
Maddox (talk | contribs)
Adding ASSIMP Workflow page
 
Maddox (talk | contribs)
Line 2: Line 2:


This Workflow is provided for a standard 3D Modeling package using the Z = forward, Y = upwards convention, like Maya, Modo or Lightwave. You can also use Blender for ASSIMP, but it won't be covered here.
This Workflow is provided for a standard 3D Modeling package using the Z = forward, Y = upwards convention, like Maya, Modo or Lightwave. You can also use Blender for ASSIMP, but it won't be covered here.
Install the DDS export/import plugin. If you have an older Photoshop, you can use nVidia's older 32-bit release. If you use a newer Photoshop (tested on CC.2017) make sure you download this amazing open source plugin here: http://fnordware.blogspot.com.br/2014/09/dds-plug-in-for-after-effects-and.html


I. In the 3D Modeling Package:
I. In the 3D Modeling Package:
-> Create your models as usual and export to DAE, after making sure all separate pieces share a single UV set. There shouldn't be more than one UV set in the file. All packages have a way to merge multiple UV sets as needed, bear in mind that in some of them you need to combine all objects first.
* Create your models as usual and export to DAE, after making sure all separate pieces share a single UV set. There shouldn't be more than one UV set in the file. All packages have a way to merge multiple UV sets as needed, bear in mind that in some of them you need to combine all objects first.


II. In Photoshop:
II. In Photoshop:


1. With the main (diffuse) texture opened, select the areas of the UV you want to have team color on. Select > Save Selection, click ok. A new 'Alpha 1' channel will be created and accessible from Photoshop's 'Channels' panel, usually docked as a tab next to 'Layers'.
# Install the DDS export/import plugin. If you have an older Photoshop, you can use nVidia's older 32-bit release. If you use a newer Photoshop (tested on CC.2017) make sure you download this amazing open source plugin [http://fnordware.blogspot.com.br/2014/09/dds-plug-in-for-after-effects-and.html here]
 
# With the main (diffuse) texture opened, select the areas of the UV you want to have team color on. Select > Save Selection, click ok. A new 'Alpha 1' channel will be created and accessible from Photoshop's 'Channels' panel, usually docked as a tab next to 'Layers'.
2. Use 'Levels' (Ctrl+L) to make sure you have no pure black or white in the Alpha Channel. First select the Alpha Channel from the Channels tab of the Layer panel. In the 'Output Levels' box (at the bottom) set the left field to 5 and the right field to 250.
# Use 'Levels' (Ctrl+L) to make sure you have no pure black or white in the Alpha Channel. First select the Alpha Channel from the Channels tab of the Layer panel. In the 'Output Levels' box (at the bottom) set the left field to 5 and the right field to 250.
 
# Click 'Save As', select DDS file format. Make sure to keep 'Alpha Channels' selected
3. Click 'Save As', select DDS file format. Make sure to keep 'Alpha Channels' selected
# In the 'DDS Options' panel, select Format 'DXT5' (for main/team texture), keep 'Mipmap' and the Alpha Channel enabled (usually 'Alpha 1'). No need to mess with anything else, defaults are fine.
 
4. In the 'DDS Options' panel, select Format 'DXT5' (for main/team texture), keep 'Mipmap' and the Alpha Channel enabled (usually 'Alpha 1'). No need to mess with anything else, defaults are fine.


III. In Spring:
III. In Spring:


1. Place your spanking new DDS texture in the '\unittextures' folder of your game/mod
# Place your spanking new DDS texture in the '\unittextures' folder of your game/mod
2. In your unit's .lua file (the UnitDef one), set object = "3dmeshname.dae", replacing the filename with your own model name of course. You need to add the .dae extension for Spring to load this file instead of searching for an .s3o file
# In your unit's .lua file (the UnitDef one), set object = "3dmeshname.dae", replacing the filename with your own model name of course. You need to add the .dae extension for Spring to load this file instead of searching for an .s3o file
3. Place your dae file in the objects3d folder
# Place your .dae file in the objects3d folder
4. Add a new .lua file to the objects3d folder, in our case "3dmeshname.dae.lua"
# Add a new .lua file to the objects3d folder, in our case "3dmeshname.dae.lua"
5. Add the following code to it, editing the field values a needed. `tex2` is commented out, but your 2nd unit texture (for reflectivity/glow/clipping) may also be defined here.
# Add the following code to it, editing the field values a needed. `tex2` is commented out, but your 2nd unit texture (for reflectivity/glow/clipping) may also be defined here.
<nowiki>
model = {
model = {
      radius = 25.0,
      radius = 25.0,
Line 33: Line 30:
}
}
return model
return model
</nowiki>


Done. Go test your new unit model and texture in-game.
Done. Go test your new unit model and texture in-game.

Revision as of 04:17, 20 September 2017

Simple Assimp Workflow

This Workflow is provided for a standard 3D Modeling package using the Z = forward, Y = upwards convention, like Maya, Modo or Lightwave. You can also use Blender for ASSIMP, but it won't be covered here.

I. In the 3D Modeling Package:

  • Create your models as usual and export to DAE, after making sure all separate pieces share a single UV set. There shouldn't be more than one UV set in the file. All packages have a way to merge multiple UV sets as needed, bear in mind that in some of them you need to combine all objects first.

II. In Photoshop:

  1. Install the DDS export/import plugin. If you have an older Photoshop, you can use nVidia's older 32-bit release. If you use a newer Photoshop (tested on CC.2017) make sure you download this amazing open source plugin here
  2. With the main (diffuse) texture opened, select the areas of the UV you want to have team color on. Select > Save Selection, click ok. A new 'Alpha 1' channel will be created and accessible from Photoshop's 'Channels' panel, usually docked as a tab next to 'Layers'.
  3. Use 'Levels' (Ctrl+L) to make sure you have no pure black or white in the Alpha Channel. First select the Alpha Channel from the Channels tab of the Layer panel. In the 'Output Levels' box (at the bottom) set the left field to 5 and the right field to 250.
  4. Click 'Save As', select DDS file format. Make sure to keep 'Alpha Channels' selected
  5. In the 'DDS Options' panel, select Format 'DXT5' (for main/team texture), keep 'Mipmap' and the Alpha Channel enabled (usually 'Alpha 1'). No need to mess with anything else, defaults are fine.

III. In Spring:

  1. Place your spanking new DDS texture in the '\unittextures' folder of your game/mod
  2. In your unit's .lua file (the UnitDef one), set object = "3dmeshname.dae", replacing the filename with your own model name of course. You need to add the .dae extension for Spring to load this file instead of searching for an .s3o file
  3. Place your .dae file in the objects3d folder
  4. Add a new .lua file to the objects3d folder, in our case "3dmeshname.dae.lua"
  5. Add the following code to it, editing the field values a needed. `tex2` is commented out, but your 2nd unit texture (for reflectivity/glow/clipping) may also be defined here.
	model = {
	      radius = 25.0,
	      height = 40,
	      tex1 = "3dmeshname_tex.dds",
	      --tex2 = "3dmeshname_tex2.dds",
	      midpos = {0,0,0},
	}
	return model

Done. Go test your new unit model and texture in-game.