Sign in to follow this  
FromShadow

Space game graphics with Depth perception

Recommended Posts

FromShadow    145

Hi everyone,

so I'm working on a third person space shooter in XNA. The idea is to immerse the player in large scale battles with ships of different sizes and shapes, ranging from small interceptors to huge battle stations. So far i've primarily worked on the engine and i'm pretty happy with the results.

For the graphics, I have only a Sky box, (very) basic ship models with diffuse lighting and some basic fog.
My goal is to have a nice star background and to give the player a good perception of the other ship's 3D position/trajectory.

So my question is, what do I need for that?
Should I just add loads of fog? If so, what color should it have? white fog looks ugly when it's blended over my dark skybox. black fog works betters but all it does is smooth out my far clipping plane.
Many space games seem to have static "stardust" that doesnt move so the player has a sense of his motion. But I can't spawn millions of particles all over space, and generating them around the player seems costly too.
Also, games like Eve:Online don't look like they have skyboxes. distant stars seem to be light sources and have lense/flare effects, does that mean I need a full 3D galaxy model?

appreciating any insight!

 

 

Share this post


Link to post
Share on other sites
BagelHero    1524
Right now I can't help but thinking straight black is a bad idea. Perhaps a very dark tone of blue/purple might be better? If you offset the tone from pure black, then it might be possible for fog to work in a lighter tone; eg Black-Purple with Purple-Orange haze (Random example; I don't suggest actually using that).

In relation to the ships position/trajectory, it would probably help to give them a good silhouette. If you can identify the class of ship from a distance you'll probably be able to tell what direction they're facing. Harder to sort out in the non-final stages, I suppose.
In terms of speed and distance, Perhaps some sort of "landmark" stars and planets might help somewhat?

That said, I'm working with a knowledge of 2D works, not effects, and it may not help at all. I'd like to help more, but I can't pretend to know what I don't, haha. I do hope someone can help you though! Edited by BagelHero

Share this post


Link to post
Share on other sites
Tobl    364
Hello,

Some guys a semester below me at my university just finished this for a little sideproject
[url="http://ig.hfg-gmuend.de/Members/sandra_krauss/meine-projekte/kinect-projekt-starry-sky"]Starry Sky[/url]
The fog is basically just a continuous stream of circles, coloured according to a certain scheme, getting larger and more transparent with time until they disappear. If you're really interested in implementation, I could get you their email-adresses, but for now, maybe it's just good for a little inspiration.

bw,
Tobl Edited by Tobl

Share this post


Link to post
Share on other sites
FromShadow    145
[quote name='BagelHero' timestamp='1352323428' post='4998588']
Right now I can't help but thinking straight black is a bad idea. Perhaps a very dark tone of blue/purple might be better? If you offset the tone from pure black, then it might be possible for fog to work in a lighter tone; eg Black-Purple with Purple-Orange haze (Random example; I don't suggest actually using that).
[/quote]

Sounds good, I just tried making the skybox translucent and putting different colors underneath. blueish tones really look better than black.

[quote]
In terms of speed and distance, Perhaps some sort of "landmark" stars and planets might help somewhat?
[/quote]

What I am wondering is wether you add those landmarks as 3D objects, or do I blend them into my skybox?
While I can't go for top-notch graphics (I'm doing this for fun), I wonder how game devs go about this.

[quote name='Tobl' timestamp='1352325621' post='4998605']
Some guys a semester below me at my university just finished this for a little sideproject
[url="http://ig.hfg-gmuend.de/Members/sandra_krauss/meine-projekte/kinect-projekt-starry-sky"]Starry Sky[/url]
The fog is basically just a continuous stream of circles, coloured according to a certain scheme, getting larger and more transparent with time until they disappear. If you're really interested in implementation, I could get you their email-adresses, but for now, maybe it's just good for a little inspiration.
[/quote]
Cool project, maybe one could do something similar in 3D with a particle engine. Maybe not for large-scale fog, but it could produce some nice engine trails, I imagine. Hope I can go about that later. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites
3Ddreamer    3826
Hi,

A few space stations or outposts would be cool and add depth perception, I feel. How about an asteroid belt for positional reference? Real outer space has some bright objects like red giant stars, nebulae, novas, and super novas. These could be made sprites or stationary textures and would look okay if the wall of the skybox is far enough from the viewer.


Clinton

Share this post


