More pretty stuff: atmospheres and planet surfaces

Talk among developers, and propose and discuss general development planning/tackling/etc... feature in this forum.
richard
Bounty Hunter
Bounty Hunter
Posts: 162
Joined: Mon Jan 26, 2004 9:29 am
Location: Melbourne, Australia
Contact:

More pretty stuff: atmospheres and planet surfaces

Post by richard »

Purty, and possibly some techniques we could use (atmospheric effects, procedural planet generation... )

http://home.comcast.net/~s-p-oneil/index.htm

His Gamasutra articles (in the links page) are a good read too.
Gamer, Python programmer
Test Man

Post by Test Man »

Looks interesting..

I wonder when this will be implemented in VS.

I like the idea of seamless planetary flight.
scheherazade
Developer
Developer
Posts: 427
Joined: Thu Jan 09, 2003 6:03 am

Post by scheherazade »

i already have procedural generation in.

and i also have it pre-calculable, so you can generate any planet at any set of LOD's ahead-of-game.

the clouds i wanna do are gonna be 3d.

but i think adding some general nebulae-cloud effect in game would accomplish this just fine. if you could have a density function based on some central location.

-scheherazade
s-p-oneil

GLPlanet demos

Post by s-p-oneil »

Someone sent me an email to point me to this thread, so I hope you don't mind me butting in.

The planet and cloud demos on my web site are old. The latest version uses a chunked quad-tree for LOD instead of ROAM. The quad-tree makes it easy to dynamically generate textures, which noticeably improves visual quality. Overall rendering is faster, but the mesh isn't as optimized, and splits are slower.

The quad-tree doubles as a space-partitioning system, making it easy to efficiently handle objects on the surface. It is now just as easy to procedurally generate billions of trees across a planet as it is to generate billions of surface features (like craters).

The atmospheric scattering demo on my web site is new. The article just got publised on GameDev.net this week. It would make the transition from ground to space look awesome, and it's easy to change parameters for different types of planets. I haven't applied it to my planetary project yet.

I've also made a few different attempts at 3D volumetric clouds. They're the hardest thing I've tried to do yet, as I want them to be animated by a weather system, and I want the motion to look realistic. Across an entire planet with dynamic level-of-detail, that's a very tall order. If I can get it to work, it should be easy to use it to do gas giants.

Oh yeah, my contract with Maxis ended a little while ago. I don't have as much spare time as I used to, but you may be able to persuade me to contribute some time. I may not check this thread regularly, so send me an email at s_p_oneil@hotmail.com if you're interested in trying to enlist me.

Sean
Elster
Star Pilot
Star Pilot
Posts: 7
Joined: Wed Jan 08, 2003 10:50 am
Location: Karlsruhe, Germany

Post by Elster »

Is it possbile to run GLPlanet or GLCloude under Linux?
s-p-oneil

Re: Linux

Post by s-p-oneil »

At the moment they will not compile under Linux, but they use OpenGL so it shouldn't require much work to port them to Linux. I've been planning to clean up the code anyway, and platform-independence would be a good thing to try to put into it.
scheherazade
Developer
Developer
Posts: 427
Joined: Thu Jan 09, 2003 6:03 am

Post by scheherazade »

i'm using a 4 way tree too.
although i'm workign off a static model
an octahedron that's up-sampled, and each vertex is pushed up to some value on a heightmap.

current'ly all the geometry is the same, but i can easilly make it take different textures per face. could also have a texture heightmap, where different values force different texture assignments to faces.

in any case, its simple for now.

