Valve-style skybox question

Angry_Ed

L1: Registered
May 25, 2009
41
32
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.
 

RavenStryker

Former Alias: †Blade†/Xi.Cynx
aa
Nov 25, 2008
782
844
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.
 

Sgt Frag

L14: Epic Member
May 20, 2008
1,443
710
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
 
Last edited:

Angry_Ed

L1: Registered
May 25, 2009
41
32
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.
 

What Is Schwa

L6: Sharp Member
Jan 13, 2008
375
445
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.
 

Angry_Ed

L1: Registered
May 25, 2009
41
32
You'll want a little bit of nearby landscape before your long distance landscape.

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?
 

tyler

aa
Sep 11, 2013
5,102
4,621
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:

What Is Schwa

L6: Sharp Member
Jan 13, 2008
375
445
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.
 

What Is Schwa

L6: Sharp Member
Jan 13, 2008
375
445
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.?
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.
 

tyler

aa
Sep 11, 2013
5,102
4,621
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.
 

Motanum

L2: Junior Member
Jan 30, 2011
53
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.