changing skybox ingame

WAR_Nuker

Newbie
Joined
Mar 29, 2005
Messages
627
Reaction score
0
i know its kind of odd but i want to make a button that switches to a different skybox in-game as well as the color of the light_env and env_sun. then when i press the button again, everything is switched back. i know its a bit much and probably impossible to do, so just tell me if its doable.
 
You can't change the sky, or the colour of the environmental light. The sun supports an input to change its colour, and a named environmental light can take SetPattern inputs to change its intensity.
 
if you want to change the 3d skybox, with any geometry that accompanied it, you're proabably out of luck.

If you wanted to just change the texture of the skybox, there's probably a way to hack it.

if you use a sky_camera with a very small scale... i.e. 256 or 1024 or something, and make a moderately size cube around it (512x512x512 maybe... not so large as to be cut up too much by vbsp) then it is effectively the same as the supplied skybox.
but there's some stuff you'd have to do. you'd have to make new materials for your sky, since skybox materials cant be applied to normal geometry. you'd have to take your switchable sky textures and put them into a multi-frame vmt, one for all the ups, one for all the right-sides, etc...

then you would apply these textures to the inside faces of your hollow cube (which should probably be made with beveled edges, so you can 'fit' them easily).
These cube face brushes would be func_brush, with minimum illumination set to max (a value of 2.0, if I remember correctly), and then named.
lastly, use a env_texturetoggle to increment the texture index of the brushes' materials (the multiframe skybox materials you made) to change skybox textures.

well, in theory it would work. i haven't tried it all, myself.
 
so youre saying to simulate a skybox instead of using the regular HL2 way of doing it. That does sound like it would work. however now that i think about it....it cant work. say if you project this small skybox with a sky camera (that would work fine). however, depending on where you stand in the map, you will get closer or further to the 'walls' of the skybox depending on where you walk. with a regular skybox generated by HL2, skies look the same no matter where you stand.

i ended up making two separate maps instead. it wasnt exactly critical....but it would still be a nice feature if you wanted to make a single map that cycles from day to night and such.
 
Im thinking that you do a 3d skybox but instead of using the Toolsskybox texture you use the actual pictures and tie them to a func_train. And then you make another copy of that train with different textures. And then you simple make a nodraw box, place a sky_camera in it and also put the first train in there... Then when the button is pressed you Send the first train out and the second one in at lightning speeds.

In my head that works. But i doubt it does in Source :S
 
WAR_Nuker said:
say if you project this small skybox with a sky camera (that would work fine). however, depending on where you stand in the map, you will get closer or further to the 'walls' of the skybox depending on where you walk.
yes, I know. that's why I suggest using a high 'scale' value in your sky_camera. A 512 unit cube while using 1024 for the value of scale should produce a skybox where traversing a map the maximum size possible (16000 and some units from the origin in both directions) would translate to less then 1/10th of the virtual skybox. The skybox perspective shift would be barely noticed.

bit OT, but does anyone know what the max value of the skybox scale value is? I tested it at 256 and it seemed to be working... just wondering =)
 
well, i did a little checking and thought I'd follow up on my own question.

skybox scale values are clamped between values of 1 and 2047, and are not limited to powers of two. values less than 1 are set to 1. values above 2047 are set to <value> mod 2048. in other words: a scale value of 4112 is 4112 -2048 -2048 = 16
the final skybox scale used will be 16.

using a 48 unit cubed fake-skybox with a scale of 2047 produced a change of perspective that you could barely notice change while running at full speed. flying with noclip, it was more obvious. With a 512 unit cubed fake-skybox, it was barely detectable while flying with noclip. with larger sizes of fake skybox, you could reduce this further.

Well, anyway, it's certainly possible to fake a changing non-3d skybox pretty well.
 
Back
Top