Can 3dgs use a 3d skybox like in hl2?

Posted By: Grim_Jim

Can 3dgs use a 3d skybox like in hl2? - 10/15/06 21:34

Can 3dgs make use of a 3d skybox like in hl2? (sorry if this is obvious im still new to this engine) If it can could someone describe how this is done or point me to a tutorial on it?
Posted By: ventilator

Re: Can 3dgs use a 3d skybox like in hl2? - 10/15/06 21:44

i am not 100% what is meant with "3d skybox" but i think 3dgs can do it. just use two views on top of each other.
Posted By: Grim_Jim

Re: Can 3dgs use a 3d skybox like in hl2? - 10/15/06 21:50

3d skybox as in a seperate area of your map that is scalled down and projected onto the background so you have 3d elments in your background. Here is a tutorial on how to make one in hammer I hope that explanes it a bit better.

http://www.gamedesign.net/node/777


Posted By: ventilator

Re: Can 3dgs use a 3d skybox like in hl2? - 10/15/06 21:53

Quote:

its like a seperate area of your map that is scalled down and projected onto the background so you have 3d elments in a background.


yes, that's what i thought. you can do it in 3dgs by using two cameras/views in layers on top of each other. the skybox camera always has to rotate with your other camera.
Posted By: Grim_Jim

Re: Can 3dgs use a 3d skybox like in hl2? - 10/15/06 21:57

Awsome! I figured 3dgs could handle it. Any chance there might be a tutorial out on this subject?
Posted By: Captain_Kiyaku

Re: Can 3dgs use a 3d skybox like in hl2? - 10/15/06 21:57

what advantage does it have? oO
Posted By: Grim_Jim

Re: Can 3dgs use a 3d skybox like in hl2? *DELETED* - 10/15/06 21:59

Post deleted by Grim_Jim
Posted By: Captain_Kiyaku

Re: Can 3dgs use a 3d skybox like in hl2? - 10/15/06 22:08

but can't you just build the scene for the skybox around your level? why do you have to render it on another view and put it into the background? oO
Posted By: Grim_Jim

Re: Can 3dgs use a 3d skybox like in hl2? - 10/15/06 22:16

so I guess my next question is how do you use a view as a map?

Im thinking that it is like setting up a quick mirror. k well im off to research on how to do that.
Posted By: Grim_Jim

Re: Can 3dgs use a 3d skybox like in hl2? - 10/16/06 12:43

Ack, the tutorial for a quick mirror is not what I expected it to be. Darnnit, anyone know of a tutorial on useing a camera for a map?
Posted By: ventilator

Re: Can 3dgs use a 3d skybox like in hl2? - 10/16/06 12:53