i wanna use the current game engine to make things happen.
i.e.
clouds can be camera-facing quads mapped with translucent 'puff' textures, located in some bounded region and arranged by some function.
(this is usually how they're done so far in games, and there are some good results, like in freelander imo)

only thing about my system that i don't like is that the geometry is evenly distributed. a smoothe planet has the same polycount as a detailed planet.

although, you can shoose higher and lower polycounts and it'll up or down the polycount on demand. and with no processing time IF its been pre-generated.

and of course, invisible areas are not included.

basically i have a tool that uses the current engine to make things happen.

-scheherazade
s-p-oneil

Post by s-p-oneil »

IMO you can't have pre-generated planets with a decent level of detail. Here's a quote from my first article explaining why:

"To give you an idea of the size we're talking about with planetary bodies, an order-10 sphere based on an icosahedron (20 * 410 triangles) has almost 21 million triangles in it. For a planet the size of Earth, the triangle edges would be 300km long. The edges for an order-20 sphere (22 trillion triangles) would be 0.3km long. It would be ridiculously slow, take up an enormous amount of storage space, and still wouldn't be able to show you details on individual hills or mountains. In that light, it seems that the only feasible way to generate a planet is to come up with something more dynamic."

You'll run into the same problem with clouds. While it's not difficult to get something looking good when the camera is close (i.e. on the ground) and it's not difficult to get something looking good when the camera is in space, it is difficult to get something looking good at all levels of detail with a smooth transition in real-time. If the clouds have to be animated realistically by a weather engine, then the problem becomes even harder.

I'm not bashing your implementation. Mine are fairly CPU-heavy, though some things can be pre-computed to make them run faster. And of course if you reduce the scale of the planets by a few orders of magnitude, then a lot of things become easier. I never wanted to reduce the scale of mine because I was trying to see how far I could take it.

Have you thought of a way to do surface features like craters realistically? Keep in mind that there are billions or trillions of them on surfaces like the moon. I have a very simple algorithm you could use.

Sean
charlieg
Elite Mercenary
Elite Mercenary
Posts: 1328
Joined: Thu Mar 27, 2003 11:51 pm
Location: Manchester, UK
Contact:

Post by charlieg »

s-p-oneil wrote:I'm not bashing your implementation. Mine are fairly CPU-heavy, though some things can be pre-computed to make them run faster. And of course if you reduce the scale of the planets by a few orders of magnitude, then a lot of things become easier. I never wanted to reduce the scale of mine because I was trying to see how far I could take it.


Define 'CPU heavy'. ;)

I guess you could also be clever bout things and only generate for one side of a planet initially, or generate for a certain level of detail, then generate in the background as you approach a planet.

And the LOD is probably a lot more limiting here because the game needs to maintain a respectable FPS.
s-p-oneil

CPU-heavy

Post by s-p-oneil »

Since the level-of-detail is dynamic, CPU-heavy is a relative term. Of course, lowering the level of detail will improve the frame rate. I'm running an Athlon 2500 with a Radeon 9600. I tend to push 30-50K triangles, and it usually renders at 100+ FPS when the camera isn't moving.

When the camera starts moving, the splits start occurring, which generates calls to the fractal function. At fairly high camera speeds, it may drop to 50 FPS. At really high camera speeds, I've seen the frame rate drop down to 20 FPS. I set a limit on the number of splits per frame, so it should never go below 20 in this case.

If the camera speed is limited when the camera is near the planet, your frame rate won't go down so much. You could also switch to a cheaper fractal function. My latest is a complex fractal function with 12 octaves based on 3D noise (which is a lot more expensive than 2D noise). Switching to 2D noise and reducing the number of octaves would speed it up, but the quality loss would be noticeable.

