View previous topic :: View next topic |
Author |
Message |
Preach
Joined: 25 Nov 2004 Posts: 122
|
Posted: Sun Dec 23, 2007 12:43 am Post subject: 3D Skyboxes |
|
|
Exactly how difficult would it be to add support for 3d skyboxes - the kind of thing you see in half-life 2 - into the quake engine? The sort of thing I had in mind is having a worldspawn key called "skymap" that would tell you the bsp file to render in place of a 2D skybox - although to complicate things that bsp could have a conventional 2D skybox as well. The "skymap" could, if need be, be made at 1/16th scale so that you could render much further than usual with this.
I have this vague idea that the crude way of doing it would be to render the "skymap" in full first, then render the world - omitting the sky polygons - without clearing the buffer. But instantly two problems strike me with that: one is that there would be a lot of overdraw, the other is that this method leads to a problem from early ports of quake engines. You start to see bits of the map through what should be "solid", line of sight blocking sky. I don't think either of these things are a huge hurdle to overcome, but I've been wrong before, so thoughts welcome... |
|
Back to top |
|
 |
leileilol

Joined: 15 Oct 2004 Posts: 1321
|
Posted: Sun Dec 23, 2007 5:28 am Post subject: |
|
|
q3map2's already got a hacky way, try it, it's _skyroom entity _________________
 |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Sun Dec 23, 2007 2:26 pm Post subject: |
|
|
You don't need a separated .bsp to do that. Just be sure the map has a sealed room, render normally from inside it (ie. including ordinary sky textures or conventional skyboxes), then clear the Z buffer and render the world skipping any sky polygons. A simple "skyroom" coordinate in the worldspawn info would be enough. OTOH, separated sky rooms would help in the case of original id maps. _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/ |
|
Back to top |
|
 |
Labman
Joined: 05 Nov 2004 Posts: 51 Location: Brisbane, Australia
|
Posted: Sun Dec 30, 2007 7:22 am Post subject: |
|
|
frag.machine wrote: | You don't need a separated .bsp to do that. Just be sure the map has a sealed room, render normally from inside it (ie. including ordinary sky textures or conventional skyboxes), then clear the Z buffer and render the world skipping any sky polygons. A simple "skyroom" coordinate in the worldspawn info would be enough. OTOH, separated sky rooms would help in the case of original id maps. |
The problem with this as stated in the first post, is that on some maps you would now be able to see through the skybox into other parts of the map which were previously not visible.
Another way would be to render the sky polys with a stencil buffer set and then after rendering the world, clear the depth buffer and draw your sky over the the screen only where the stencil was set. This would also lower your overdraw as well as not show through to other parts of the map. |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Wed Jan 02, 2008 4:14 pm Post subject: |
|
|
Labman wrote: | Another way would be to render the sky polys with a stencil buffer set and then after rendering the world, clear the depth buffer and draw your sky over the the screen only where the stencil was set. This would also lower your overdraw as well as not show through to other parts of the map. |
Stencil buffer is too complicated and breaks things like stencil shadows.
Just draw the sky surfaces like normal... except draw them first and turn the colour buffer writes off. glColorMask(0,0,0,0). then when you draw the rest of the world, the normal z buffer tests will prevent anything behind the sky from being drawn.
I'm not sure how well this works with minidrivers though, but chances are, stencils are worse.
An additional cool feature would of course be if you could have entities and things moving around in the skybox too. You'd need to combine pvs on the server, but it shouldn't be too bad.
Separate skybox bsps get really awkward when it comes to game code if you want things moving around (and if they don't, what's the point?). _________________ What's a signature? |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Wed Jan 02, 2008 10:32 pm Post subject: |
|
|
I think the method LordHavoc used to talk about was to split the depth range up if a sky surface is visible. That way you don't have to scale the sky room up when you draw it or whatever to make sure it doesn't poke through the world. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Thu Jan 03, 2008 2:34 am Post subject: |
|
|
Spike wrote: |
Just draw the sky surfaces like normal... except draw them first and turn the colour buffer writes off. glColorMask(0,0,0,0). then when you draw the rest of the world, the normal z buffer tests will prevent anything behind the sky from being drawn. |
Yeah, this method looks better than my original idea. And can be used to draw regular skyboxes without the "oh-i-can-see-things-behind-the-sky" weirdness
Spike wrote: | An additional cool feature would of course be if you could have entities and things moving around in the skybox too. You'd need to combine pvs on the server, but it shouldn't be too bad. |
Of course! Things like a dragon flying in circles, for example. That would be really cool. _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/ |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Thu Jan 03, 2008 3:04 am Post subject: |
|
|
If anyone actually implements skyrooms, make sure that it is robust - Allow skyrooms to have skyrooms, and allow each to have 'parallax' scroll factors, like HL2, so they can move by a small amount so that things appear far away but not infinitely far.
frag.machine wrote: | dragon flying in circles, for example. That would be really cool. |
But remember Unreal? You could actually shoot the birds down It's unfair that they are off in magic untouchable skyroom land.
A cool thing though is allowing players or monsters to teleport to the skyroom. I think something like this was possible in UT2k4. You would appear massive in the sky to any players in the normal part of the level. Kind of like that part of Prey where you are in the small planetoid in a box. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
Urre

