Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Objects not showing thru Skybox

Author
Message
LightningSky
16
Years of Service
User Offline
Joined: 22nd Feb 2010
Location:
Posted: 2nd Nov 2013 00:38
Yes, another skybox questions. I've scoured this forum trying to find out how people are using skyboxes. As with others on these forums I to am developing a space sim. I'm using large numbers (yes I'm well aware of the float issues). What I don't want to do is set the skybox out to 4 billion kilometers (game unit is 1 meter) to cover the depth of a solar system. In doing some testing I turned of the ZWRITE on an object and every object behind it showed thru. I thought GREAT, I want this on my skybox so that I can put it out oh say 5000 units from the camera (aka player) and have all of the system objects show thru. Unfortunately, this is not happening. None of the objects show thru my skybox (see code snippet). I'm missing something simple, I know it, but I just don't see it.



- A man from nowhere, prophesized to fail, blazed beyond the brightest of them all.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Nov 2013 14:03 Edited at: 2nd Nov 2013 20:00
Quote: "None of the objects show thru my skybox (see code snippet)."


Your code snippet doesn't show us how you are creating your objects or how you are using those functions. I can't see anything wrong with your snippet. Here's a complete working demo using your code (Edit except I used some images I had handy ):



In other words it seems likely that the problem is in the code you didn't show us.

Aside: thanks for reminding me of that disable zwrite trick.

Edit Not convinced this will always work. If distant objects are drawn first won't they get hidden by the skybox? Perhaps you need to change the draw order somehow?

Edit2 This should fix the draw order issue. Not convinced it's the best way to do it though.





Powered by Free Banners
Derek Darkly
14
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 2nd Nov 2013 18:42
Correct me if I'm wrong, but...

The size of your skybox shouldn't affect the performance of your game since it's still the same amount of vertices no matter how large it is. I would go ahead and scale it up past your in-game objects. (You may want to use a texture flag of 1 when loading the images.)

You might also want to consider creating your skybox panels as limbs so you can position the entire thing as one object instead of moving 6 panels individually.

D.D.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Nov 2013 18:46
If you scale it up too much you might get problems with the camera range if I recall correctly. Problems like z-fighting will tend to increase for example.



Powered by Free Banners
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 2nd Nov 2013 20:22
Quote: "Problems like z-fighting will tend to increase"

This is a biggie.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Nov 2013 21:44
Quote: "You might also want to consider creating your skybox panels as limbs so you can position the entire thing as one object instead of moving 6 panels individually."


Very true.

There are several things I'd change in the code but I'm trying to isolate the main problem first. We need more input from LightningSky.



Powered by Free Banners
LightningSky
16
Years of Service
User Offline
Joined: 22nd Feb 2010
Location:
Posted: 3rd Nov 2013 01:21 Edited at: 3rd Nov 2013 01:24
Thanks for responding. The objects at the moment are basic spheres (MAKE OBJECT SPHERE) in the system, drawn with vector distances ranging from 4bil units out to 779bil units. The LENGTH VECTOR3 command actually shows the correct values when printing them to the screen, which is cool.

I went ahead and actually set the skybox values to 10bil and so far there appears to be zero performance hit on the scene. I've got the planets (sphere's) rendering at anywhere from 17,000 to 40,000 units in size with the sun object at 1.4mil units. When flying to the sun I definitely see the zbuffer issue (the hazing or pixelation if that is the correct term). I think someone mentioned turning of the ZWRITE or ZREAD of the object until it's within a certain distance from the camera.

What do others do with skyboxes? With having it out that far I was worried about a performance hit once all of the other objects were added in. I've finished an asteroid routine so I'm going to insert that code into my main project to see, with the skybox, how it performs. I'm following the advice I found on these forums on keeping the camera 0,0,0 and having all of the objects move around me. Couldn't believe how easy this turned out to be.

I'll keep playing with it, but would like to hear what others have run into with their skybox processes. I greatly appreciate everyone's input. I've learned a ton from these forums so far.

* EDIT * Forgot to mention that I no longer use the AdjustSkyBox routine now that I keep the camera at origin.

- A man from nowhere, prophesized to fail, blazed beyond the brightest of them all.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd Nov 2013 01:51
Sounds like you've found a solution. What was the key point you missed when you asked

Quote: "I'm missing something simple, I know it, but I just don't see it."


?



Powered by Free Banners
LightningSky
16
Years of Service
User Offline
Joined: 22nd Feb 2010
Location:
Posted: 3rd Nov 2013 01:58
It had to do with the Zbuffer. I had a sphere with a texture on it. I disabled the ZWRITE on it and everything behind the object shown thru. So I thought COOL, I want to have a plane that I draw close to the camera and have all of the system objects show thru it, thinking I couldn't have my skybox out as far as the solar system. I never could get the PLANE or PLAIN object with texture on it to allow objects behind it show thru. Well, GHOSTing it kind of worked, but with the sphere it worked great. I suppose I could use a sphere for my skybox,but the the textures I have on 6 planes looks really nice.

Long story short, my original post was regarding why I couldn't get objects to show thru my textured planes.

- A man from nowhere, prophesized to fail, blazed beyond the brightest of them all.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd Nov 2013 11:58
That was the problem I think I fixed. However, you seem to have found another solution.



Powered by Free Banners
LightningSky
16
Years of Service
User Offline
Joined: 22nd Feb 2010
Location:
Posted: 3rd Nov 2013 15:50
so far, having the skybox out at the far position of the universe with the objects moving around the camera position at origin seems to be working fine.

@Derek Darkly, I'm intrigued by this idea. I need to become proficient in working with limbs.

Again, thanks everyone for your input.

- A man from nowhere, prophesized to fail, blazed beyond the brightest of them all.
Derek Darkly
14
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 5th Nov 2013 18:30
Quote: "@Derek Darkly, I'm intrigued by this idea. I need to become proficient in working with limbs."


It's pretty easy... just make a single plane mesh (MAKE OBJECT PLAIN then MAKE MESH FROM OBJECT) then use ADD LIMB on a base plane object that has been scaled to zero.

Personally, I have abandoned Skyboxes in favor of Skydomes (half sphere) because you can use ALPHA MAPPING/GHOSTING on a couple of these domes together against a suitable backdrop color and scroll some cloud textures independently for a nice looking sky.

D.D.
LightningSky
16
Years of Service
User Offline
Joined: 22nd Feb 2010
Location:
Posted: 7th Nov 2013 05:28
Thanks Derek, I'm playing around with the limb commands.

- A man from nowhere, prophesized to fail, blazed beyond the brightest of them all.

Login to post a reply

Server time is: 2026-07-07 05:59:11
Your offset time is: 2026-07-07 05:59:11