Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Jake Wolf, posted on December 14, 2000




Image Description, by Jake Wolf



Here's a shot of a space simulator I am working on. It started out as a project to help me learn OpenGL (already knew DirectX) and it's slowly evolving to a space simulator.

Here are some of the features already available:
  • Starfield and sun that can be randomly generated or loaded from a file.
  • Lighting and blending effects that simulate lighting.
  • Lens flare (still working on "pretty-ing" this one up).
  • Level of detail. Planets use less polygons when far.
  • Fog, to simulate the darkness of space. So that planets gradually come into view when approaching them.
  • Features to come:
  • Dynamic parametric clouds (to simulate gaseous planets like Saturn)
  • A heightmap for solid planets. this way, you'll be able to land or hover on a planets surface. Possibly mix that with a parametric approach to get a better LOD without immense heightmaps. (Anyone has tips or leads on this one? send me an email). thought about bumpmaps but my card does not support them, they kill my FPS.
  • 3ds or mesh file loader so I can add some spaceships to this mess.
  • Right now though, I am busy cleaning my code and making it modular. The demo runs on a P2 333 with a Riva TNT2 16MB at a speed of 30 to 60 FPS (depending of the features switched on). Also, I would like to take this opportunity to thank the folks at opengl.org Discussion forum for helping me out and answering my questions, especially "Punchey" and "dmy". And of course, flipcode.com for a kick @ss site.

    Thanks,
    Jake Wolf
    CleverEntertainment


    [prev]
    Image of the Day Gallery
    www.flipcode.com

    [next]

     
    Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
     
    Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
     
    comella

    December 14, 2000, 05:16 AM

    nice work. looks like the begonning from 2001.

     
    Pants

    December 14, 2000, 05:31 AM

    Hi. Nice picture. It reminds me of 2001 : A Space Odyssey.

    One thing to note is that space isn't dark. It just lacks objects for light to bounce off. Threrefore the Fog effect you're using to gradually bring the planet into view is somewhat inaccurate. A planet would gleam like a mini star (probably the second brightest object in the sky after the sun you have) when it is just a pin-point of light.

    Maybe you could use a billboardes quad when the planet gets this far away. Just use a very small star-like flare texture coloured to suit you planet and it should look quite good.

    Keep up the good work!

    Pete.

     
    a_j_harvey

    December 14, 2000, 05:56 AM


    Nice day/night horizon & planet texture.

    I also like the lens flare (I'm not a big fan of colourful lens flares).

     
    XycsoscyX

    December 14, 2000, 06:21 AM

    First off, nice pic indeed. The lense flare does look nice even without whatever prettying you may add to it. I like the lighting on the planet too, looks very nice. Also though, planets don't glow in space. The stars we see are literally stars, like our sun, planets can not be seen (except occasionally for the ones in out solar system). So the fogging is a pretty good idea, and the halo effect you have on the sun looks nice indeed. By themselves, the effects are neat, but you've done a great job of putting them together without overdoing it. Is there a demo anywhere to see the LOD and etc. in action?

     
    a_j_harvey

    December 14, 2000, 07:01 AM


    Am I the only one who thinks the thumbnail looks like a floating skull?

    Wouldn't planets glow if they reflected a nearby sun's rays at you?

     
    Pants

    December 14, 2000, 08:07 AM

    Hi XycsoscyX.

    I didn't say that the planets glow. I said they gleam, which is different.

    I planet can only be seen because light reflects from its surface into your eye. The light that is reflected travels until it meets something that absorbs it (like an eye or dust in a nebular etc) or something reflects it off in anther direction. The reason that distant objects in space cannot be seen with the naked eye is that the light diverges from its source (it spreads out) so that your eye recieves less light than it would if you were closer. You could use the fog to simulate this but I would think that a verys small billboarded quad would be quicker.

    pete

     
    Ted Milker

    December 14, 2000, 08:38 AM

    Pants is correct. Haven't you guys ever seen a planet in the night sky?? It nearly looks like just another star, except for it's position and size. At it's closest, Mars is 100 million kilometers away from Earth, and it can be seen with the naked eye.

    Dodger_

     
    Nick

    December 14, 2000, 08:59 AM

    Nice image, I like the star's corona!

    If a planet is only 'close' to one light source only one half of it is lighted. Every planet in our solar system has a light and dark side just like our moon. So if the star in the picture is the only light source then part of the planet should be completely black.

    Just a hint,

    Nick

     
    Mace

    December 14, 2000, 09:13 AM

    Heh, that planet doesnt look fps friendly.
    How many polys is it?

     
    D3stY

    December 14, 2000, 09:46 AM

    Yo.. Really Apocalyptic! :D
    Byez

     
    krogoth

    December 14, 2000, 09:49 AM

    Nope, I saw the skull too...

    Planet (and moons) do "glow", but this image shows a specular highlight. Planets have a diffuse reflection, and I haven't heard of any planets with a specular reflection. Although a planet can be bright, the reflection should be diffuse (it looks a lot flatter).

     
    krogoth

    December 14, 2000, 09:51 AM

    The lighted part on the planet should have less specular light and more diffuse. Other than that, it looks great. I'm interested in making a game where you can fly from the middle of space to the surface of a planet, but i'm not that interested in making a terrain engine for a space sim :)

    I'd like to see the effect of flying from space to the planet, and a demo.

     
    bit64

    December 14, 2000, 12:04 PM

    okay Im guessing Im the only one on this thread who has ever been in outer space.
    Your planet lighting is very accurate. The normals on the sphere would not reflect light towards your viewer, obviously, so it would not gleam. The reason we see mars is because it forms a triangular position with the sun and our own planet, therefore the normals to that sphere would reflect toward us, a planet between the earth and the sun would not. (if it were planar with the earth and sun). This picture would most closely imitate a lunar eclipse, and I feel it is very accurate. The level of light seen on the "unlit" side of the planet would depend if we are viewing it from a moon or another planet, a shuttle or spaceship or etc. The larger the object we are viewing from, the more light would be reflected off of the planets surface and back at us. The viewing object would act as a sort of mirror, reflecting light from the sun, toward the planet and then back at us. To get a very accurate representation of the scene, plug it into povray and set the sun as the only light source.

    The only thing I think needs work, and I may be wrong here, is the lens flare. The lensflare should end at the center of our viewing area. That is to say, the closer the sun is to a prependicular to our eyes, the brighter the lensflare would be. So the lensflare should start at the sun and end in (.5,.5) of normalized viewing screen.
    Yours seems to hit the camera at (.5,1) which I dont think is too accurate.

    A side not, I have never been in space, but at least you read my post with an open mind =)~

     
    bit64

    December 14, 2000, 12:08 PM

    I forgot to comment on the planet's diffuse versus specular hi-lites. Most people assume that all planets are similiar to the planets in our own solar system. It would seem likely to me that planets with thinner or no atmosphere would have more of a specular hi-lite than a diffuse one, also that specular hi-lite would be different depending on what materials the surface of that planet contained. A planet with a large mercury ocean, or a silicon based landmass (especially a hardened silicon mass) would have a much higher specular hi-lite than those with a humid tropical landmass or a gaseous ocean.

    Food for thought anyway.

     
    Pants

    December 14, 2000, 12:30 PM

    Ok. Maybe "Gleam" is not the right word to use because it would seem that it means different things to different people. But, planets are bright in the sky and space (depending on the direction of the light source/viewer etc)

    I was just commenting that using fog to fade in the planet when it is still some distance from the viewer is probably not the best way to go about it. I just thought that the quad would be a nice thing to have because there would still be a visible manifestation of the planet no matter how far the viewer is from the planet (within limits obviously) . The brightness/size of the quad would depend on the size of the planet, light-source/viewer/planet positions and the distance that the viewer is from the planet.

    Pete

     
    bit64

    December 14, 2000, 12:34 PM

    okay, sorry about all these posts, but afterthoughts are haunting me.
    I would like to add that while this particuliar still scene is very accurate, you would not be able to use this type of fogging effect once the travelling craft (assuming you are on some sort of mobile craft) gets to the lit side of the planet (with the sun to your back and facing the planet) it would then appear that the opposite side is lit, and the side closest to the sun was the darker side.
    ok Im done now.

     
    bit64

    December 14, 2000, 12:36 PM

    I agree, billboards would optimize your space scene a lot. And at a certain distance from the viewer, lighting would not matter.
    I would make the same suggestion.

     
    [-WD40-]

    December 14, 2000, 12:52 PM

    Nice shot and everything that comes under it

    Where did you get that picture of Mars' terrain? Do you know if every planets of the solar system have been fully mapped by NASA?

    I'm doing a similar project with a friend but some terrain textures are very hard to find if not impossible

     
    bit64

    December 14, 2000, 01:09 PM

    No not every planet has been photographed. Terrain photography would require that we have an orbitting satellite around each planet, and that has not yet been accomplished.

     
    fluffy

    December 14, 2000, 01:38 PM

    Argh.

    Think of stars as very bright light sources.

    Think of planets as very large objects.

    Jeeze. This should be *obvious* to graphics programmers. :)

     
    Raspberry

    December 14, 2000, 01:52 PM

    I am going to be *REALLLLY* annoying now, and say:

    "does it matter how correct it is to physics, its a game. Even if it doesn't accurately describe the lighting model of a real solar system, is it going to affect the gameplay?"

    I beleive that as we do not have enough data about the shot, why not just beleive that it is right given the circumstances, and concentrate on what the poster was aiming for.....

    I think that the shot is nice, and the planet looks rather good, aesthetically. I will not comment on its validity.

     
    Ogotay

    December 14, 2000, 02:41 PM

    Hey, looks kewl. Btw I was also thinking about making a space sim with heightmaps for planets you mentioned in your features-to-implement list, I'm sure that would rock (I'd be the first one buying a game where you could land on a planet after a fight in outer space =)).

    bit64: you a** ;)))))))))))))) (just kidding, please don't be offended and read further)
    I almost wanted to ask you if you can steal a space shuttle and take me on a small travel to the moon. That was cruel and you have almost broken my heart when you said it was not true (sniff sniff), how can you play with the hope of other people like this? LOL

     
    Rui Martins

    December 14, 2000, 03:23 PM


    Apart from all the perfection comments, I would like to say that I Like the image very much, because it appeals for hour desire of freedom.

    I would also like to se a fly by of this if possible, it should look great.

    nonetheless, I would lower the ambient light, so that the dark side of the planet looks darker (just a little bit more).

    And also I don't know why, but the Lens Flare doesn't look right, particularly, the bottom part.
    Maybe it's because a lens flare is supposed to be very bright (at least at the edges of the circles) or maybe it's the blending mode used.
    Seeing the Planet surface brightened up in the lens flare edges doesn't look right, since this an artifact created by the lens, in which a lot of lightis concentrated in the circle edges, so that it should ofuscate the planet surface (in the circle edges at least).

    As a side note, this particula view (straight ahead, aligned Viewer/Planet/Star) is a special case, since it's more common to get unaligned views, which eventually would look more realistic, for a still picture.

    Keep up the great work.

    See ya

     
    bit64

    December 14, 2000, 03:54 PM

    hahaha, Im sorry!
    won't happen again. =p

     
    Bagheera

    December 14, 2000, 04:49 PM

    The only planets we have maps of are:

    Venus, Earth, Mars.
    We have maps of our moon and partial maps of Europa, Io and Phobos.
    There are also very partial maps of Mercury and Pluto in NASA's archives, and doubt they will get updated this decade.

    As for texturing...there are images of all nine planets available from NASA's public relations department.

    -----------------------------------

    I haven't been in space either, but my father-in-law has been, three times.

     
    The Wolf

    December 14, 2000, 06:12 PM

    Thanks everyone for your comments. It's very motivating. bit64 thanks for the great comments one of the things I spent a lot of time on is making the scene "real" yet artistic at the same time (I know, I still got a long way to go)

    comella, Pants, a j harvey, XycsoscyX, krogoth, Ted, Nick, Mace, Thanks for the comments. here's what I did with the whole light/fog issue.
    -First I'll address the Fog/lighting issue:
    the planet does not turn to a quad when it is far enough because depending which way you are looking at the planet the light bouncing off will be different (which I can still do with a quad but would require constant calculation of the angle with the planet and the planets angle with the sun). Basically if I'm looking at the planet from the side (light covering half the planet) from a great distance the brighness will be less than the one if I was facing the planet (light covers the visible face, like a full moon), of course at a great distance.
    So basically the planet reduces to a minimum 6 sided quadratic. Also, the lighting on the planet is somewhat modified by a lightmap texture blended with the planet. This texture is not affected by the fog and so the planet shines brightly when you are far (and looking at the shiny side of the planet). On the flip side, If you approach the planet from it's dark side the fog effect does it's magic because on minute you can't see any planets the next you see the sillouette of the planet emerge form the darkness (very cool).
    Of course all this is to cater to a non-restrictive space (basically go anywhere in the solar system). For a game I would probably use some sort of a restrictive space in which case the planet can be converted to a quad and the brightness calculated at the begining of the level.

    [WD-40]
    -The texture is taken from the NASA site (I forgot the address, but if you search for "planetary maps" you'll come accross it)

    - Like fluffy mentioned, The dark side of the moon is not pitch dark. Stars generate enough light to somewhat illuminate the planet (remember, out there you can see a WHOLE lot more stars than down here). This is why the back face is not totally dark (actually it is darker in the actual demo, but somehow when I converted the screenshot to jpeg it became lighter, and some of my stars disappeared). This, plus the fog effect gives the dark side of the planet that you guys are thinking of, but that darkness comes only at a distance from the planet.

    - The "heightmapped planet" I am still working on. The beauty of it is that you will be able chase a ship from space into a planet, through canyons, without having to stop and load another level.

    raspberry, ogotay, Rui (you're right about the flares, I still can't find the perfect blending for those, any tips are appreciated), Thanks for the comments.

    Basically the goal is not to simulate the solar system exactly, but to be real enough yet artistic (a hard balance).
    Just yesterday me and "Punchey" (mentioned above, who is working on a similar project) decided to combine our efforts and start a game,
    Basically it will be a space sim blast some aliens PLUS land on a ship or a planet and blast some more aliens.
    We'll give a screenshot with more info later, maybe a demo.

     
    fluffy

    December 14, 2000, 07:04 PM

    Wolf: Well, that wasn't exactly what I was going for with my lightsources/etc. ramble. Basically, everyone was just way overanalyzing the interaction between stars and planets and the like, and I was hoping to point out why you don't want to use fogging to try to simulate distance attenuation.

    That said, yes, the screenshot looks very neat, and the lighting does look great for that particular setup, except for where the fogging is involved. What you might want to try doing is instead of using fogging and the like to fake halos and such, use material mapping (i.e. two-pass rendering with a glossmap or whatever) to give different reflective properties to different parts of the planet; for example, the polar icecaps are somewhat shinier than the rest of the planet. The easy way to do this is just use environment mapping where the environment is just for a single lightsource (i.e. the nearest sun); for binary starsystems you'd have to do a bit more work, obviously. :)

    Also, I don't recommend actually using one lightsource per star. :) Only deal with nearby stars as lightsources and then average the rest out into ambient lighting (or use them as an environment map, which then has the nice side-effect of material-mapping working out nicely). You can even do some incredibly realistic things by having different material maps which modulate different environment maps for varying surface characteristics (water, trees, icecaps, desert, etc.), though that gets into a lot of possibly-unnecessary passes.

    I'd be interested to know how you were planning on determining what the local area for the camera was and how to render it, btw. Were you going to use some sort of octree representation of the universe or the like? I can think of a couple of vague ways to do what you envision (the flying to a planet, chasing through a canyon bit), though getting that to work efficiently and with a decent level of detail is certainly no easy task. There's been some interesting work done in doing procedural geometry for that purpose, though, and many years ago a friend of mine and I were toying with some ideas along those lines, though we never actually implemented anything.

     
    Steve 'Sly' Williams

    December 14, 2000, 07:12 PM

    ...though the space scene that it turned out to be is still very good.

    Still looking for that skull.

     
    The Wolf

    December 15, 2000, 12:01 AM

    fluffy: I guess I understood wrong. The reason I used fog was more the artistic flair than anything else, I just love the way the planet emerged from it, it still looks quite realistic (maybe I'll post a demo soon). Actually the fog effect does not show at all in this shot (too close to camera), it only kicks in when the planet is about 3 inches in diameter on the screen. I love your tip about material and environment mapping (hope my video card will love it too :). As far as light is concerned there are only 2 sources of light, the sun, and one ambiant light to simulate the stars.
    I'm no expert when it comes to lighting, that is why I felt the need to add some blending tricks to simulate it properly (as well as other reasons described above). I see that you are very good at light and shadows, any idea how I can simulate planet shadow with minimal hit on performance (btw, planet shadows are usually cone shaped for planets near the sun)? feel free to email me.
    As for the representation of the universe, I'm thinking of octree (only have frustrum culling for now) and using quadtree for the planets, but I'm not sure. I started coding my version of a "quadtree like" renderer. It does not give as much detail as a quadtree but the performance is looking good (too early to tell).

    Steve 'Sly' Williams : LOL, Sly check your email, here's your skull!!

     
    The Wolf

    December 15, 2000, 12:06 AM

    damn, your father-in-law is lucky. BTW, the map of Pluto is only an artist rendition, no space probe has been sent to Pluto yet.

     
    This thread contains 45 messages.
    First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
     
     
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.