Sign in to follow this  
ryanmfw

Curvature of the Earth

Recommended Posts

ryanmfw    154
Well hello, I'm currently writing an RTS in which most of the action occurs at sea. The map is massive, being about 250,000 square miles(which isn't a problem storage wise, as it's 99% ocean). Anyway, I want to include a few things to give a sense of scale as well as just make it look better. First, I would like to have ships sink below the horizon, which is pretty easy to do mathematically. I'm unsure of how to do that graphically. Would I just move the ship downwards when I render it? Second, is there any way to make good clouds? I read a gamasutra article awhile ago on the MS Flight Simulator 2k4 clouds, but that was actually more than I need at the moment. Third, I was wondering if there are any good tutorials for doing realistic moving water? As it's a *cough* fairly important part of my game, I would like to make it look good. If it's possible as well, I'm thinking about having two different water animations(shaders, maybe?), one for close by water, and one for far away water, as the two do look different. Ah, any help on any of these would be great! I'm making slow progress(of course...), but it's getting closer every couple years(*cough*). Thanks! Ryan

Share this post


Link to post
Share on other sites
Kalidor    1087
1) I've never actually spent any time out on the open seas observing what happens, so this is just speculation. I would think that the ship would need to be very large to be able to clearly see it sinking below the horizon. But often times, specifically for games, realistic isn't as important as "cool but still somewhat believable." So just tossing out an idea for it... make sure you the depth value of the ship is far enough to be behind everything else and than you could just slowly translate down so it appears to move behind the water. Again, not too sure how feasible it would be, just a suggestion.

2) I think "planar" clouds (planar in quotes because sometimes the corners of the "plane" are pulled down some to create a curved look) would be great for this situation. Here's the great sky thread in which Yann L goes into a lot of depth of how he did those skies. That whole thread is a definite read if you haven't yet.

3) Here's a great article about water rendering by Yann L. It's a great place to start and if you still need more help after it you should be able to find some help through google or coming back here and asking more questions.

- Kalidor

EDIT: Just reread my post, sorry about all the "great" adjectives. :P

Share this post


Link to post
Share on other sites
ryanmfw    154
1) Good point, hmmm, maybe I'll work on my other idea, which was a change in time when you moved(if it was a bigger map that covered half the globe, it would become night if you moved from one side to the other, or something like that). That might be easier and probably would add more to the gameplay.

2 & 3) Given a couple years I'll understand those! Just kidding. Those are both really good, although converting the clouds to what I'm doing might take a few small changes as I wanted the clouds between the player and the water.

Thank you very much! :)

Cheers,
Ryanmfw

Share this post


Link to post
Share on other sites
JohnBolton    1372
Quote:
Original post by ryanmfw
First, I would like to have ships sink below the horizon, which is pretty easy to do mathematically. I'm unsure of how to do that graphically. Would I just move the ship downwards when I render it?
Don't forget that the water under a ship that is past the horizon is also past the horizon. That means you have to clip the water "plane" at the horizon, or at least don't draw water behind the ship. Also, you can draw the water surface as a dome instead of a plane and get a horizon that way.

Share this post


Link to post
Share on other sites
ryanmfw    154
Quote:
Original post by JohnBolton
Quote:
Original post by ryanmfw
First, I would like to have ships sink below the horizon, which is pretty easy to do mathematically. I'm unsure of how to do that graphically. Would I just move the ship downwards when I render it?
Don't forget that the water under a ship that is past the horizon is also past the horizon. That means you have to clip the water "plane" at the horizon, or at least don't draw water behind the ship. Also, you can draw the water surface as a dome instead of a plane and get a horizon that way.


I would probably just make it a plane that extends to the horizon(not an infinite horizon), and have ships past there be moved down.

This just made me think of something interesting though, how am I going to make the horizon curved? I guess I'll have to do a dome anyway, which just seems like more work. This is further convincing me to try something else and abandon this bit of realism. :)

Cheers,
Ryanmfw

Share this post


Link to post
Share on other sites
Leif    122
I use the exact same technique myself, large water plane and have the ships sink lower and lower based on a simple formula that represents the curvature of the earth. It works well and the ships disappear in a natural way. The smoke from them is the first to be sighted and by climbing higher on my own ship I do see a little more of the ships far away. Although it only works as long as your viewpoint are fairly close to the sea level.

The horizon isn’t curved, it’s a flat line.

Leif…

Share this post


Link to post
Share on other sites
Trap    684
Quote:
Original post by Leif
The horizon isn’t curved, it’s a flat line.

True, but amazingly counterintuitive.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Hi,

