Help with Skybox and Reflections!

  • If you're asking a question make sure to set the thread type to be a question!

Fede22

L1: Registered
Aug 24, 2009
17
4
Hi,

I have been working on a TF map recently (one month) and, after perfectioning the layout, I decided to change the default skybox (sky_day01_01) to sky_well_01. When I ran the map again, all reflective textures like concretefloor006 now have a purple reflection. I tried connecting a nearby env_cubemap to the brush face (my map's floor) but it didn't change anything. Does anyone know how I can get the brush reflections working? Thanks.
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
Don't worry about it, everybody has to deal with it. It's not really a matter of where your env_cubemap entities are (although proper placement is still a good idea.) The problem you're seeing is that the defaultest-of-default reflection cubemap isn't present, so it uses the pink-checkerboard.

Basically, you just need to do some extra steps. Every map .bsp file actually includes (almost like a .zip file) some other smaller files within it, and the cubemaps (tiny pre-rendered snapshots used for reflections) are part of that. What you need to do is generate them.

_______________

There's a command in tf2 itself called "buildcubemaps" which runs through creating these snapshots, it then saves over the map file and packs them in. The trick is to turn off reflective shininess with mat_specular 0, then build your cube maps. The reason you turn off the specularity first is that otherwise you'll get reflections-of-reflections which contain the pink-checkerboards. (Like when one shiny surface is next to another.)

You need to do it seperately for HDR and LDR settings, if your map is compiled to use both. Use "mat_reloadallmaterials" to avoid needing to restart TF2 to see the changes.

  • Load up the map.
  • mat_specular 0;
  • buildcubemaps;
  • Wait until it's done flickering like a mad photographer.
  • mat_specular 1;
  • sv_cheats 1; to allow the next command,
  • mat_reloadallmaterials;
 
Last edited:

Fede22

L1: Registered
Aug 24, 2009
17
4
I tried that (it makes the floor reflectionless). Is there a way of making it reflective? As I said, I linked a env_cubemap to the floor, but it doesn't work.
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
Reflectionless, or just less-obviously reflecting? Try restarting TF2 and see if it looks better/unchanged from the checkerboard'ed version. I've almost never had to explicitly assign a face to an env_cubemap, placing them is usually sufficient.

If you can stand somewhere with the sniper rifle and see objects from the reflective scope, then it's working.
 
Last edited:

Fede22

L1: Registered
Aug 24, 2009
17
4
Heres the difference:

mat_specular 0:



mat_specular 1:



I would like to know if I can create a realistic reflection, like the mat_specular 1 one, but obviously not purple.:mellow:
 
Last edited:

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
You only need to temporarily turn off specularity, only while building the cubemaps. You should turn it back on afterwards. (And, of course, for best reflections you put a cubemap in the center of the room, about ~60 units off the floor.)
 
Last edited:

Fede22

L1: Registered
Aug 24, 2009
17
4
I tried that, but it didn't work, the reflections are still purple. I think it has something to do with the Well skybox. Should I change the skybox?
 

UFOslava

L1: Registered
Oct 8, 2009
36
0
Same here... after rebuilding and reloading everything is still purple, console spams with missing cubemap textures, like they were not saved...

Code:
*** Error unserializing VTF file... is the file empty?
Error reading texture header "materials/maps/pl_goldmine/c385_538_359.vtf"
*** Error unserializing VTF file... is the file empty?
Error reading texture header "materials/maps/pl_goldmine/c430_948_384.vtf"
*** Error unserializing VTF file... is the file empty?
Error reading texture header "materials/maps/pl_goldmine/c496_47_257.vtf"
*** Error unserializing VTF file... is the file empty?
Error reading texture header "materials/maps/pl_goldmine/c661_620_112.vtf"
*** Error unserializing VTF file... is the file empty?
Error reading texture header "materials/maps/pl_goldmine/c666_-40_273.vtf"
etc.
 

UFOslava

L1: Registered
Oct 8, 2009
36
0
building - no...
saving and applying - yes...
after reloading the materials only 1 cubemap was active.
Every other cubemap became checkerboard with error... as if it was not saved into bsp.
 

MoonQuake

L3: Member
Jul 18, 2009
111
21
The safest way to buildcubemaps for a map (or rebuild them actually) is the following:

- Start TF2

In the console:

sv_cheats 1
mat_specular 0
map pl_goldrush (using this map as an example)

Once in-game, in the console:

buildcubemaps

- Disconnect from the game (quit the game but don't quit TF2)

In the console:

mat_specular 1 (wait a bit for the materials to load)
map pl_goldrush (wait a bit for the cubemaps to get injected in your map)

Enjoy your new cubemaps.

I do this about 50 times a day and it never fails.


If it still fails, then it could be:

- You changed the name of the map (.bsp) and tried to reload it.
- Another application is locking the .bsp like Pakrat or an external compiler.
- I can't think of anything else. :)

MQ
 
Last edited:

UFOslava

L1: Registered
Oct 8, 2009
36
0
Yes, switching the map works, thanks!
All cubemaps are in place and working.