User Tools

Site Tools


Sidebar

hpl3:3rdparty:blender

Blender - How to get started

This was tested with Blender 2.65 and using a HPL3 redist folder.

Open a new project. Don't create any new objects or materials.

Select the cube and press TAB to switch to Edit Mode. The cube should change in appearance so that you can see the selected vertexes. Rotate the view around and make sure all vertexes are selected. None selected vertexes are black and selected are white, the lines and faces between selected vertexes are orange. You select a vertex by right clicking on it, use shift to click and make multiple selections.

Extra info: To easily select all the vertexes you can press the button at the bottom of the 3D view window that has a cube with clearly visible white vertexes, this will toggle off/on selecting only visible or all vertexes in a selection. Press B to be able to click and drag out a selection box over the cube to select all its vertexes.

With all the cube vertexes selected, press U and choose Unwrap.

Press SHIFT-F10 to switch to the “UV/Image Editor”. In the UV/Image Editor, at the bottom of the editor window, click the Image menu and select Open Image. Navigate to the HPL3 folder and select a .dds image. Important! Make sure that the selected .dds image has a .mat file or else it will not work in the game. You should now see the texture behind a orange semi-transparent box in the editor window.

Go back to the 3D view by pressing SHIFT-F5. Make sure you are in Edit Mode (TAB toggles between Object and Edit) and with the cube selected, press CTRL-T to triangulate it.

Extra info: See Triangulate only on export for a method where you only temporary triangulate objects on export, which is what you want when doing proper modelling later.

To see if the cube has the texture properly applied, at the bottom of the 3D view next to the large Edit Mode button, press the button with a circle and switch the viewport shading to “Texture”. You should now see the texture on the cube.

With the cube selected go to the File menu and choose Export → Collada. Navigate to a folder within the HPL3 folder structure (to minimize chance of error, select the same location as the .dds image). Important! Before you export, make sure that the Export COLLADA settings are all unchecked EXCEPT “Selection Only” and “Include UV Textures” that should be checked.

Extra info: You can save the Export settings for easy loading in the future using the + button next to the Operator Presets in the Export COLLADA section.

Open the HPL3 ModelViewer.exe and click the Load Model button, then navigate to where you exported the Collada file and open it. You should now see a magnificent textured cube.

Blender - Making your own model

Making your own model does not require much else beyond the above introduction. There is however one small but important detail to get right, so let us try this again.

Open a new project in Blender. Select the cube and press X, confirm that you want to delete it.

In the Add menu, select Mesh → Cube. You should now have a new identical cube in the 3D view.

If you follow the above guide from here and try to export, the modelviewer will fail to show the object (most likely crash). This is because the exported Collada file does not contain any information on what image is used for the material. To fix this you will need to do the following:

In the properties panel (largest panel on the far right side of the screen) go to Materials (the red/pink circle icon, should be icon number 8 from the left). Click the large New button. This creates a material and automatically assigns it to the cube. If you have done all the steps correctly in the first guide, this should be all you have to do. If you export the cube again, the Collada file should now contain information on what image is to be used for the material.

Extra info: If you use two different materials for two different cubes in the same export, then you have to make sure that you create two different materials. The assigned material for a cube will automatically get the corresponding image you have added to the cube in the UV/Image editor. A tip is to use the Outline to get the best overview of what materials are assigned to what mesh.

Extra info 2: To get even better overview and clarity of how things are related, you can add a texture to your material. This is not actually used in the export or by the game, but will let you see in Blender what material has what texture and what mesh it is assigned to.

To do this go to Textures (icon 9 in the properties panel), click New and change Type from Clouds to “Image or Movie”.

In the Image section, click Open and select a .dds image. You can see the image in the Preview as well as listed as a Texture.

You will now be able to easily see what image it is that you assign to a mesh. Important! You still have to UV map and use the UV/Image editor to assign the image to the mesh properly. If you do not it will not work when you export.

Blender - How to model

For this you have to read (or watch) regular Blender tutorials.

Triangulate only on export

  1. Go to modifiers (the wrench icon) in the properties panel.
  2. Add the Triangulate (pre 2.65 Blender, use Decimate) modifier listed in Generate category, no need to change settings or to apply it.
  3. When you export, check the “Apply Modifiers” option. This will triangulate the mesh for the COLLADA file export, but not the mesh in your blender project.

Blender wish-list

  • Up axis settings for COLLADA, or preferably dealing with it automatically on import/export (currently importing object with Y up flips it 90 degrees).
  • Units settings for COLLADA.
  • Relative paths for COLLADA.
hpl3/3rdparty/blender.txt · Last modified: 2012/12/14 08:40 by jens