i don't think there is a tutorial for that but it's simple (if you aren't a 3dgs beginner ).

basically you just have to define a second view:

Code:

view skyview
{
x = 2000; // place it where you geometry for the 3d-skycube is
y = 2000;
z = 1000;
layer = -10; // set the layer lower than the default camera
size_x = 1024; // set the size to your screen resolution
size_y = 768;
flags = visible;
}



always rotate your skyview with the default camera:

Code:

starter rotateskyview
{
while(1)
{
vec_set(skyview.pan, camera.pan);
wait(1);
}
}



and make sure you don't use a background color otherwise the lower layer won't be visible:

Code:

vec_set(sky_color, vector(0, 0, 0)); // put this into your main function for example



(everything off the top of my head so look into the manual if something doesn't work because i used wrong parameter names or made some other mistake...)
Posted By: Grim_Jim

Re: Can 3dgs use a 3d skybox like in hl2? - 10/19/06 00:55

Thats sad, I read somewhere that 3dgs had a helpfull comunity. I guess I read wrong.
Posted By: ventilator

Re: Can 3dgs use a 3d skybox like in hl2? - 10/19/06 01:10

hm? didn't my last post point you into the right direction? where exactly are you stuck? maybe you have to learn some basic scripting first?
Posted By: JibbSmart

Re: Can 3dgs use a 3d skybox like in hl2? - 10/20/06 06:39

this seems a lot easier:
Quote:

sky.scene
This flag is used for a sky model. Sky model polygons are drawn at infinite z buffer distance, thus not covering any other objects in the level. If this flag is not set, the sky model can cover level elements according to its distance.
Range:
on - model does not cover level objects.
off - normal position(default).
Type:
flag (sky definition only)
Example:
Code:
sky mountain
{
type = <mountainsphere.mdl>;
layer = 3;
scale_x = 0.25;
flags = scene,visible;
}




quoted from the manual.

Quote:

Thats sad, I read somewhere that 3dgs had a helpfull comunity. I guess I read wrong.


hmm... i think he was referring to kihaku, not u ventilator. i mean, dont take this the wrong way, kihaku, but the question was whether or not A6 can use 3D skyboxes (like in half life 2), and if so, how to do it. asking him why is not helpful. though, i hav to say that's the only reason i can think of for the above quote. grim_jim, u were really stretching it to say that A6 has an unhelpful community, and while what kihaku asked and said wasn't a help, it was obviously intended to point u in a better direction or to actually find out for him/herself why u wanted to do this. to answer the question about why, however, i would recommend playing half life 2. it has awesome backgrounds (such as the citadel) which are fully animated, full 3D, and since they are rendered in the background they have the advantage of allowing the developer to make it with minimal detail while still looking awesome, because they'll always be seen from the exact same position.

julz
Posted By: Zio

Re: Can 3dgs use a 3d skybox like in hl2? - 10/20/06 21:40

Quote:

this seems a lot easier:
Quote:

sky.scene
This flag is used for a sky model. Sky model polygons are drawn at infinite z buffer distance, thus not covering any other objects in the level. If this flag is not set, the sky model can cover level elements according to its distance.
Range:
on - model does not cover level objects.
off - normal position(default).
Type:
flag (sky definition only)
Example:
Code:
sky mountain
{
type = <mountainsphere.mdl>;
layer = 3;
scale_x = 0.25;
flags = scene,visible;
}




quoted from the manual.





I don't know why, but the scene flag has NEVER worked for me. I still have to scale sky objects up to ridiculous sizes to prevent them from clipping normal geometry.

So, I decided to try duplicating HL2's 3d skybox method, and I got it working perfectly.

Code:

// Don't forget to set bg_color.blue to 0
view skycam
{
layer = 0;
flags = visible;
}

function initCamera()
{
// This is where your hidden skybox is, either above or below the main level
var skybox_z = -768;

while(1)
{
vec_set(temp.x,camera.x);
vec_scale(temp.x,0.16);
vec_set(skycam.x,temp.x);
skycam.z = skybox_z;
vec_set(skycam.pan,camera.pan);
wait(1);
}
}



The code works great, the trick is properly making your level. Any HL2 mappers already know how.

You make your map as normal. Once you've got it done (or mostly done), make a cube and scale it so that it just barely covers your entire map. Then move the cube way above or below your level, some place out of sight so the player wont see it. Scale the cube down by 0.16.

This cube is now the guide for your skybox. Build your skybox around this cube. Once you've got the skybox made, delete your guide cube.

Make sure your skybox is directly above or below your level, not off to the side or anything. Make a note of how far above/below it is, and put this distance into the skybox_z value.

Be sure that your main level does NOT have a skycube surrounding it! That's right, you want the leaks that normally cause the hall of mirrors effect. What happens is, the skycam view is rendered behind the normal camera view, filling in the background areas. The skycam duplicates the cameras movement, but on a 1/16th scale, the same scale we built our skybox.

Since the skybox environment is made up of normal geometry and models and whatnot, you can use shaders and everything else you normally use in a level, making you able to make very impressive skyboxes. But since it's on a 1/16th scale, the impact on performance is minimal. You can make seemingly large background environments, when in reality they are tiny.

This page has a lot of information on how this method works, although its a bit different to set up in HL2 than 3DGS, but that's expected.

http://www.valve-erc.com/srcsdk/Levels/3d_skyboxes.html
Posted By: JibbSmart

Re: Can 3dgs use a 3d skybox like in hl2? - 10/23/06 07:15

that's pretty cool! good tricks there but camera movement is IMHO unneccessary. just like a normal sky cube, u aren't meant to actually be able to get any closer to any of the background scenery, which further improves performance because u kno exactly what polygons are going to be visible and how high the texture resolutions need to be in order to maintain good-looking detail. i guess u r right in saying that u could save a little performance by putting scenerey in like that and still having it move when the camera moves.

the fact that the scene flag doesn't work is disappointing i had experienced that problem ages and ages ago, but wasn't aware that it still doesn't work, so i'll bring it up in Bug Hunt

julz
Posted By: Zio

Re: Can 3dgs use a 3d skybox like in hl2? - 10/23/06 20:38

The camera movement actually helps a lot, it gives you a lot more options with your 3d skybox. If you've ever played HL2, you can see why. You can have buildings and terrain be in your skybox, and since the camera moves with the player movement, it looks completely seamless.

I want to put together a little level showing this in action, I'll post it if I come up with something.
Posted By: Grafton

Re: Can 3dgs use a 3d skybox like in hl2? - 10/24/06 00:37

Quote:

I want to put together a little level showing this in action, I'll post it if I come up with something



That would be nice, then we could see firsthand what the advantages are over a
regular skybox.
Posted By: JibbSmart

Re: Can 3dgs use a 3d skybox like in hl2? - 10/24/06 07:40

i hav played HL2, and i cannot remember a bit where it has camera movement with the skybox. the main example i can think of is in the early levels when u can see the citadel. it is a 3D, animated skybox, but the camera does not move with it (at least not in those levels, i can't be bothered playing through and looking for it). maybe it has a sky layer that does move, but that is unrelated.

i see very little point with having the skybox simulate camera movement because it is just a waste of code and processing power: why not have full size scenery with lower-res textures and no collision detection? the size of the model doesn't matter much at all (to my knowledge), as it is still the same amount of points and texels seen on-screen. to me it sounds like extra work for nothing, so please give examples of improved framerate and explanations of why it actually helps. i guess if u can save level size vastly by having a miniature skybox it could be helpful, but if the background is on that sort of scale i dont see why u wouldn't use an ordinary skybox.

please give explanations and examples of how and why it actually improves framerate! thanks

julz
© 2024 lite-C Forums