Assimp: Difference between revisions

From Spring
Jump to navigationJump to search
→Blender Workflow Tutorial: Fixed page, the number indexes were all wrong. And the third photo is not a lamp, it's a camera.
mNo edit summary
Line 50: Line 50:
### Rotate.
### Rotate.
## Do this for all your pieces.
## Do this for all your pieces.
# Preparing for Spring:
# '''DISREGARD THIS STEP''' Preparing for Spring:
## Select your root piece.
## Select your root piece.
## Press Shift-C to put the 3D cursor in the center of the world.
## Press Shift-C to put the 3D cursor in the center of the world.

Revision as of 19:10, 26 April 2013

Development < Game Development < Assimp

Assimp

Open Asset Import Library (short name: Assimp) is used in Spring for loading a number of model formats including Collada & 3ds (currently obj is parsed by a different codepaths).

What Spring supports in its Assimp renderer:

  • extended metafile (%modelfilename%.lua next to the modefile)
  • still uses tex1 & tex2 texture system of S3O (same shader as S3O)
  • 2nd texcoord
  • loading of the texture filepaths from the model (don't have to be in unittextures/)
  • when texture filepaths aren't included in the model, it searches for %modelfilename%.* & %modelfilename%2.* in unittextures/
  • special modelpieces `SpringHeight` & `SpringRadius`

Assimp Textures

See Units:Textures (Assimp Section)

Blender Workflow Tutorial

This is a stub containing a simple outline of a Blender workflow.

  1. Open an existing Blender model or import a different format through the File menu (File > Import).
  2. In the 3D view, drag out the secret panel from the right. secret panel
  3. In that panel, select Display > Shading > GLSL. display settings
  4. Make sure you have a lamp in your scene while in this mode or your model will be dark.
  5. Applying texture:
    1. In the UV/Image editor, click the image icon (Tooltip: Browse Image to be linked) to select your texture. If it's not there, click on Image > Open Image to browse for it.
    2. In the 3D View, select (right-click) your object and hit Tab to enter Mesh Mode.
    3. Hit A to select all your faces.
    4. In the 3D View, hit A to select all the faces there and select your image with the image icon. Assuming there's a UVMap, you should see your texture.
    5. If you don't see any faces you'll need to add the UVMap to a new texture:
      1. In the Properties view click on Textures (checkerboard icon).
      2. Click on Add New Texture (plus icon).
      3. Select Type = Image or Movie.
      4. Under Image, click on the image icon and choose your image file.
      5. Under Mapping, select Coordinates = UV.
      6. Under Influence > Diffuse, check Color and make sure it's 1.00.
    6. To add a normalmap:
      1. Repeat steps 5.1 to 5.5.
      2. Under Image Sampling, check Normal Map.
      3. Under Influence > Geometry, check Normal. Make sure it.s 1.00.
    7. You'll need to do this for each piece.
  6. Piece hierarchy:
    1. Select piece A, hold shift and select piece B. Hit Ctrl+P and it will make piece A a child of piece B.
    2. Make sure all the pieces are descending from one single piece.
  7. Setting piece origins:
    1. Select a piece.
    2. Place the 3D cursor where you want the origin to be (left-click).
    3. Click on Object > Transform > Origin to 3D Cursor.
    4. You can now rotate your pieces:
      1. Click on the dropdown "Pivot Center for Rotation/Scaling" and select Individual Origins.
      2. Rotate.
    5. Do this for all your pieces.
  8. DISREGARD THIS STEP Preparing for Spring:
    1. Select your root piece.
    2. Press Shift-C to put the 3D cursor in the center of the world.
    3. Click on the dropdown "Pivot Center for Rotation/Scaling" and select 3D Cursor.
    4. Rotate your whole model so that it's -90 degrees. You can do this by typing "R X -90". This will make your model lie on its back.
    5. Click Object > Apply > Rotation & Scale.
  9. Save your model.
  10. Select all the pieces of your model, ignore the lamp.
  11. Click on File > Export > Collada.
  12. Check "Export Only Selected" and export.
  13. The dae file will be used as your object.