本教程解释了如何将一个模型从 Blender 导出到 Source 2。虽然 懂得 blender 基础操作对理解此文章很有帮助，但如果你是新手遵循教程指引也能轻松完成导入工作。您将学习如何为您的模型设置正确的缩放比例、如何以 Hammer 可读的方式分配材质以及导出时使用的设置。
如果你的电脑上没有Blender这款软件, 你可以在 blender.org/download 官方网站上免费下载.
在开始处理网格之前，请确保正确设置 Blender 的场景选项中参数正确无误。为此，请切换到“属性”菜单中的“场景”选项卡，然后选择“英寸”预设或将长度设置为“无”。
我们将使用默认的 Suzanne 猴头作为本教程的示例道具。按 Shift+A → Mesh → Monkey 将其添加到您的场景中。您可以通过按 N 打开 3D 视口的右侧菜单并查看“变换”类别中的尺寸来检查尺寸。在本教程中，我们将放大 Suzanne，直到 Z 尺寸大约为 6.5 英尺或 78 英寸/通用单位。为此，请按 S 并将光标从猴头上移开以将其放大。用鼠标左键确认。
通过按 Ctrl+A → 旋转和缩放来应用网格的缩放。养成在将网格导出到 Hammer 之前始终应用缩放和旋转的习惯。
你的网格应该在 Blender 中朝南，以便与 Hammer 的坐标正确对齐，猴子头默认这样做。
使用 T 打开 3D 视口的左侧菜单，然后单击“平滑”将 Suzanne 更改为平滑着色。
Adding two materials
First, switch your renderer to Cycles in Blender’s header. This is not needed to create materials - however, as the Blender Renderer will be discontinued in the future and has been removed from Blender 2.8 you should switch it to Cycles, so you can continue working on old props seamlessly when updating to the new Blender version.
We will create two different materials, a red and a blue one. Navigate to the Material tab in the Properties and click on New to create a new material.
Click on the + icon to create a new empty material slot. Select this slot and press the big new button again to create a second material. Rename the materials to red and blue.
The material name you enter here is not relevant or tied to the material name used by Hammer. But for the sake of consistency it is advised to use the same material name as in the engine.
Hammer can’t read the materials unless you add a so called Custom Property to them that points to the correct material name and path used in Hammer.
Select the red material. For this tutorial we’re going to assume that you have created a material called red.vmt in the folder “materials/models/props_items” of your project with Hammer’s material editor. If you didn't, thats fine too. You can create the materials after finishing this tutorial. There's a link in this article's conclusion that will help you to do so.
There’s a Custom Properties category in the material menu. If you can’t see the big Add button in it, click the Custom Properties text to expand it. Make sure your red material is selected and click the Add button. A new property with the Property Name prop and Property Value of 1 will be created. Click the Edit button and change the name to FBX_vmatPath and the value to materials/models/props_items/red.
Repeat the same steps for the blue material, but change the value to materials/models/props_items/blue.
Choose a Viewport Color in the Settings category of both materials. Switch to Edit Mode by pressing Tab and assign the two materials to different faces by using the Assign button in the material editor.
Click on File → Export → FBX to export you mesh as FBX. For this tutorial we’ll assume that you project has a models\props_items\fbx\ folder.
|Selected Objects||Tick this box if your scene contains more than one prop. Make sure to select the right prop before opening the export dialogue.|
|Apply Scalings||Choose FBX All.|
|Forward / Up||This does not seem to affect the mesh’s orientation in Hammer. For the sake of consistency with Hammer’s coordination system it’s set to X Forward and Z Up.|
|Custom Properties||Make sure to tick this box or your materials will not be recognized in Hammer.|
You can safely ignore the tabs Geometries, Armatures and Animation for regular props. Enter a prop name in the upper toolbar and click on Export FBX in the upper right to export your mesh.
If you'd like to save your settings as a preset, click on the + button to the right side of the Operator Presets list and enter a name. You can select the new preset by clicking on the Operator Presets button. Remember to always select the preset before exporting in a new Blender session, as the selected preset is reset when Blender is closed.
With your FBX exported to the right folder you're ready to import your prop into Hammer. Check out the Model Editor tutorial to find out how. If you need help creating your materials, the material creation tutorials will help you getting started.