Destinations

Destinations

Недостаточно оценок
Model importing workflow (Blender)
От Rectus
The Destinations model importer doesn't always work well with models exported from Blender, and making any changes to the model means it needs to be re-imported and remade from scratch.

This guide shows how to export models from Blender and manually set them up to allow for editing the meshes without having to set up the model again every time, as well as how to get the tools to automatically update the model when modifying the assets.
   
Наградить
В избранное
В избранном
Удалить
Exporting files from Blender
Source 2 uses inches as the basic unit, so it is recommended to scale the model so that 1 blender unit = 1 inch. This is especially important when working with animations, since we can't export animations in a scaled format from Blender.

To work with metric units, set the scale to Inches in the Scene panel, and set the Length scale to metric.



The Source 2 Tools do not handle embedded textures. We need to reference what materials are used by the mesh, and this is done by assigning Blender materials with the same names as the material files we will create.



Now, to export the mesh, select it, and the armature if you plan on adding animations. Then open the export dialog from File -> Export -> FBX (.fbx)

Note: As a an alternative, it is possible to export directly to the native DMX format. See the Adding animations section below



Make sure Selected Objects is checked to only export the needed objects.

To keep the inch based scaling on the mesh, uncheck the button next to the scale setting. The Source 2 Tools do not support reading the scale setting in FBX files, and assume everything is in inches.

To simplify updating the mesh, export it directly to the content directory of your addon, for example \Destinations\content\steamtours_addons\<addon_name>\models\my_models



If you have made changes to the mesh in Blender, simply re-export it, and the model will be automatically updated with the new mesh.
Setting up the model
Launch the model editor and select New VMDL from mesh file, and select the exported .fbx file. The editor should present you with a small dialog asking to confirm the name. Do this, or choose a different one.





Now the Model Editor should launch, showing the mesh in a red wireframe. Confim that the model scale is correct.




Next we will apply the materials to the model.
Setting up materials
Export any neccessary textures, preferably in .png or .tga format. Place them under the materials directory of the addon content directory, for example: \Destinations\content\steamtours_addons\<addon_name>\materials\models\my_models



Launch the Material editor and create new materials using the textures. Save the materials in the same directory, and give them the same material names as chosen eariler in Blender.



In the Model Editor, select the mesh and add the path where the material files are to the Material Search Path in the right panel. The paths in the virtual file system are based on the root of the addon folder, so only include the relative path under it starting from the materials folder, for example: materials/models/my_models

Note: The Material Search Path does not work correctly if it starts with a slash (/).



Now the materials should display correctly on the mesh.
Collision meshes
The Source 2 Tools include an advanced collision mesh generator, but if you want more control it is possible to import collision meshes manually as well. Note that this guide does not show how to use the advanced generator.

It is possible to use a custom collison mesh, or using the reference mesh as the collison mesh. Apart from very simple models, the reference mesh is too complex to be used directly, and will cause glithces. To get around this, the Model editor has a Convexify option that will generate a simple shrinkwrapped mesh based on the loaded mesh, altthough this may not always produce desirable results. The better option is usually to make a custom collison mesh in Blender. The mesh should be comprised of one or more separate convex closed hulls.

Export the collision mesh as an FBX or DMX the same way as the reference mesh eariler. Remember to include the armature for animated models. Like the reference mesh, the collison mesh will update automatically when re-exported.



To add a collison mesh use the menu command: Model -> Collision -> Add Simple Physics



The physics mesh can be viewed from the Display menu.



Select the collision mesh from the left panel and apply the Convexify option on the right panel if needed.
Adding animations
The Source 2 Tools can not import animations from Blender-exported FBX files. Fortunately the third party Blender Source Tools allow you to export to the native DMX format the tools use.

Install the Blender Source Tools, and find its panels in the Scene tab. Set the export path to the same model directory as ealier, and select DMX version Binary 9, Model 22.

Select the action to export, and give the subdirectory an appropriate name. Then click Export, and the animation file.



To add an animation in the Model editor, select Animation -> Add animation from the menu. The animation will update automatically if the DMX file is re-exported, but the Start and End frmae numbers do not, so they will need to be updated manually from the right panel.

Комментариев: 29
Rectus  [создатель] 30 дек. 2021 г. в 9:30 
I don't think it's posssible to disable them. It likely needs to be able to import them correctly in the first place.
Rectus  [создатель] 30 дек. 2021 г. в 7:53 
Unfortunately I have never got it to work either. I've never seen how a working file would be set up for Source 2.

This thread suggests it might be possible if the addon was modified to disable corrective flexes, but it might only with with games that have ModelDoc.
https://steamcommunity.com/groups/BlenderSourceTools/discussions/1/3034852313320896957/
Klausbdl 20 июл. 2021 г. в 12:09 
they were whole objects transformed by bones. I did ctrl+p > bone instead of with empty groups . I'll try with vertex groups and I'll let you know
Rectus  [создатель] 20 июл. 2021 г. в 12:05 
Are the meshes skinned with vertex groups, or are the whole objects transformed by the bones? The latter method won't work.

Try enableing joint display in the model viewer and check if the bones themselves move properly.
Klausbdl 20 июл. 2021 г. в 10:48 
There are none. I applied rot/scale/pos before exporting botht the fbx and the dmx files. One thing I noticed is that in blender, the doors stick to the head of the bone, but in the Model Editor they stick to the tail of the bone, hence they are translated that way. But apart from that, anyway to fix the animation being "small" on the Model Viewer?
Rectus  [создатель] 20 июл. 2021 г. в 7:24 
Check that there aren't any transformations on either the mesh or armature objects. Blender Source Tools does not take those into account when exporting.
Klausbdl 20 июл. 2021 г. в 4:08 
Hello. I need help in the Animation part. Basically, I have a sliding door that I animated it with bones to open and close. The animations did export to the Model Editor, but they are really "small" and translated wrong compared to in Blender. https://imgur.com/a/XboPAAp here's it in Blender, how it was supposed to open. https://imgur.com/a/UXCD7M3 and here is how it looks like in the Model Editor. Can you help me?
[-Psycho-] 12 сен. 2020 г. в 15:35 
Yes, sorry I meant Model Editor. But thanks for help. :ss13ok:
Rectus  [создатель] 12 сен. 2020 г. в 12:16 
If you mean the model editor, it's in all the Source 2 toolsets (although it's deprecated in the alyx tools).
[-Psycho-] 12 сен. 2020 г. в 11:30 
Can I just ask where can I find the "Model Viewer"?