Link to post
Share on other sites
phil_t    8084
[quote name='FromShadow' timestamp='1352319797' post='4998564']
Many space games seem to have static "stardust" that doesnt move so the player has a sense of his motion. But I can't spawn millions of particles all over space, and generating them around the player seems costly too.
[/quote]

I actually think this could be a good solution to create the illusion of movement as your travel through it. You certainly don't need millions - a few thousand should do, and be cheap performance-wise.

You can use an infinitely repeating cube of particles that "scrolls" with the camera like is commonly done for precipitation (see "Dynamic Weather Effects" in Shader X7 for an example of this).

Share this post


Link to post
Share on other sites
Waterlimon    4398
You could also add some "virtual" information added by some ship computer which could approximate distances, directions and velocities with transparent lines/grids/whatever looks cool

Like if you are traveling fast it might make it look like you are going in a tube of sparsely placed virtual circles (the aster they come the higher speed)

Share this post


Link to post
Share on other sites
FromShadow    145
Thanks guys, you have been really helpful. I'm getting a copy of ShaderX7 from amazon.
Also adding some Heads Up Display of ship information is a great idea and would be cool and helpful at once.

Edit: I added a particle engine now and I found engine trails to work really good for that "3D-feel". Trying to add star dust now. Edited by FromShadow

Share this post


Link to post
Share on other sites
Norman Barrows    7179
lack of visual orientation cues (which way am i headed, and which way is up?) are your problem.

been there - done that.

i've done both faster-than-light and sub-light flight simulators. the best method will depend on the speed of the ships, but for both methods:

1. fog:
lose the fog. there's no fog in space, and fog is cheating. it should be possible to draw everything to scale all the way down to one pixel in size before you hit the far plane (except maybe the skybox). as i recall, the solution there is to do a first pass where you draw the skybox, then a second pass where you draw everything that's supposed to be inside it. that way the skybox is always in back, and the ships, planets, etc are in front of it. as i recall, a very large far clip plane was required for both games, perhaps something on the order of 10000 units, vs the more typical 1000 (assuming a near plane of 1). once you're done, you might toss in some fog or AA to soften it a bit. but higher rez sharper graphics with dramatic lighting are what you really want in a space sim. hi rez realtime raytracing is the holy grail of space sim graphics.

2. skybox:
put stars on the skybox. animated skybox textures can be used to make all the stars in the sky twinkle.


3. visual orientation cues:
to aid in orienting the player (very important in a space fighter sim), draw distant galaxies just inside the skybox in the 6 cardinal directions (up, dn, left, rt, fwd, back). you can also add additional distant galaxy graphics to "fill out" empty areas of the sky. (warning: distant galaxy graphics are cool and addictive, its easy to go overboard). you can also use animated textures to do distant sparkling stars etc, instead of distant galaxies. each of these unique stationary distant objects acts as a landmark to help the player get their bearings. if the battle occurs near a spaceport, planet, asteroid belt or other "terrain object" in space, draw that too.

4. lighting and shadows:
don't forget lighting. lighting is everything in a space scene. lots of diffuse, very little ambient. lots of well defined shadows. its should look sharp, and harsh, and stark, not soft, fuzzy, and foggy. although difficult to do, realistic shadows will do wonders to provide visual orientation cues.

5. if your ships are supposed to be travelling faster than light:
use a particle system of streaming stars around the ship. 100 particles in a box area in front of the camera should do it. this gives you the star trek streaming stars effect. i used this method to good effect in my star trek flight simulator (SIMTrek / SIMSpace). the particles are actually lines with a head and a tail, whose length is a function of the light speed (faster = longer tail). put stars on the skybox. the motion of the stars as you move and turn gives an excellent sensation of movement.

6. if your ships are travelling at sub-light speed:
throw in the odd streaming small asteroid (al la wing commander) to enhance the feel of forward motion. this again is a particle system, but maybe only 10 or 20 particles, drawn as asteroid billboards or models. i used this method (skybox, distant galaxies, starbases, planets, etc - but no animated textures) to good effect in my space fighter simulator (Gamma Wing).

once you have all that you can add nebulous clouds etc with translucency, either as an inner skybox layer (moves with the camera) or as objects that you fly past / though.

as mentioned in other replies, a HUD helps for those players comfortable flying on "Instrument Flight Reference".

as you've also noticed by now, those flames coming out the engine cones help a lot. don't forget to animate them! <g>

Good luck, keep at it, looks cool.

Norm Barrows
Rockland Software Productions

Share this post


