Jump to content
  • Advertisement
Sign in to follow this  
Mr Grinch

OpenGL Skydome Issues

This topic is 4911 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm a developer for Crown and Cutlass (screenshots), which is a 3d game in the spirit of the old Pirates! (and the new Pirates!, I suppose) game.It started as a way for me to learn some graphics, but now we have a sourceforge project and are making some good progress. It's good times. Anyway, my latest big addition is a sky dome in the naval battles. I draw a nice dome and keep it centered around the player, and have it changing color throughout the day, so for a first attempt at a sky I'm pretty pleased with it. Before I try to describe my problem, here's a screenshot of it: As you can see in the screenshot, when the viewing angle is low like that you can see that the bottom of the ocean ends. As a result, the horizon looks really bad. What can I do to improve that? Here's what I've come up with so far: 1. Just extend the bottom of the ocean farther. Problem is that as the viewpoint drops lower and lower, I'd have to keep making it go farther. This is probably the worst of my solutions. 2. Have the bottom of the ocean rise up and meet the edge of the water plane. That way all around the edge, the water and the bottom would meet up and eliminate that gap. Seems like a decent idea... 3. Set the clear color to something kind of like a mist or fog, and have the water and land (and sky dome I suppose) get more transparent as it gets farther from the player's ship. I don't want to use the opengl fog. I've tried and I'm not happy with the results that I get with it. Anyway, then I could have everything fade into the distance. This is probably the most complicated of my ideas (unless I combine 2 & 3), and I would probably have to change the background color depending on where you look and where the sun is. What do you think? Any advice?

Share this post


Link to post
Share on other sites
Advertisement
what about just lowering the skydome or extending it down further.

Share this post


Link to post
Share on other sites
Yeah, I tried that earlier tonight. It looks like this:


The problem is the space between my water surface and the bottom of the ocean.

Share this post


Link to post
Share on other sites
oh interesting, your ocean floor is kinda high isn't it ;)

What you could try is make the water edges completely opaque fading in the transparencies as you get closer to the camera/player ship, this wont be a good solution if your view is low and you lower your ocean floor though.

Share this post


Link to post
Share on other sites
I ended up going with my second idea (the bottom rises up to meet the surface around the edges). It works pretty well because when the player is in a naval battle, I move the ocean along with the player (just like you do for a sky box). That way the player never sees the edge of my water up close. Anyway, here's a screenshot of the result:

Share this post


Link to post
Share on other sites
Why not draw the sky dome as the first thing you draw, and disable z-buffering and testing during drawing it.

Then everything else, including the sea is bound to go in front of it, even if it's technically further away.

I wonder what the technique is for drawing infinite planes in opengl? I'm pretty sure there is one which uses the "w" coordinate. Failing that, merely a very large one should suffice.

Mark

Share this post


Link to post
Share on other sites
Good call. In those screenshots I was still writing to the z-buffer, but after I posted I read another "drawing sky in 3d" thread where someone mentioned it. I realized that I should be doing that, so I added it. In this case, I believe the only thing that would change is that the horizon will no longer appear slightly curved. The problem came from there being an edge of the planes for the surface and the bottom, and the fact that you could see those edges. In that sense, I guess I shouldn't have called it sky dome issues, since it was more "edge of the world issues". Anyway, even with the dome not writing to the z-buffer, it will still look funny anywhere where there is a visibile gap between the surface and the bottom. The actual problem is that you are seeing through the transparent surface onto something colored differently than the bottom. That's my thought, does that make sense? Tonight when I get some time, I'll make sure and take a screenshot.

I'm not sure about drawing infinite planes, is that possible? I could make the planes larger, but then the problem would just should show up at a lower angle.

Share this post


Link to post
Share on other sites
Technically the sea should become a perfect mirror as it approches the horizon... That would certainly get rid of your sea floor problem, however, in the middle of the ocean, you wouldn't be able to see the sea floor anyway...

Share this post


Link to post
Share on other sites
True, the water surface also shouldn't be a 2d plane. Seriously, though if I had reflections this probably wouldn't be an issue. I am not doing reflections at this point though, and my workaround (changing how the ocean floor gets drawn) is much less work to implement. I'll have to take a look at this whole issue once I decide it's time for reflections...

Anyway, here is that screenshot I said I'd put up yesterday. This is with the skydome not writing to the z-buffer and the original flat ocean floor:


This is with the fixed ocean floor (still no z-buffer writing):

Share this post


Link to post
Share on other sites
judging from your screenshots youre better off drawing the skydome LAST use glDepthRange(0.999,1.0) or something to keep it out there! this should run faster than drawing it first, also about the gap, to be absolutly certain of it not showing use a sphere instead of a dome (i recently changed from a dome to a sphere cause of this)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!