Help with Skybox and Reflections!

Discussion in 'Mapping Questions & Discussion' started by Fede22, Aug 24, 2009.

  1. Fede22

    Fede22 L1: Registered

    Messages:
    17
    Positive Ratings:
    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.
     
  2. Terr

    aa Terr Cranky Coder

    Messages:
    1,591
    Positive Ratings:
    405
    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;
     
    • Thanks Thanks x 5
    Last edited: Aug 24, 2009
  3. Fede22

    Fede22 L1: Registered

    Messages:
    17
    Positive Ratings:
    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.
     
  4. Terr

    aa Terr Cranky Coder

    Messages:
    1,591
    Positive Ratings:
    405
    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: Aug 24, 2009
  5. Fede22

    Fede22 L1: Registered

    Messages:
    17
    Positive Ratings:
    4
    Heres the difference:

    mat_specular 0:

    [​IMG] [​IMG]

    mat_specular 1:

    [​IMG] [​IMG]

    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: Aug 24, 2009
  6. Terr

    aa Terr Cranky Coder

    Messages:
    1,591
    Positive Ratings:
    405
    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: Aug 24, 2009
  7. Fede22

    Fede22 L1: Registered

    Messages:
    17
    Positive Ratings:
    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?
     
  8. UFOslava

    UFOslava L1: Registered

    Messages:
    36
    Positive Ratings:
    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.
     
  9. Terr

    aa Terr Cranky Coder

    Messages:
    1,591
    Positive Ratings:
    405
    Huh. Was there an error building the cubemaps?
     
  10. UFOslava

    UFOslava L1: Registered

    Messages:
    36
    Positive Ratings:
    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.
     
  11. MoonQuake

    MoonQuake L3: Member

    Messages:
    111
    Positive Ratings:
    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
     
    • Thanks Thanks x 2
    Last edited: Oct 14, 2009
  12. Dr. ROCKZO

    Dr. ROCKZO L8: Fancy Shmancy Member

    Messages:
    580
    Positive Ratings:
    159
    Yes, make sure you switch the map after building the Cubemaps
     
    • Thanks Thanks x 1
  13. UFOslava

    UFOslava L1: Registered

    Messages:
    36
    Positive Ratings:
    0
    Yes, switching the map works, thanks!
    All cubemaps are in place and working.