Joined: 05 Nov 2004 Posts: 1073 Location: Sweden
|
Posted: Thu Jan 03, 2008 8:48 am Post subject: |
|
|
Hahah, yeah. That was already possible in the original Unreal. Me and my brother played some LAN Unreal action every now and then, and once I noclipped into the skyroom just to prove that very point to my brother, and he freaked out when seeing a huge Skaarj in the sky. _________________ Look out for Twigboy |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Thu Jan 03, 2008 11:17 pm Post subject: |
|
|
Sajt wrote: | If anyone actually implements skyrooms, make sure that it is robust - Allow skyrooms to have skyrooms, and allow each to have 'parallax' scroll factors, like HL2, so they can move by a small amount so that things appear far away but not infinitely far. |
Wow, I can foresee a huge FPS drop here...
2 skyrooms may be feasible, but is it worth the effort ? Even now you barely see people using regular skyboxes, let alone something so out of the regular Quake bread and butter mapping. _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/ |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Thu Jan 03, 2008 11:36 pm Post subject: |
|
|
It's true that nobody would ever use it. The mappers don't use fancy engines.
But the use for 2 skyrooms would be one to have a distant building (like the evil Mount Doom skyscraper in HL2), which scrolls slightly as you move around, then a normal infinite skybox behind that one. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
Preach
Joined: 25 Nov 2004 Posts: 122
|
Posted: Thu Jan 03, 2008 11:57 pm Post subject: |
|
|
See, I think this would be something that mappers would use, because they use regular skyboxes all the time. In fact it was a mapper who requested this to me. The way I suggested setting it up would mean that it has sensible fallbacks in other engines(2d skyboxes then regular sky render). I agree with the parallax thing being desirable, but don't see why you'd want to chain skyrooms, what you'd gain from it... |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Fri Jan 04, 2008 12:52 am Post subject: |
|
|
Sajt wrote: | But the use for 2 skyrooms would be one to have a distant building (like the evil Mount Doom skyscraper in HL2), which scrolls slightly as you move around, then a normal infinite skybox behind that one. |
Besides, a simple elegant implementation would support 'chained' skyroomes. If you only supported one, it would be more of a hack. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
Preach
Joined: 25 Nov 2004 Posts: 122
|
Posted: Fri Jan 04, 2008 1:08 am Post subject: |
|
|
I can see the need for a regular 2D skybox behind the mount doom monolith citadel, sure, but that wouldn't need to be another skyroom, in fact that would often be worse than just a 2D-skybox. There's a lot of things that are just done better in 2D, like clouds and sun. So I'm not convinced that rendering another actual skyroom is ever gonna give you something you couldn't sensibly do with one. Robustness isn't really a factor then, sky polygons rendered in the skyroom are done as a 2D skybox, sky polygons in the actual map show the skyroom, sounds like a sensible convention. |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Sat Jan 05, 2008 1:42 am Post subject: |
|
|
Preach wrote: | I can see the need for a regular 2D skybox behind the mount doom monolith citadel, sure, but that wouldn't need to be another skyroom, in fact that would often be worse than just a 2D-skybox. There's a lot of things that are just done better in 2D, like clouds and sun. So I'm not convinced that rendering another actual skyroom is ever gonna give you something you couldn't sensibly do with one. Robustness isn't really a factor then, sky polygons rendered in the skyroom are done as a 2D skybox, sky polygons in the actual map show the skyroom, sounds like a sensible convention. |
I second that. Besides, there are more interesting effects than multiple skyrooms. For example, a long time ago MH posted in the now offline quakesrc.org forums a nice tut about implementing skydomes (2 spheric layers scrolling smoothly combined with fog) that gives to GlQuake a very impressive effect of depth. It's a really nice and original alternative to the regular skyboxes. _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/ |
|
Back to top |
|
 |
|