Link to post
Share on other sites
3Ddreamer    3826
[quote name='Norman Barrows' timestamp='1353094558' post='5001618']
fog:
lose the fog. there's no fog in space, and fog is cheating.
[color=#800000]I agree totally.[/color]


2. skybox:
put stars on the skybox. animated skybox textures can be used to make all the stars in the sky twinkle.
[color=#800000]I disagree totally with the twinkling. Stars only twinkle if there is atmosphere or maybe a "space dust" cloud dense enough to cause it when the ship is moving.[/color]
[/quote]

[img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]


Clinton

Share this post


Link to post
Share on other sites
Prinz Eugn    4418
For visual orientation, you could use a Milky Way effect (which also happens to be perfectly realistic). It would be big cloudy band 360 around the player to give them a sense of what's "level". You could then put a galactic core on one end, thin it out on the other to give a sense of direction, and do something like Norman Barrows was saying and put (for example) a brightly colored nebula 'above', and a pure white-ish galaxy in the distance 'below'.

Share this post


Link to post
Share on other sites
FromShadow    145
Thanks for the answers. I see now that fog really was the wrong approach.
I have worked on the suggestions and thought I'd share the results:
  • I had a hard time drawing a Skybox myself, mostly due to parallax errors in the corners and my inability to mask the transitions at the edges. For anyone searching, try Spacespace (http://alexcpeterson.com/spacescape). It does the job beatifully and I'm glad I stumbled on this. For the time being, I could get away with a single rendering pass, since there are no distant objects and the skybox is 10000 big, as suggested.

  • The Skybox helped with orientation in a relative manner, like you can tell which way you are turning/looking. But what I needed was an absolute reference point, so I followed Prinz Eugn's advice and added a milky way band all arround one axis (It's actually tilted, but there is no way to notice, which I'm pretty happy about). The galaxy is additively blended over the background which works great.

  • The galactic core on the side of the sky box further helps with orientation. I made it really bright and added directional lighting. sharp lighting really is the way to go, I more than doubled the intensity and it looks good. smile.png

  • HUD: For now I added a line for each ship to indicate its current target. There is a lot to be done, like showing the estimated flight path (which should be curved rather than straight). Right now it is a wirefrime line, but I would want it to be a translucent and add a subtle glow effect.

  • Particles: Added a threaded particle system. This makes things come to life, I added basic explosions and engine trails, but they are really ugly because I can't draw ;). I am working on that "star dust" thing right now, which will be hard because I cannot reposition particles right now to implement an infinite scrolling cube, only spawn new particles.
I attached a few screenshots. Edited by FromShadow

Share this post


Link to post
Share on other sites
3Ddreamer    3826

Oh, I feel that you are on the right track!  It is really coming together.smile.png  

 

Be careful of "feature creep".  The star seems a bit too bright for my liking, but maybe that's only my opinion.  Many objects in the field of view will lose some people, but I actually like the challenge.

 

The choice of colors is wonderful!  Keep up the good work!

Share this post


Link to post
Share on other sites
Norman Barrows    7179

HUD: For now I added a line for each ship to indicate its current target. There is a lot to be done, like showing the estimated flight path (which should be curved rather than straight). Right now it is a wirefrime line, but I would want it to be a translucent and add a subtle glow effect.

Particles: Added a threaded particle system. This makes things come to life, I added basic explosions and engine trails, but they are really ugly because I can't draw ;). I am working on that "star dust" thing right now, which will be hard because I cannot reposition particles right now to implement an infinite scrolling cube, only spawn new particles.

 

Looks beautiful!

 

You're definitely getting there.

 

 The stars do look a smidge on the bright side, as mentioned elsewhere.

 

I myself like the busy screen, reminiscent of scenes from star wars. More action than the player can track can help with immersion. Although too much can lead to confusion and then frustration. 

 

For the HUD, have you considered the horizontal and vertical onscreen compass displays used in early HUDs on fighter aircraft? With a big giant compass down the left side reading 10 degrees up pitch and another one across the top reading a heading of 270, its hard not to tell which way you're going.

 

re: particles:

I assume you mean you have yet to implement moving particles and only have stationary types. 

if so, and you keep different types of particles in the same array (linked list etc) with a type field (rock, explosion, etc), then the moving cube is easy to implement using your current array. define a new type: moving_particle (or whatever). create  100 or so at random locations in a cube around the ship. each frame, call a routine that moves the moving_particles towards the back of the ship by an amount based on the speed of the ship by changing the x/y/z position. when they reach the back of the cube, generate a new random position at the front face of the cube. in a left hand coordinate system in object space this would be moving them in the -z direction, then regenerating them at the positive z face of the cube, at a random x,y location on that face. This is probably the best way to implement it, in object space. when it comes time to draw, you have a nice cubic particle field surrounding the ship already specified in object space coordinates. for each particle, simply apply the ship's world transform to move it out to the ship's position and orientation, then draw as usual.

 

for drifting space dust, you may want to consider alpha blended billboards or some other technique that lets you represent more than one chunk of dust with a single particle to keep the overhead of the particle system down. but try it first and see. Like Michael Abrash said at the '96 Gamedev conference lecture on the Quake engine, computers are really good at doing the same simple thing (like moving a particle) lots of times in a row really really fast. the problem is that graphics cards are not good at drawing large numbers of batches of just a few dynamic triangles per batch, which is exactly what games do and need. vidcards are good at the opposite, drawing a few batches of a vary large numbers of static triangles. So 10,000 particles may be doable, but not drawable. OTOH, I've gotten pretty good results on the infamous "10,000 blades of grass" challenge in my current project on a baseline PC with just an on-board graphics chip, so the horsepower may be out there to go stardust crazy. Note however that i'm definitely not using one triangle per blade of grass, something more like 2500 triangles to draw 500 meshes with grass blade textures, and yes, they do move! 

 

stardust - grass blades.  swaying - drifting.  same idea - different texture.

 

 

can't wait to see the next round of screenshots!

Share this post


Link to post
Share on other sites
Norman Barrows    7179

for each particle, simply apply the ship's world transform to move it out to the ship's position and orientation, then draw as usual.

 

actually, i think you want to translate to ship position, but NOT rotate to ship orientation. that way when you turn, the particles don't turn with you.

or maybe not, have to think about that. been a long time since i did this effect. but it is possible to get a ship that flies and turns through a star field (space dust, whatever) just like in Star Trek.

 

anyone else out there remember how to do this?

Share this post


Link to post
Share on other sites
Norman Barrows    7179

I don't have anything to add, I just wanted to mention how gorgeous the new screenshots look with that skybox thrown in.  That's some great stuff right there.

 

 

actually i think its the dramatic lighting the really makes the difference.

 

the skybox is to die for (although the flare is strong).

 

but imagine the foreground from the first screen shots with the new skybox. its the lighting that makes the real difference, although you don't notice it unless you think about it. Lighting is everything. I used to do raytracing before i got into realtime 3D. I'm still waiting for a realtime raytracer graphics engine.

Share this post


Link to post
Share on other sites
BCullis    1955

I don't have anything to add, I just wanted to mention how gorgeous the new screenshots look with that skybox thrown in.  That's some great stuff right there.

 

 

actually i think its the dramatic lighting the really makes the difference.

 

the skybox is to die for (although the flare is strong).

 

but imagine the foreground from the first screen shots with the new skybox. its the lighting that makes the real difference, although you don't notice it unless you think about it. Lighting is everything. I used to do raytracing before i got into realtime 3D. I'm still waiting for a realtime raytracer graphics engine.

You're right, I didn't notice it because it just "looks right".  But those shots from "beneath" the shaded side really highlight what you're talking about.
Either way, bravo OP!

Share this post


Link to post
Share on other sites
Norman Barrows    7179

distant stars seem to be light sources and have lense/flare effects,

 

are you making a flight simulator or a movie?

 

there won't be any lens effects in a flight simulator. in a movie there will be.

 

unless the view out the window is a virtual window displaying what a camera sees - then there would be lens flare.

 

while lens flare looks cool, especially in space scenes, It does not occur in real life when the "camera" is a human eye, only when its an actual camera, like a movie camera.

 

another realism issue like the twinkling stars.

 

the way i handled solar systems etc was to... (thinking back, this was about 15 years ago...)

there was a map that said where stars were, and what planets and moons were in the system. A 3D map.

 

when you flew close to a system, you draw the star, planets, and moons. a skybox was used to provide a distant star field background. galaxy billboards were drawn just inside the skybox in the four cardinal directions, and up and down to provide visual orientation cues. and then there was the streaming stars particle system. this was a cloud of stars around the ship that moved as you moved, giving the  streaming stars effect (complete with Doppler tails) seen in Star Trek when they're flying through space. the location of planets and moons was based on a global turn counter (# of game turns or frames since game start). so they orbited around, and all that cool stuff.

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