Porting hammer maps to unity

Simulacron

L-3: Simulated Member
aa
Feb 17, 2016
313
326
At the moment I'm experimenting with unity and I just wanted to know if it's possible to port source maps to unity. And if it is possible, how does it works?
Thanks for your help!
 

Idolon

they/them
aa
Feb 7, 2008
2,105
6,106
You have two options:

1) Create/find a .vmf importer. WallWorm might be worth looking into, though I'm not that familiar with what it can do.

2) Use Hammer's ".DXF Export" option to export to .dxf, which Unity knows. However, I'm not sure how much data this actually transfers, so you might not be able to import entities this way (should you want to).

Note that Source is designed to cull extra faces on compile, so importing a raw map file means you'll have to do the face culling yourself (or just deal with bad performance). You can probably write a script to cull faces that have nodraw as their texture, but you'll still have to be careful with your texture usage in Hammer.
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Go via UE4 and use HammUEr - http://hammuer.nte.be/

HammUEr will batch export materials and props as well as bsp level geometry. If you're starting a project you might just want to consider staying in UE4, but if you definitely want to use Unity then taking the geo and materials from UE4 to Unity shouldn't be too difficult as most of the legwork has been done by HammUEr since UE4 and Unity's requirements for stuff is fairly similar

Note: I haven't actually used this
 

Simulacron

L-3: Simulated Member
aa
Feb 17, 2016
313
326
You have two options:

1) Create/find a .vmf importer. WallWorm might be worth looking into, though I'm not that familiar with what it can do.

2) Use Hammer's ".DXF Export" option to export to .dxf, which Unity knows. However, I'm not sure how much data this actually transfers, so you might not be able to import entities this way (should you want to).

Note that Source is designed to cull extra faces on compile, so importing a raw map file means you'll have to do the face culling yourself (or just deal with bad performance). You can probably write a script to cull faces that have nodraw as their texture, but you'll still have to be careful with your texture usage in Hammer.
So I quickly tried out the .DXF export. It only works partial. I used one of my maps to try it out. It seems like the all brushes get converted including clip brushes, skybox etc. However, they doesn't seem to have a collision mask, because I fall staraight throug. Textures get also removed completly. Hope I could help somebody else with this quick summary and thanks again for your help!
 

Idolon

they/them
aa
Feb 7, 2008
2,105
6,106
DXF export just spits out all of the geometry with no regard for what's supposed to be "real" or not, since that's handled by the compile tools.

Unity handles collisions and texturing differently than Source does. I don't know what kind of data gets saved in the DXF, but if UV data isn't saved, you might want to look into writing your own .vmf importer or getting HammUEr.
 

henke37

aa
Sep 23, 2011
2,075
515
From my limited experience with unity, I worry that you might run into issues that PVS solved. It depends on the exact workings of the converter of course, but it is certainly something to keep in mind.
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
However, they doesn't seem to have a collision mask, because I fall staraight throug
Seems like you don't really know how to use Unity yet, I'd recommend getting to know Unity a bit better before trying to port from source to Unity. Jumping in at the deep end isn't always the best way to learn.

Anyway:
Hammer's DXF export exports /everything/ so if you only want regular visible geo, you'll have to remove everything else from the vmf before exporting. It'll export the backs of displacement brushes too so those need to be removed afterwards. I dunno if it's Hammer's export or 3DSMax's import but in that pipeline normals get flipped so you'll need to flip them back.

If you want anything to be solid in unity you need to give it a collider. As far as textures I thiiiiiiink the dxf export keeps the UVs that they have in Hammer but I might be totally wrong, either way you'll need to manually convert the materials into something Unity can use, that means saving textures as png/tga and creating materials in unity.

Several of these things are why I recommended HammUEr, it will batch convert materials, can ignore various tool brushes and nodraw faces, and can export props as well as geometry. It'd be nice if there was a Source->Unity version, but Source->UE4->Unity is at least manageable