My seem like the easy solution, but why not just scale the ship down in size has it get closer to the horizen?

And i think NVIDIA has a nice ship and sea demo out...!

Hope that helps,

Rob :-D

Share this post


Link to post
Share on other sites
FlowingOoze    236
Why not doit the "easy" way, and simply make your level curve as an ocean would.
If your map is a sufficiently less than 1/6 of the surface of earth, then you can simply calculate the Z coordinates of your maps vertices so that the length of the vertex vector is R (= radius of earth.) That is if you have a vertex like v= (x,y,0) , you make a new one v'=(x,y,z) where z=sqrt(R-x^2-y^2).
Now all you need to do to make your ships go below horizont is to make sure they stay on the waterline. Also you need to make sure the ships bellies point down to the center of the earth (at (0,0,0)).
If you have islands and they are small enough, you can just place them in the ocean like the ships, or you can do a similar trick on them too.

Share this post


Link to post
Share on other sites
CyberSlag5k    514
I recommend you check www.vterrain.org. I'm not sure how often the site gets updated, I haven't been there in a year or two, but they've got articles on stuff like that.

Share this post


Link to post
Share on other sites
JohnBolton    1372
Quote:
Original post by Trap
Quote:
Original post by Leif
The horizon isn’t curved, it’s a flat line.

True, but amazingly counterintuitive.


Huh? If the horizon weren't curved, it would be awfully hard for it to form a circle.

If you go to the top of Heavenly (a ski resort) and look out over Lake Tahoe, you can definitely see the curvature of the earth. You've seen movies of the earth from the space huttle. Are you saying that the horizon you see in those movies is not curved? Take a look at the moon. Are you saying that it's horizon is not curved?

Of course, we're talking semantics here. The horizon is both curved and flat -- it is a circle that lies in a plane.

Share this post


Link to post
Share on other sites
ryanmfw    154
I wish I could say more right now, but hopefully this will suffice: Thanks!

The curved versus flat debate is interesting though. Don't you think someone would have realized earlier that the world was round if they could see the curvature that easily?

Thank you,
Ryanmfw


Share this post


Link to post
Share on other sites
Extrarius    1412
Quote:
Original post by ryanmfw
I wish I could say more right now, but hopefully this will suffice: Thanks!

The curved versus flat debate is interesting though. Don't you think someone would have realized earlier that the world was round if they could see the curvature that easily?

Thank you,
Ryanmfw
The horizon is a circle around you, so it appears to be at the same level in all directions. It doesn't curve up/down, it curves toward you.

Share this post


Link to post
Share on other sites
JohnBolton    1372
Quote:
Original post by ryanmfw
Don't you think someone would have realized earlier that the world was round if they could see the curvature that easily?
Excerpts from the NASA website The Round Earth and Christopher Columbus:

Sometimes the claim is made that those who opposed Columbus thought the Earth was flat, but that wasn't the case at all. Even in ancient times sailors knew that the Earth was round and scientists not only suspected it was a sphere, but even estimated its size.
...
All these results were known to the panel of experts which King Ferdinand appointed to examine the proposal made by Columbus. They turned Columbus down, because using the original value by Eratosthenes
[ca 200 B.C.], they calculated how far India was to the west of Spain, and concluded that the distance was far too great.
Quote:
Original post by Extrarius
The horizon is a circle around you, so it appears to be at the same level in all directions. It doesn't curve up/down, it curves toward you.

If you are standing above the sphere, the plane of the horizon is underneath you, so when you look at the horizon, the plane is tilted and it curves "down" on both sides of you. Again, consider the extreme case -- the moon's horizon as viewed from the earth.

Share this post


Link to post
Share on other sites
Extrarius    1412
Quote:
Original post by JohnBolton
[...]
Quote:
Original post by Extrarius
The horizon is a circle around you, so it appears to be at the same level in all directions. It doesn't curve up/down, it curves toward you.

If you are standing above the sphere, the plane of the horizon is underneath you, so when you look at the horizon, the plane is tilted and it curves "down" on both sides of you. Again, consider the extreme case -- the moon's horizon as viewed from the earth.
Hrmm, true, but in most cases that curvature will be so small you won't notice it. Of course, it might be important if you're seeing a 'birds eye view' of the ocean as you might in an RTS game such as this.

Share this post


Link to post
Share on other sites
Leif    122
It doesn’t curve down, if it did how come that the horizon is on the same height if you turn around? And as for the moon, if you measure the distance to the “horizon” all around the periphery you would notice that it doesn’t curve down either. It’s a flat circle.

Leif…

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this