• How To: Compile Cubemaps for SFM
    0 replies, posted
Hey, so I just released my new [URL="http://facepunch.com/showthread.php?t=1431921"]map[/URL]. What makes it 'pop' is a nice set of cubemaps that are fully functional in SFM. As part of the release, I put together [URL="http://internethatemachinae.wordpress.com/2014/10/18/the-making-of-synthesis-environments/"]an illustrated step by step on how to compile cubemaps for SFM maps[/URL], and the caveats in the SFM branch renderer when using them. For the sake of kindness, here's a direct transcription for you, although it has more impact with the preface in the blog post. I just don't want to think I'm pressuring you to visit my blog where I get all of 0 ad revenue. :v: ----------------------------------------------- [B]When mapping for SFM,[/B] here are a few things to consider: -[I]There is no gameplay and no moving objects[/I]. Remove anything that moves; nothing is sacred. Seal off doorways with static props or brushes, or leave them completely open. Rule of thumb for keeping props: if it might be animated at some point, strip it out for replacement as an element in SFM. The only props you want to keep are static ones that you want baked into the lighting and will never move. prop_dynamic and prop_physics have no place in an SFM map, or do func_trigger, func_door, or func_rotating, or anything that depends on player action. (still need an info_player_spawn though) -[I]With lighting, less is more.[/I] This actually solves a lot of cubemap issues I’ve discussed – the less dramatic the map lighting, the less dramatic the cubemap ‘pop’. In my experience, you want just enough lighting for a very low level ambient environment – basic shapes are visible, but it is clearly dark. Let SFM lighting shine; SFM’s dynamic spotlights can recreate everything from laser beams to artificial sunlight. You can also use hammer lighting for low level (brightness <10) point lights on objects that glow. Remember, lighting in hammer does not use dynamic shadows, so objects illuminated with map lights generally look washed out. [t]https://internethatemachinae.files.wordpress.com/2014/09/map_lighting.jpg[/t] -[I]Place lots of env_cubemaps, and maximize their render size[/I] (double click on the env_cubemap entity and select the largest available render size.) Valve’s recommendation is ‘less is more.’ Mine is ‘more is more.’ You don’t have to worry about performance impact on a non-real time render. In a SFM map, how an environment looks is your only real concern, and I don’t think I have to tell you (again) that cubemaps play a huge role in that. [t]https://internethatemachinae.files.wordpress.com/2014/09/stratus_bridge_alt.jpg[/t] -[I]Don’t bother with sound[/I]. Sadly, SFM does not take advantage of soundscapes or leverage any type of audio from environments, unless you map for TF2 and do only ‘ingame’ recording. Once you have your map done, you can run your standard HDR compile. Nothing unique about this, except you’ll want to use the version of hammer you can find in SourceFilmmaker/bin. (You can use SDK 13 hammer too, I just find that SFM’s one hammer is easier to work with when it comes to custom mods/content you have in usermod. If you’re mapping for garrysmod as well, it might be prudent to go the extra steps for SDK13 hammer.) Once it is compiled, the .bsp will show up in your usermod/maps folder (or the maps folder of your currently active mod). From here, you’ll want to copy it (and all the models, materials, and particles it needs) to your Alien Swarm directory. Yes, Alien Swarm. [t]https://internethatemachinae.files.wordpress.com/2014/09/2014-09-23_00002.jpg[/t] [B]Why Alien Swarm(ASW)?[/B] SFM’s [URL="https://developer.valvesoftware.com/wiki/Source_BSP_File_Format#Versions"]BSP version[/URL] is the same as L4D2, ASW, and Portal 2. (for those of you keeping track at home, this is why SFM maps don’t work in gmod) I find Alien Swarm to be the easiest to use of the three to throw a map into because A) I don’t play it, and I don’t mind if its directory gets bloated/wiped, B) Loading a map is fast as the AI overhead for a non-swarm map is low, and will play – unlike a non-AI raw map in L4D, and C) It’s free, for people that don’t own the other two games for some reason. Once your map is loaded in ASW, run the game, open the console (~), type map my_mapname, select any random character, and hit start mission. You may or may not see your character as it is a top-down shooter, but all you need to do is open the console and run buildcubemaps. Once you see all your cubemaps flash before your eyes, the .bsp in the swarm/maps is now larger then when you put it in and you now have a map that’ll work great in SFM. (For those of you that are mapping savvy, you only need to compile HDR cubemaps, SFM does not use LDR anything, ever.) A few caveats about using ASW: It has no shared dependencies with HL2 – no default models or textures that most mappers take for granted. You may want to extract the HL2 gcf’s and put the content into the ASW directory. Second, the laser beam shooting from the standard marine will bake into your cubemaps, as well as bullet holes, blast decals, or effects. Run your character into a corner or wall where the laser doesn’t project into the environment and you’ll be fine. [B]Taking it further[/B] Alright, now that you have nice, high quality cubemaps in your map, how do you take it to the next level? What if you just want to impress your friends with source wizardry? Well I can shine some light on how to do that too. When you compile your map’s cubemaps, the bsp will balloon in size. If you use [URL="http://www.riintouge.com/VIDE/"]VIDE[/URL], you can select specific files and it’ll create a zip file you can extract – this will include unopenable vtfs that will follow a cXPOS_YPOS_ZPOS.hdr.vtf naming convention, as well as specific vmts that override the defaults and tell the map what cubemaps to use. (Remember in the last section when I was talking how the engine statically casts reflections on stationary brushes? Yep, bingo, unique vmts.) The VTFs are the textures that correspond to the XYZ of your env_cubemap entities. Here’s the cool part: If you open a .bsp with cubemaps in it, you can rename the cubemaps you extracted from map A, match the names of those in map B, and manually overwrite them. When using VIDE, make sure the names are correct, import the textures from the file browser. Don’t select a relative path and you will be prompted to type one in. Make sure the path matches the existing ones directly. If you did it right, you will get a confirmation of overwrite and the .vtf files will turn bright blue until you commit your changes with a new bsp. [t]https://internethatemachinae.files.wordpress.com/2014/09/cubemaps.jpg[/t] This works exceptionally well for ‘blank space’ maps – map a box with one cubemap at the origin. You can build your box, run buildcubemaps in SFM to get the placeholder, and replace the blank cubemap with one from another map that has substance. If you’re planning a scenebuild, then you can even build a simple version of the environment you want to make in hammer and give it simple lighting specifically for the cubemap – you get the dynamics of a scene built in SFM and the cubemaps you could otherwise only get via traditional mapping. [t]https://internethatemachinae.files.wordpress.com/2014/09/scifi_containers_2.jpg[/t] I created this render box that uses an unlit grey texture for the walls. The cubemap comes from one of my sci-fi maps since I mostly make sci-fi assets, but there’s nothing stopping me from taking a cubemap from almost any map and manually placing it here. Caveat: This process may not be successful! I believe the uneditable cubemaps are locked by bsp version or vtf version, or at the very least, trying to grab cubes from a newer BSP and putting them in an older one (say a SFM\ASW bsp to a SDK13 bsp) might give you pink and purple checkerboards of death. Luckily, VIDE saves backup of your map for these kinds of reasons, but always be ready to undo a few steps. Overwriting auto-generated content always carries risk with any program; this is a really hacky way to work around alrea
Sorry, you need to Log In to post a reply to this thread.