(My latest fractal routine hasn't been published online yet. The hills and mountains in it look way better than in the one I've published. You also haven't seen the dynamically-generated ground textures, which make visual quality much better.)

You can also pre-compute the first few octaves into a lookup table. You should be able to get away with 4-6 octaves using a 256x256 lookup table per top-level square. Then at runtime interpolate into your lookup table and add the higher octaves. This may allow you to cut the time in half without sacrificing quality. You may also be able to pre-generate noise tables and tile them for the higher octaves, but that would sacrifice some quality and may be noticeable.

Adding things like dynamically generated craters and trees slows things down more. Surface features like craters add to the heighfield, so they only have a generation cost. Objects like trees need to be rendered separately and also add to the rendering cost. Active volcanos would be like a cross between the two, affecting the heightfield and adding something to draw. Throw in realistic atmospheric scattering to slow it down again, and realistic detailed clouds yet again.

Some things can be faked and look pretty good, like the fake atmosphere that's in the GLPlanet demo that's currently on my web site (which has no sunset colors yet). Some things can be impostored, but impostors have some problems and it's tough to get impostors to look seamless.
JungleJim
Hunter
Hunter
Posts: 67
Joined: Wed May 05, 2004 10:15 pm
Location: All alone in the night...

Post by JungleJim »

Why not handle trees as textured ground surfaces? Are people really going to fly through them?
Be seeing you,
s-p-oneil

Trees

Post by s-p-oneil »

Because users want to be able to land on the planet, have bases on the planet, etc. That in itself would require some tree objects when you got close enough to the planet. To me it would also imply land, sea, and air vehicles, and possibly even a first-person mode (which I've seen a request for).

If you've tried to play BattleCruiser Millenium, they had something like this, but I felt that the graphics, the interface, and the "feel" of it were very poor.

Of course, from a very long range (i.e. higher levels in the quad-tree) you would just encode forest clumps as green texels in the ground texture. From medium to close range, you could use impostored groups of trees. From a close range, you should render them individually if you want them to look realistic.

Realism is not always desirable (or feasible). Right now my demo looks ok with single billboarded trees, but too many of them drag the FPS down, and for now my random placement algorithm is terrible. Like so many other features I've done, it's just a proof-of-concept at this point. I'd really like to have a weather/climate engine that would tell me where the trees should go (along with the detailed clouds I haven't gotten working yet).

Sean
Guest

Post by Guest »

@s-p-oneil: Man, with your skill I _really_ wonder why you are not member of a leading-edge gamecompany! Including your stuff into vegastrike would add so much!

It's a pity I don't have any influence on such decisions...
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

Anonymous wrote:@s-p-oneil: Man, with your skill I _really_ wonder why you are not member of a leading-edge gamecompany! Including your stuff into vegastrike would add so much!


I agree. It would most definantly speed up the process if we could use what you have already made. Perhaps you and scheherazade might want to work together on some things as you both seem to be trying to do the same thing.
s-p-oneil

Thanks for the vote of confidence

Post by s-p-oneil »

I did manage to land a 2-year contract with Maxis, so I'm not doing too poorly. :wink:

I was only willing to work part-time for Maxis. If I were single I probably would've tried working at a game company, but I have two kids. From what I've seen, game companies tend to work developers into the ground for very little pay. I think it'd be fun to try it full-time, but it's even more fun to have time to play with my kids. With a part-time contract, I had the best of both worlds.

I wouldn't mind putting some time into an open-source project if scheherazade wants to put up with me... uh, I mean work with me. I don't know how much time I'll be able to devote to it, though.

Sean
scheherazade
Developer
Developer
Posts: 427
Joined: Thu Jan 09, 2003 6:03 am

Post by scheherazade »

i have pre-generation because it will help with the common situation

planets all about, only visit one or two.

have a few decent LOD's for each pregenerated.

it will make the terrain more and more detailed as you get in closer, up to whatever detail you'd like.

you could, if you desired, waste 2 gigs on a planet pre-generating it to the umph degree, but that isn't really necessary. it generates on-demand the areas that you goto, nothing more, unless it was told to pre-generate.

-scheherazade
charlieg
Elite Mercenary
Elite Mercenary
Posts: 1328
Joined: Thu Mar 27, 2003 11:51 pm
Location: Manchester, UK
Contact:

Post by charlieg »

scheherazade, did you check out s-p-oneil's demos? They are utterly amazing.

If the VS code currently is as good, then I'll be astounded. (Although not surpised.)
s-p-oneil

I've been busy

Post by s-p-oneil »

Sorry I didn't check back, but I've been busy. I did manage to run some tests with pre-computed height fields, though.

My current fractal function uses 12 octaves of noise. The first 6 generated the basic continent shapes, and the last 6 altered the landscape in a way similar to Musgrave's ridged multifractal.

First I tried pre-computing the first 6 octaves into a set of lookup tables. It sped up the splits quite noticeably without affecting how the planet looked at all. I had always planned to implement something like this, but somehow never got around to it. One big benefit to this is that many fractal functions don't produce good continent shapes. It should be easy to change the pre-computed function to something else, and keep the fractal function for the added detail.

Next I tried pre-computing a looping patch for the last 6 octaves and tiling it across the planet. It was extremely fast, but the tiling was very noticeable. It should still be possible to use something like this to speed it up, perhaps by tiling only some of the 6 levels, or perhaps by scaling the tiled value with some other global noise value.

Right now it's running at 72 FPS with 42K triangles, and it only drops to about 55 FPS when the camera is moving and forcing splits. Of course, with extremely cheap height lookups, I can increase the dynamic ground texture resolution per node and decrease the number of nodes and triangles. (I really ought to publish an article and demo covering the dynamic ground textures. It looks 10 times better with those.)

Oh, and I downloaded the VegaStrike source code using CVS to see if I could get the project to compile, but I couldn't. Is there a decent set of instructions for building it on Windows? I have MS Visual Studio 6.0 and gcc (ala Cygwin) installed, but I couldn't get either to compile and link it properly, and I didn't see anything in the readme's that helped.

Sean
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

download vega-proj
that should have a current visual studio 6 project
but it may need to have a few files added...I'll check tomorrow :-)
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
s-p-oneil

Link errors

Post by s-p-oneil »

I did a co on vega-proj again, but I still have problems building it. Many of these unresolved externals seem to involve vegastrike\src\cmd\csv.cpp. I don't see that file in the project. Did you forget to include it, or is there some other problem?

(Note: The other build configurtions I tried give the same errors.)

--------------------Configuration: vegastrike - Win32 Release Boost 129--------------------
Linking...
Creating library ..\data4.x\bin\vegastrike.lib and object ..\data4.x\bin\vegastrike.exp
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
main.obj : error LNK2001: unresolved external symbol "class std::vector<class CSVTable *,class std::allocator<class CSVTable *> > unitTables" (?unitTables@@3V?$vector@PAVCSVTable@@V?$allocator@PAVCSVTable@@@std@@@std@@A)
unit_generic.obj : error LNK2001: unresolved external symbol "class std::vector<class CSVTable *,class std::allocator<class CSVTable *> > unitTables" (?unitTables@@3V?$vector@PAVCSVTable@@V?$allocator@PAVCSVTable@@@std@@@std@@A)
main.obj : error LNK2001: unresolved external symbol "private: void __thiscall CSVTable::Init(class VSFileSystem::VSFile &)" (?Init@CSVTable@@AAEXAAVVSFile@VSFileSystem@@@Z)
unit_generic.obj : error LNK2001: unresolved external symbol "private: void __thiscall CSVTable::Init(class VSFileSystem::VSFile &)" (?Init@CSVTable@@AAEXAAVVSFile@VSFileSystem@@@Z)
savegame.obj : error LNK2001: unresolved external symbol "public: void __thiscall Unit::WriteUnit(char const *)" (?WriteUnit@Unit@@QAEXPBD@Z)
basecomputer.obj : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Unit::WriteUnitString(void)" (?WriteUnitString@Unit@@QAE?AV?$basic_string@DU?$ch
ar_traits@D@std@@V?$allocator@D@2@@std@@XZ)
unit_interface.obj : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Unit::WriteUnitString(void)" (?WriteUnitString@Unit@@QAE?AV?$basic_string@DU?$
char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
navscreen.obj : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Unit::WriteUnitString(void)" (?WriteUnitString@Unit@@QAE?AV?$basic_string@DU?$char_
traits@D@std@@V?$allocator@D@2@@std@@XZ)
savenet_util.obj : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Unit::WriteUnitString(void)" (?WriteUnitString@Unit@@QAE?AV?$basic_string@DU?$ch
ar_traits@D@std@@V?$allocator@D@2@@std@@XZ)
role_bitmask.obj : error LNK2001: unresolved external symbol "class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,c
lass std::allocator<char> > > > __cdecl readCSV(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?readCSV@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_st
ring@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z)
unit_generic.obj : error LNK2001: unresolved external symbol "public: void __thiscall Unit::LoadRow(class CSVRow &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_
traits<char>,class std::allocator<char> > *)" (?LoadRow@Unit@@QAEXAAVCSVRow@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAV34@@Z)
unit_generic.obj : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall CSVRow::operator[](class std::basic_string<char,struct std::char_traits<char>,cl
ass std::allocator<char> >)" (??ACSVRow@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@Z)
unit_generic.obj : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall CSVRow::getRoot(void)" (?getRoot@CSVRow@@QAE?AV?$basic_string@DU?$char_traits@D@
std@@V?$allocator@D@2@@std@@XZ)
unit_generic.obj : error LNK2001: unresolved external symbol "class CSVRow __cdecl GetUnitRow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool,int,bool,bool &)" (?GetUnitRow@@YA?AVCSVRow@@V?$basic_string@D
U?$char_traits@D@std@@V?$allocator@D@2@@std@@_NH1AA_N@Z)
sphere_generic.obj : error LNK2001: unresolved external symbol "public: __thiscall GFXSphereVertexList::GFXSphereVertexList(float,int,bool,bool)" (??0GFXSphereVertexList@@QAE@MH_N0@Z)
..\data4.x\bin\vegastrike.exe : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.

