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.

3 Dimensional Chat / Seamless space to atmosphere transitions, anyone know how?

Author
Message
Raptor1313666
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location:
Posted: 31st May 2003 19:58
Greetings,

I have posted this question in a couple of places, but very few people have been able to help out. I'm hoping that maybe someone here can assist me (crosses fingers).

I am not necessarily in search of code, but instead in search of a generalized, language inspecific concept of how to do a seamless transition from space to atmosphere in a 3D space game (I'm using both DarkBasic and Blitz3D at the moment, playing with both). Primarily, I am looking to create a game similar to Elite II: Frontier (mine will be relatively open-ended as well, but a different style of game), and really wanted to re-create the effect (or actuality) of taking a ship from outer space down into the atmosphere of a planet without any loading "stutter" or resorting to a load screen of some type.

The main problems that I seem to be having in conceptualizing all this is that I cannot seem to figure out an efficient way to handle the planet/solar system scale. One method seems to be the most straight-forward: place the planets/stars in the 3D world at actual size, and deal with some really really large values as you dynamically "stream" the planetary surface data (cities and other geographic landmarks) as the player approaches. The reason I'm uncertain about this (and I haven't yet been able to put it in practice due to my day job) is because I'm uncertain about how to handle such massive values for sphere size and distance from surface. That and the fact that you can see other planets and stars from such a high distance away (and from within atmospheres) you'd have to maintain a gargantuanly huge draw distance (or maintain three or four levels of draw distance to handle stars, planets, moons, and surface details).

The other method suggested that I place the planets and stars in the world at a reduced scale. As the player's ship reached a specified "horizon" point, I would stop the actual forward motion of the ship technically (while still visually maintaining the illusion of forward motion) and begin to scale the planet and its contents to a larger size. After a certain scale, I could possibly get rid of the sphere in its entirety and just generate some terrain underneath the player. The problem with this one is that it doesn't take into account other ships in the universe. For example, if an A.I. ship chooses to "land" on a planet, the scaling routines would not scale the planet appropriately and it would appear as though a rather large ship has landed on that planet. The way around it would be to have an inverse scaling routine that handles other ships as they approach a planet, but not if they approach a planet WITH the player's ship.

As you can see, the latter method can get quite unwieldy when dealing with relative position and scale between ships and planets.

So, does anyone else have any other possible methods? Does anyone know how it was done in Elite II: Frontier and Frontier: First Encounters? Again, all I'm looking for is more of a concept method that I can then break out into code (within a language of my choice). I'm only a hobbiest programmer at the moment, so my skills may not be up to par in any single language just yet. But I have had some experience dealing with conceptual logic stuff like this in the past and I can pretty much learn near-anything.

Any help would be greatly appreciated. Thanks in advance!
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 31st May 2003 21:03
I've managed huge distance planet scaling, scaling the position and size of a planet so you can still see it when 4,500,000 units away with a draw distance of 7000. However this doesn't work at the other end, I haven't found a simple formula to scale the planets back up again when you approach.

Frontier: first encounters seems to have obvious LOD planets, you can see massive polygons appearing and disappearing in the terrain as the planet rearranges itself when you approach.

Once I was but the learner,
now, I am the Master.
Raptor1313666
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location:
Posted: 31st May 2003 21:48
Yeah, I know the planetary geography was heavily LOD'd. But what about the planets and stars in general? Does it deal with really large values for the star and planet sizes and distances? Or does it actually scale, like you've said you do?

What I'd like to try and cobble together is at least a little project that will display an untextured planet (of an arbitrary color), allow me to fly towards and "into" that planet, watching as some generic terrain "pops" into place, and land. All while doing that I need to maintain control of the spacecraft.

At the current moment, the sharp LOD transitions like Frontier and FFE had aren't an issue. I'll be happy if I could clone just that one part of those games!

ZeroGravity
20
Years of Service
User Offline
Joined: 31st May 2003
Location:
Posted: 1st Jun 2003 03:03 Edited at: 1st Jun 2003 03:05
You're not alone - I've been planning such a game for the past 4 months or so... I've solved most of the other issues, even down to generating planets and ships, but I also can't work out how to render this without some dodgy, half-baked scaling method.

I think FFE may have got round it by having a full software renderer which could cope with stupidly big and small objects. Unfortunately, as you probably know, theres not enough render depth bits on a standard graphics hardware - only 16bit depth with only 11 of them useable.

