Valve-style skybox question

Discussion in 'Mapping Questions & Discussion' started by Angry_Ed, Jan 27, 2011.

  1. Angry_Ed

    Angry_Ed L1: Registered

    Messages:
    41
    Positive Ratings:
    29
    I'm trying to avoid making my skyboxes one big box (no not a hollowed-out cube brush, i do the separate brush method) surrounding the stage, and instead wish to do them the way Valve typically does it. That is to say, a skybox that is built only as far as the outdoor areas extend, with holes in the skybox geometry to allow for buildings. I am guessing this is done to cut down on render times and memory usage. The problem is I don't quite understand how this works without causing a map leak. Any help or explanation would be appreciated.
     
  2. Xi.Cynx

    aa Xi.Cynx Former Alias: †Blade†

    Messages:
    772
    Positive Ratings:
    733
    Basically this is how it goes, if by chance you look at a decompiled valve map, you will notice that they enclosed the whole level in a skybox texture where they want to view they skybox. There are no "openings" so a building can show through or anything like that. If they want a building there, they make it and then scale it down to 1/16th the size and place it in the appropriate spot within the skybox to make it look like it's there, where in reality, it's really not. now, you may see random brushes come down in the middle of levels, but that is only for optimization purposes or to stop people from seeing a certain part of the level, instead they'll see the skybox through it.
     
    • Thanks Thanks x 1
  3. Sgt Frag

    Sgt Frag L14: Epic Member

    Messages:
    1,443
    Positive Ratings:
    294
    Just think of your map as a series of hallways. Parts of the walls are buildings or cliffs. The top part of the walls is skybox TEXTURE.

    Then there is a separate skybox (literally it can be a box) at 1/16th scale with a camera in it placed off to the side of the game play area. The camera renders this stuff all the time anywhere there is skybox texture in your map so it looks like that map isn't in a hallway.

    The reason it renders better is because of the vis leafs. All the playable area is divided up into pieces called leafs. Any leafs that can be seen from the leaf the player is in are rendered, the fewer the better.
    By not having huge open, unused areas for background you save on a lot of vis leafs being created/seen.
    Since the skybox is tiny it doesn't create a bunch of unwanted visleafs. The camera just makes it look big.

    I know there's a tut on how to do it, but that's basically what happens.

    Search the tutorial forums for skybox and there are alot of guides, this looks like the most basic stuff, the others get into more complicated terrain
    http://forums.tf2maps.net/showthread.php?t=116&highlight=skybox
     
    • Thanks Thanks x 1
    Last edited: Jan 27, 2011
  4. Angry_Ed

    Angry_Ed L1: Registered

    Messages:
    41
    Positive Ratings:
    29
    All right I think that clears things up well enough for me. I knew about 3D skyboxes and such but wasn't sure how Valve was doing things. This helps a lot.
     
  5. What Is Schwa

    What Is Schwa L6: Sharp Member

    Messages:
    375
    Positive Ratings:
    220
    Also, if you're thinking long term don't use the skybox to butt up against the playing area. You'll want a little bit of nearby landscape before your long distance landscape. I made this mistake in Swift and I personally think it looks terrible.
     
  6. Angry_Ed

    Angry_Ed L1: Registered

    Messages:
    41
    Positive Ratings:
    29
    Just for clarification, you mean I should have some landscape that isn't part of the 3D skybox, but is outside the playing area, yes?

    Also one more question while I'm at it (for anybody that knows). I know that the 3D skybox builds itself reading from point (0,0,0), but does this mean the map should be roughly centered on that point or as long as the 3D skybox is built correctly with references it shouldn't matter?
     
  7. tyler

    aa tyler snail prince, master of a ruined tower

    Messages:
    5,035
    Positive Ratings:
    3,990
    The 0,0,0 thing is misdirection. People say to center your map on that so making the 3D skybox is easier, but in reality there's no reason that's much easier than anything else.

    Here's what you do:

    Put a sky_camera at a point in your map. Then copy important geometry (buildings, ground) and the camera and place it in a separate skybox area. This is your 3D skybox. Delete the camera in your main level.

    With your 3D sky selected, hit Ctrl M and reduce everything in size by .0625. Create extra 3D sky around your important geometry from earlier and then delete it. This way your 3D skybox doesn't include anything from your old map anymore.

    As long as you don't move your sky_camera around and it's still oriented correctly in your 3D skybox as it was in your level, everything will line up right.

    Does that make sense?

    Also, yes, you want to have some terrain players can't get to in your map before the 3D skybox starts. Load up a decompiled Valve map (a small one so it's easier) and look at what they are doing with regards to that. Fly outside their level and look around: you should find a separate skybox area that's much smaller. That's the 3D skybox. Hopefully by doing this you can understand what we mean. It's kinda tricky.
     
    Last edited by a moderator: Jan 28, 2011
  8. What Is Schwa

    What Is Schwa L6: Sharp Member

    Messages:
    375
    Positive Ratings:
    220
    Yes, the map origin (0,0,0) must be within the playable area of the map.

    And also yes, try to put some space between the "walls" of the playable area and the actual skybox walls. Maybe 256 units. Remember the skybox will be at 1/16h of the scale and than blown up. If the player bumps right up against the blown up textures there can be some noticeable loss in visual quality. So try having a fence, 256 units of landscape beyond the fence, and than your skybox.

    Also when planning for your skybox consider what stuff you want visible from ALL locations. Sometimes it isn't always best to put your details in the skybox. Everything in the skybox will be rendered whenever you can see a skybox texture. So sometimes it is better to put your detail in the area you are working on and leave the skybox alone.
     
  9. What Is Schwa

    What Is Schwa L6: Sharp Member

    Messages:
    375
    Positive Ratings:
    220
    I've had problems if the origin of hammer (0,0,0) isn't in my playable area. Perhaps I'm alone in this.

    You are correct that the sky camera will align to wherever you put it. However, for convenience it is typically easiest to put it in the map origin. Your mileage may vary.
     
  10. tyler

    aa tyler snail prince, master of a ruined tower

    Messages:
    5,035
    Positive Ratings:
    3,990
    I don't think I've ever made a map with 0,0,0 not in the main level. I mean, Hammer starts you off staring right at it. Hard not to include it in my experience.
     
  11. Motanum

    Motanum L2: Junior Member

    Messages:
    53
    Positive Ratings:
    13
    When scaling and moving world geometry, toogle the texture lock buttons, so that the textures scale down and align to the original level!

    Well, you can start at 0,0,0 but you dont really know if you will deviate more to one side.
     
  12. tyler

    aa tyler snail prince, master of a ruined tower

    Messages:
    5,035
    Positive Ratings:
    3,990
    This one :texlock: