Skip to content

Script for Blender to export your geometry to .vmf (Valve Map Format)

License

Notifications You must be signed in to change notification settings

leaxcx/blender-vmf-export

Repository files navigation

blender-vmf-export by leaxcx

Blender addon to make maps for Source Engine

example

ui-showcase

Create more complex shapes

complex-shapes

How to install:

  1. Download/clone repository
  2. Open Blender project, Go to the Edit menu at the top of the screen.
  3. Select Preferences.
  4. In the Preferences window, select the Add-ons tab on the left sidebar.
  5. Click on the Install... button at the top of the window.
  6. Open file "blender-vmf-export.py"

I also added "shortcut scripts", which is not nessesary, just life quality improvement:

  1. "fast-material-picker.py" - creates additional panel with all materials in your scene with button "Assign to Selected Face". When your project has a lot of materials, it helps.

    ui-materials

  2. "shortcut-convex.py" - creates additional panel with button "Make Mesh Convex" automatically makes mesh convex, which means ready for .vmf export.

    ui-convex

At this point, you're pretty much done!

How to make maps:

Every mesh you want to export should be in collection named "brushes"!

  1. Model your environment only with these shapes:

    1. Cube
    2. Icosphere
    3. Sphere

    These are the ones that are supported now!

  2. Map still should be properly sealed! You're still making a Source Engine map!

  3. Making sky is still recommended to do in Hammer Editor, because there's no such a thing (yet) as "Make Hollow" function.

  4. Map should be made out of convex shapes! Unfortunately, what you're doing in Blender is still limited by BSP limits.

  5. Automatically, sky texture is set to "sky_day01_01" you should change it by hand in Hammer (soon).

  6. Checkmark "Rename Objects to IDs" automatically names brushes as "brush_1", "brush_2", "brush_3", etc... Not nessesary, but i find it generally easier to manipulate geometry when it's sorted.

In repository, there's a folder called "entities", at this point, there's only one there "info_player_start". It is a 1:1 scale reference model that allows you to easily scale your map to an actual Source Engine scale system.

How to import "info_player_start":

  1. "File" -> "Append..."
  2. Choose "info_player_start reference .blend" -> "Object" -> "playerstart_reference"

Set "Clip End" to 10000 or more! It will improve visibility in Blender.

How to export:

  1. Set filepath (with yourfilename.vmf in the end)

ui-export

  1. Press "Export VMF" button

  2. Done!

exported-file

Materials:

Every mesh that does not have materials, in Hammer, will have "dev/dev_blendmeasure", but, if you mesh has material that has name like this "path/materialname" then it will automatically set material you've typed in Hammer.

Example:

material-example

UV scale:

If you want your mesh to use its actual UV scale, and not default scale "0.25", create a new custom parameter (integer) in Object Properties called "useMeshUV" and set it to 1.

useMeshUV-example

Known issues:

  1. Geometry flips vertically when exports to .vmf. How to fix in Hammer: 1. "Edit" -> "Select All" 2. Press Ctrl+I or "Tools" -> "Flip Objects" -> "Vertically"
  2. No displacement support
  3. No manual entity placement support in Blender (will be fixed soon)
  4. Fully rewrites file from scratch everytime you export it, so all entities/brushes you've placed in Hammer will be erased (also will be fixed soon)

There are some examples of test maps in folder called "files" (includes ".blend" and ".vmf" files"), so check it out if something gone wrong with it.

Good luck! :)