However, I've been reading around, and with a 32bit depth buffer you have about 25bit available - which I reckon is just about big enough to cope with both a box on the ground and a small planet diameter. Not sure which cards have this, probably the latest nv and radeon

Back to the drawing board....

ZeroGravity

n.b. I came across your post via google while searchign for an angle on this.

The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 1st Jun 2003 10:41
What you could do is scale and use bump mapping on a planet object to make the effect of hills and ditches you can fly through.

[href]www.vapournet.com/~flyer[/href]
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 1st Jun 2003 13:45
I think that you could handle the planet system easily enough. Keep the scales the same, but hide planet detail away at a distance, or when the game is loaded, create a high poly planet model, store it as a mesh and delete the object. Then create a low poly planet model. When the user gets close enough to the planet, the meshes are swapped. Using the MAKE OBJECT SPHERE command you can easily set the level of detail.

A simple distance check would enable you to hide stuff at a distance.

Keep the planets very large in scale, all hell could break loose if you attempt to keep scaling the planet or objects.

The size of objects is not important, just the polycount. Using bump mapping, you can easily achieve the impression of detailed surface even when the object is far away. (BTW. The bump mapping shader is good atm. but will look better in P5).

The same would need to be done for ships. Preload all the high and low polycount meshes and swap them depending on the distance.

Quite a tricky problem though.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
Arrow
21
Years of Service
User Offline
Joined: 1st Jan 2003
Location: United States
Posted: 1st Jun 2003 16:23
Ok, here's my idea, create your planets that are very big. Once you get so close to then ask if the player want to enter the planets atmoshpere. You have the ship move through a heavy fog, add a few cloud spites and maybe so reenter flames. While that is going on, you use it as a distraction to load up the planet level. Remember you would have to slow way down while entering the atmoshere of a planet else you'ld bun up in re entry, so it wounldn't feel cheep using that time to load up the level.

Teenage Male Geek + Female Remotly Intersted in Common Geek Activities = Teenage Male Jackass
Raptor1313666
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location:
Posted: 1st Jun 2003 22:18
Thanks, guys, for the responses. They've been helpful. I've gotten a few other replies from my posts elsewhere, and I think I've got enough to seriously sit down and try something out (now I just need the time to actually code this stuff).

I've been trying to think of a way to "fake" it all, by somehow "cramming" some of the larger values into representative smaller values and maybe breaking certain things apart into more manageable chunks.

Maybe instead of generating a full planet with a single sphere, I'll create a custom sphere by joining my own triangle sections together. I'd have to group them all together and make certain the positioning math is correct, but it may allow me to build a gargantuan sized object without dealing with a single, large value for diameter or anything. I just need to see if there are formulas for creating a sphere piece by piece without truly knowing the entire diameter or circumference or anything like that.