vegastrike.exe - 16 error(s), 1 warning(s)
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

ywp forgot to include 2 new files

rather I haven't had access to a computer with vc6 on it for a while
maybe I'll try to locate one today

right now most of the windows development has upgraded to vc7

anyhow add 2 files to project:
cmd/unit_csv.cpp
and
gfx/sphere_list.cpp

then build
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
scheherazade
Developer
Developer
Posts: 427
Joined: Thu Jan 09, 2003 6:03 am

Post by scheherazade »

search in VC6 for files containing hte missing keyword

like : __thiscall Unit::WriteUnitString(void)
would be : WriteUnitString(

search for that in your files, find its definition, and include whatever cpp or h files that comes up with the definition.

keep doing it till it compiles.

-scheherazade
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

I committed the new VC6 project
enjoy
make sure to check out the latest data directory or it won't work properly


this includes obj support as well BTW
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
scheherazade
Developer
Developer
Posts: 427
Joined: Thu Jan 09, 2003 6:03 am

Post by scheherazade »

sigh
56K + large data = me crying in a corner...


-scheherazade
dandandaman
Artisan
Artisan
Posts: 1270
Joined: Fri Jan 03, 2003 3:27 am
Location: Perth, Western Australia
Contact:

Post by dandandaman »

Anonymous wrote:sigh
56K + large data = me crying in a corner...


so you know the pain too :-P

I avoided the punishment and spread the download over net sessions for about a fortnight :-)

Dan.a
Post Reply