Porting Source / Source 2 maps to Unity

After a long hiatus, I’m back with more conversion shenanigans.

Edit: images rehosted to imgur with full resolution

**Intro to Source 2
**
One of the first things I noticed when Valve released the Source 2 Hammer editor for creating Custom Games in Dota 2, was how simple it was to create maps with the familiarity and precision of the original Hammer, but with updated and very much improved tools.

It does away with brushes, and treats everything as meshes - like a 3D modelling program. It also allows you to export any number of meshes to file formats such as .dmx, .obj, and .fbx 2015.

**Level Design in Unity
**
The most annoying experiences I’ve had in Unity had to do with level design. I tried plugins such as Prototype (now ProBuilder Basic), and while it was cool to get some basic layouts down, I had issues such as complex brush work not rendering at all.

**Hammer Experience
**
I’ve been using the original Source 1 Hammer for a long time, and know most of its features and quirks. Source 2′s Hammer does away with virtually all of them, and makes map creation much, much easier. I’ve had thoughts of reworking my game in Source (or even gulp GoldSrc) just because I missed the powerful level creation tools while using Unity.

**Export Selected Meshes to .fbx
**
My level design issues would soon be solved, for I had thought up a new process: I would import a Source 1 map into Source 2, export it to .fbx and import it in Unity.

For the purposes of this experiment, I used a map I made a few years ago for CS:GO.

http://i.imgur.com/bNsMZlc.png[/t]
*My map in Source 1′s Hammer
*
Source 2′s Hammer allows you to open Source 1.0 VMF’s with zero errors (excluding missing textures, models and entities because of CS:GO’s differences with Dota 2).

After tweaking my map a bit in Source 2 to fix missing textures and entities, it looked like this:

[t]http://i.imgur.com/SPqjq10.png[/t]

Great! Now to export it as .FBX…

[t]http://i.imgur.com/iGMbQIH.png[/t]

[t]http://i.imgur.com/MXTbPuB.png[/t]

Importing the model to Unity was no biggie, and it looked great after using a scale factor of 3 on the model import. And look at that, it even has our textures separated and uvw mapped for us! How convenient! I also plugged in a Mesh Collider to make sure the Player Controller doesn’t fall through the floor.

[t]http://i.imgur.com/HDIbNZs.png[/t]

After tweaking the materials (with bad screenshots of the original textures) I got to this:

[t]http://i.imgur.com/xjMxzKr.png[/t]

Surprisingly, it looks and plays great right out of the box.

Even displacements don’t break:

[t]http://i.imgur.com/VMc89FJ.png[/t]

And thanks to the Mesh Renderer accounting for all textures, I can use standard Unity material surface PBR parameters:

[t]http://i.imgur.com/dZfa9PP.png

If I want to change something in the level, I just change it in Hammer, re-export as .fbx and everything gets reloaded instantly by Unity.

**Takeaway
**
If you love developing in Unity and love creating maps in Source, you shouldn’t be separated from the tools you value the most. Dota 2 is free, and so is its Hammer editor. So get it and make cool stuff!

This is also the same process for bringing stuff over to ue4

My life was turned around once I realized you could export Hammer 5 meshes to be imported in Unreal or modified externally.

Don’t your faces not get culled when doing this?

What about when you need to bake lightmaps?

Use crafty

Or you could just make it in source 2 since it’s better than hammer in every way.

Does anyone know if there’s a way to export from the source 2 hammer in an open file format with entity information? (As far as I know Valve haven’t released the specification for the .vmap-format (yet?)) I’d love to add source 2 hammer support to my engine.

I think you can do that in Hammer

There’s an option called “export map as txt” which might do what you’re asking for.

Sorry to bump this thread but I’m not sure how you got the textures to work, but they always appear as one solid blended color. I’ve tried adding new textures but they don’t work either.

Multiplying the scale by 2.54 will give correct scaling in UE4 and Unity. And as Stiffy was saying, when you import/export to Hammer, it doesnt cull any faces for each brush, even if it has nodraw. This makes it a very inefficient method.

Changing didn’t fix the problem. any texture I plug into the uv mapped faces turns into a single color

[editline]21st February 2016[/editline]

Got UV mapping to work by checking the world box under mapping in the Source 2 hammer

I’m not into those thing, but this maybe will be heplfull for you.

https://pp.vk.me/c633324/v633324638/1f1c/14VUeE5-fyE.jpg[/t] [t]https://pp.vk.me/c627531/v627531638/2d062/fdYchENeXdw.jpg

Any documentation on how it works? The readme doesn’t say much

Is it possible to make maps for a source game like Garry’s Mod in this new hammer?

I think your in the wrong thread, but to answer your Q, No; Source 2 editor is only for dota2 atm plus it saves the compiled level as a .vmap not a .bsp

Sorry if I really necro this, [del]but can anyone explain to me how to import the maps with various scale factors?[/del]
Never mind, got it.

Also, is there a way to run this new hammer without the full game running in the background?