Certain aspects of the planetary surface LOD could also be handled like this. At a certain distance from the triangle, the code would generate different levels of detail dependent upon the LOD of the surrounding triangles (this way you wouldn't get a super-detailed, textured triangle surrounded by flat shaded ones). So as you approached, the world would slowly "reveal" itself.

I'm also thinking of actually doing the scaling routines at the higher distances (drawing either 2D sprites or low-poly spheres and whatnot at the extreme distances), scaling them up until they hit a certain far-off distance from the player, at which point in time I'll generate my "real" planet (just with a low LOD). That will then increase as the distance decreases.

I'm really trying to stay away from using separate loading screens or in-game procedures, though. Even the cloud cover and "blast shield" idea have been suggested (and I thought they were quite clever). The problem with those, though, is that it doesn't account for atmosphere free planets. Meaning, if there's no atmosphere, I cannot use the atmosphere to mask the loading of the planetary surface.

I should hopefully be able to experiment with some code sometime this week, so maybe I can start in earnest on this project and actually get some solid answers again (it's been a long weekend of mandatory overtime, so I haven't yet been able to put this stuff into practice).

Hopefully I can get this thing cracked shortly!

ZeroGravity
20
Years of Service
User Offline
Joined: 31st May 2003
Location:
Posted: 2nd Jun 2003 02:31
Hi,

You may find this useful - http://www.gamasutra.com/features/20000228/ulrich_02.htm

.. at least, thats how I'm going about it, just as soon as I work out how to go to a spherical coordinate system.

jesus, all the vector mathematics I've forgotten over the years....

Raptor1313666
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location:
Posted: 2nd Jun 2003 23:04 Edited at: 2nd Jun 2003 23:06
Quote: "Posted by ZeroGravity
You may find this useful -

http://www.gamasutra.com/features/20000228/ulrich_02.htm

.. at least, thats how I'm going about it, just as soon as I work out how to go to a spherical coordinate system."


Hmm, I'll look into that article a little more closely. I was only able to glance at it during my brief time before I came here to work, so I'll give it a good perusal later tonight when I get back home.

Primarily, I wanted to come here and post a response I received from the alt.fan.elite newsgroup from someone going by "Nagy Daniel", where I also asked this question. While I haven't tried his method (just got it this morning as well), it looks promising and the guy gave a pretty good description. He also used C source, but it's the concept that's important, I think. Here's his response in full (it's somewhat long):

Quote: "from alt.fan.elite by Nagy Daniel

Hi,

The main problem in this case is that planets are "supported" by their
centers, and you calculate your distance relative to this center, while you are in space.

In the amosphere (few dozen kilometers above the surface, while the
planet's diameter is more than ten thousand kilometers), that approach
doesn't work, because of floating-point instability.

In these cases you want to set your origin to some point on the surface, like in a flight simulator. In order to have seamless transition, your surface cannot be a plane, because the horizon is still quite curved when the planet centered frame of reference starts wreaking numerical havoc. This switching is actually quite noticable in Frontier, but other numerical problems (like floating mountains and buildings) dwarf it.

My solution to this problem are the following two short fuctions (feel
free to replace float by double, but if you get everything right, you
don't have to):

/* parallel projection onto a unit sphere */
float belowHorizon(float rsquare)
{
return ((((rsquare/24)*rsquare+0.0625)*rsquare+0.125)*rsquare+0.5)*rsquare;
}

/* stereographic projection onto a unit sphere */
float aboveSurface(float rsquare)
{
return ((((rsquare*-0.0390625)*rsquare+0.0625)*rsquare-0.125)*rsquare+0.5)*$
}

Both deal with the transformation (bending) of a surface-based cartesian frame of reference. Throughout the following discussion I use a frame of reference such that the z axis is radial (vertical), x and y axes are perpendicular to each other and tangential (horizontal). rsquare denotes the sum of the squares of x and y.

The first function tells you how much below your horizon is the ground at a given distance. In other words, it returns a z coordinate such that that (x,y,-z) is a point on the surface.

The second one is a bit trickier to grasp, but it is equally useful. It tells you what the altitude of (x,y,0) is. Note, that the two are NOT the same, because the altitude of (x,y,0) is measured towards the center of the planet and not in a direction that is parallel to your "down" (z).

Of course, as rsquare approaches zero, these two return increasingly
similar results. During the final approach (a few kilometers above the
ground), you can use rsquare/2 for both to speed things up. This way you will have two transitions: a space->stratosphere and a stratosphere->thick atmosphere transition, both perfectly seamless.

The first function, however, implements 1-sqrt(1-rsquare), while the
second one implements sqrt(rsquare+1)-1. If you code them directly, you will face the probem mentioned in the beginning: the differences are several orders of magnitude smaller than 1, so you suffer a loss of significant digits.

In the proposed implementation, everything is measured in planet radius, but multiplication (rescaling) by a constant does not cause any numerical problems, as long as you don't overflow or underflow with the exponent, which is fairly unlikely even with a float precision and meters as a unit (ten thousand kilometers and micrometers are 13 orders of magnitude apart which is still well within 18 orders of magnitude limit -- and I doubt that you need micrometer precision)

You can safely switch to "atmosphere mode" while your altitude is about 1/2 of the planet radius. At this distance, the old planet centered system still works fine, while the proposed approximation works correctly as well. If you are too far away, and rsquare has a chance of exceeding 1/2, you may experience problems with the aproximation. As said before, as you descend further, you can switch to a speedier approximation. Even cheaper would be to switch to 0 (Flat Earth Model) at a later point, but that would be noticable, IMO.

In a final remark, let me tell you that the line of the horizon, which
starts off as a circle, becomes an ellipsis, then a parabola (for a
moment), then a hyperbola, which approaches the straight line, as your
altitude decreases. This may be important if you want to make a dawn
effect.

Good luck with your game!

--
Daniel
"


I'm going to try and fiddle with it later tonight, so hopefully I'll have some luck.

Hopefully they may help some others here, as well, just in case.

Login to post a reply

Server time is: 2024-05-09 09:17:00
Your offset time is: 2024-05-09 09:17:00