23rd July 2012
I am a hobbist in the "underworld of game hacking" and i have discovered some cool things, and i am so happy that i want to share with the folks here.
I will do a basic tutorial, with some tips on how you can import a complete BSP Map into 3dsmax, alongside with Lights. This can be very usefull especially if you work with Machinima, or, just because i think is cool.
What you will need:
- 3dsmax (i am using version 2009 x64)
- VRay for 3dsmax (i am using V1.5)
- Autodesk Crosswalk 5.1
- Some maxscripts from scriptspot.com
- Crafty Object Viewer
- Softimage XSI or Mod Tools (i am using XSI 7.0)
- Any extracted (Non-Steam) version of a Source Game (i am using a Counter Strike Source)
- Source SDK and the tool VTFTool 0.5 beta (I am using CSM Source SDK SP4)
So, lets go:
1- First of all, open crafty object viewer, select a profile, in the case, Counter Strike Source. Then you go to View > File System Browser, then right-click on the folder root, and select Mount Folder. Then select the folder where all your game files are located, in my case, C:/Source SDK/cstrike.
2- Now, in Crafty Object Viewer, click on File > Open, and open a cstrike map, in example, cs_office.bsp. Navigate on the level, if all the models and textures are showing right, so you have configured it well, now just click on File > Export, to export the entire map to OBJ file. Select a folder, because all the texture maps will be exported to this folder in tga format.
3- Now open 3dsmax and import the OBJ file. When importing it, unmark the checkbox "Flip Y axis", and also unmark "import as a single mesh" to have the map imported in the correct direction. But to avoid crashes in 3dsmax, we will have to edit the map in parts, so now, when importing the map, we will first import the level geometry (and save it as something like, mymap_level_geometry.max). When importing the OBJ file, you will see a list of object, now, you will just check the first item in the list, which is the level geometry, and unmark the others, with are the mdl models.
4- So when you import it, you will have all the level geometry in 3dsmax, with texture. But the maps are too glossy and bright, and to correct this, we can't click on each one and change the glossiness, this will be a pain in the ....... So, to avoid all this work, we just run the maxscript "Multi Convertor", and select to convert to VRAY, so all the maps will be converted to VRAY Maps, and without the error of glossiness.
5- After running this script, you need to change the renderer from default scanline to VRAY, and then, you need to run the maxscript "Turn Viewport Maps-on", because all the maps will be unshow after you run Multi Converter, because this we need to turn them on.
6- Now you close this scene, open a new scene, and we will import now the level models. On the first scene we imported the level geometry, we selected the first item in the OBJ Import Dialog List, so now, we will select all the items, except the first one. So just repeat the same procedure above (run multi converter, then run "Turn Viewport Maps-on"). Save as mymap_level_models.max and close 3dsmax.
7- Now you must CONVERT ALL THE VTF TEXTURES INSIDE cstrike/materials TO TGA. This is a very tedious job, and you don't have any faster way than running VTFTool, go to File > Convert to TGA > Folder, and select the folder (on the tga convert option, mark save to the same folder of the original material). You can only convert one folder by time, so you must convert each folder, except the materials/models, because the BSP maps don't store the models inside it.
8- Now open the BSP2XSI tool, and select the map you want to convert (cstrike/maps/csoffice.bsp), select the output folder, and mmost important, select the folder where it can find the extracted tga files for the textures. IMPORTANT: if you don't convert the vtf's to tga's, this tool will not output the OBJ file. On the same folder that the tool will output the OBJ file, it also will output a jscript file to use inside XSI.
9- Now open XSI, click on the script icon on the bottom bar, select open script, open the script generated by BSP2XSI, then click on Run Script. Now you will have your map imported in XSI, with all the LIGHTS!!!! But the level geometry may be corrupted, not correct, but what we will use from this, are just the lights, however, DO NOT DELETE THE LEVEL GEOMETRY, as we will use it to rescale the scene in 3dsmax.
10- You must install Autodesk Crosswalk 5.1, to be able to export it to the Collada DAE format, from inside XSI. So now in XSI click on File > Export to 3dsmax > Crosswalk, then on the format, select Collada 1.4.1, and click export (name it as csoffice_lights.dae).
11- Now open 3dsmax, click on import, and select the format COLLADA DAE (NOT AUTODESK COLLADA!!!!!!!!), and import the file you exported (csoffice_lights.dae). Now the magic is that you will have all the lights in the scene!!!! Exactly in the same position of the lights inside valve hammer!!!!!!!!!
12- Now save this scene as csoffice_lights.max, and import the original OBJ file exported from Crafty. Import just the level geometry, the first item in the list. You can see that the scene we exported from xsi to 3dsmax, is little compared to the original obj file imported. To resize the xsi scene imported in 3dsmax, just click on the scene root dummy (that is the parent from all the lights on this scene), select the tool scale, and resize it, make it bigger until the mesh that came with the lights imported from xsi, overlay the original OBJ scene, in the case, the level geomtry mesh.
13- Now you can see we have a lot of lights, both spot, directional, and omni lights. But you can see that some spot lights have a wrong rotation direction, in example, some spot lights inside the office that should be pointing to the floor, they are pointing to the wall. So you must select each light that is wrong in direction and rotate them.
14- The lights now must be converted to VRAY lights. Is a question of analyse the scene. There are some lights that don't need to be converted to vray lights, that they can stay as spot lights (just select Vray Shadows as the shadow type for them). In my case, i converted all the lights that are inside the office to VRAY Lights (interior lighting), and let the external lights as spot light (just converted some directional lights to vray lights).
15- Now as you already rotated all the lights in the scene, so you can see what are the lights that are inside the office (interior light) and what are external. Save the scene as csoffice_lights_full. Now delete the external lights, letting only the internal lights, also delete the level geometry and save it as csoffice_lights_vray.max.
16- Now come back to the csoffice_lights_full.max, delete the internal lights and let only the external lights, and save it as csoffice_lights_standard.max
17- So you see now we will only convert the lights from csoffice_lights_vray.max. Open this scene, run the maxscript multi converter, mark the option show dialog for unknow types, select the vray render, click convert. It will take sometime untill convert, and it will show some dialogs saying that it does not know what type to convert. You will always click on Use Current, but when it shows in example, Soptlight, Directional Light, Omni ligh, you will select the VRAY Light type and click on replace.
18- Now save this scene as csoffice_lights_vray.max.
19- Open the firts scene you saved (mymap_level_geometry.max), and save as csoffice_final_render. Merge the csoffice_lighs_vray.max, and merge the csoffice_lights_standard, and finally merge the mymap_level_models.max. So now you have all the scenes merged together.
20- Now you must insert a VRAY Physical Camera, and use Gama 2.2 for the render, and render the scene to see the results. You will have to adjust the light intensity for the vraylights and spotlights. But to keep a logical workflow, you will change all the vlights intensity to the same value. The default intensity fo the vray lights is 30, but in this scene. i changed them all to 100 and got a good result. The lights are placed in the same position as inside hammer editor. And by viewing the map inside crafty, you will have a notion on how your work is going. As i said, in those scene, all the vraylights have an intensity of 100, but i placed a full blank environment (render options F8), and also i used, in the vray environment options, skylight override in the color light blue and intensity 50.
21- By using the maxscritp vray lightlister, you have access to all vray lights easily, so you don't need to click inside the map to select each one.
22- I rendered some shots to you see, but i choosed a very low vray quality render, because it takes a lot of time to render in high quality.
23- So it's all.
Hope someone finds it usefull, because i loved to play with it, see all the CSS maps inside 3dsmax, to me is something very cool......................
See the photo:
24th July 2012
Cool, nice tutorial!
Maybe I'll try this later
24th July 2012
I don't know much about this but would it be possible to export the lighting information back into source as a lightmap? It would be awesome to be able to "fine tune" light maps and/or give prop_dynamic lightmapped shadows.
24th July 2012
Bro, i really don`t know very well the source engine, except for decompiling maps and importing models in 3dsmax, i never have created a map in hammer, i just know the very basics of it. But i think yes, you can "fine tune" the light maps in 3dsmax and export it to valve hammer. I mean, if hammer can load custom lightmaps for the level, so is very simple. You just "bake" the VRAY Lightmaps in 3dsmax, then export them to hammer. Or maybe this toll can help:
It`s a set of tools for 3dsmax that allow you to even create an entire map in 3dsmax and export it to valve hammer.
And for baking the textures in 3dsmax, i recomend this plugin:
Cheers for all.
18th September 2012
Hey man, this is really really useful! However I cannot find a download link for BSP2OBJ2XSI since the fpsbanana link is no longer up! Was wondering if you could upload it somewhere? Cheers!
18th September 2012
"Sounds like something Stiffy would say."
Just, send a PM... Don't bump old threads.
21st October 2012
Hy man, i am happy you found this tuto usefull. First of all, i am not promoting piracy here, i don`t support piracy, and i used this just for learning purposes (also to making machinima). Never use this kind of tuto for commercial purposes! Never rip copyrighted content from games to sell, or use commercially, it`s against law!
Indeed, now with Source Filmmaker, there is no need to go by this route, however, is still cool when you can see a game level loaded in 3dsmax with all lighting and shadows (in Vray).
Here is the link, i uploaded the tool:
21st October 2012
That is not really helpful for anyone else looking for this at some point.