Good far plane distance for space game

Started by
16 comments, last by Hawkblood 10 years, 8 months ago

Yes, Servant - that is exactly what I was talking about. See I didn't know that mr. Crow wasn't familiar with those concepts.

Now that I think of it, perhaps it's better to resort to just using spheres with more or less polygons. (Render targets and FBO's can be a mouthful, but as Servant mentioned, they really will deliver in terms of performance, if you require many "objects" to show at once.)

Most Graphics APIs (or their extensions) allow creation of spheres given a number of slices. Those can be difficult to texture map, so perhaps you can benefit from doing a little shader programming. It shouldn't take too much effort, though. As with the skybox, those can also be positioned relative to the camera in a manner that make them seem much further away than they really are. (Barrows has some insightful comments on measurements)

You could divide it's size by a certain amount, and then scale its position by the inverse. (I'm not sure the two measurements will be proportional, you'll probably have to square one of them.) It may be necessary to disable drawing to the depth buffer, so nothing drawn afterwards will reveal the trick.

There's so much smoke and so many mirrors available to use, it can be difficult to pick between them. ... But remember to pick.

Once you have set up a wrapper for rendering to textures, the extra work isn't really that bad, and you will benefit from it in the long run.

(Using FBOs in OpenGL)

http://www.gamedev.net/page/resources/_/technical/opengl/opengl-frame-buffer-object-101-r2331

http://www.gamedev.net/page/resources/_/technical/opengl/opengl-frame-buffer-object-201-r2333

(Using render targets to render to texture in DX10)

http://www.rastertek.com/dx10tut22.html

http://www.two-kings.de/tutorials/dxgraphics/dxgraphics16.html

http://www.gamedev.net/topic/576213-directx-10-render-to-texture/

Advertisement

you'll never draw more than one solar system at once. everything else is skybox, distant 3d billboards of galaxies etc, and a particle system star / rock / debris field around the ship. plus your targets (other ships, star ports, etc). as the ship approaches a system, you add it to your list of stuff to draw (active targets / scene graph). when its goes beyond max visual range, you remove it from the list. you'll need a world map that tells you where the stars are. as the player flies through the world map (a star cloud), you simply draw the skybox, distant galaxies, star field, etc. and occasionally the odd star system if they happen to pass close enough.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

a low poly sphere will be sufficient for drawing, perhaps 8 to 12 to 16 sides. for orbital closeups you may want to switch to a 20 or 24 sided sphere, maybe more. just enough so it looks round.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Thanks for the links guys... appreciate the feedback!

For more on my wargaming title check out my dev blog at http://baelsoubliette.wordpress.com/


You can also use multiple depth ranges, and render the scene in "layers"; starting from the background (furthermost objects) and finally drawing the foreground (nearest objects), changing the near and far plane (and clearing depth) for each layer.

That's EXACTLY what I am using in my game.....

You're going to need a new coordinate system. I found that if you use the normal floating point system, when you get past the 10th digit, things start to go freaky..... The floating point can't handle very large or very small numbers. If you are interested, I already developed a struct for that.

This is not a small task you are undertaking. Don't be discouraged, though. It will be a good experience for you.

(this is not a shameless plug)

This is a short YouTube vid showing a little of what I have done. It doesn't show everything, but maybe you could get some inspiration....

Awesome thanks for the link.

For more on my wargaming title check out my dev blog at http://baelsoubliette.wordpress.com/

I second Nik02s suggestion.
You should also look into LOD and skyboxes.
Also you can completely fake the distances if the multiple depth layers doesn't fit you:
You can completely disable depth testing if you just draw in the right order.

You can use impostors for far away stuff.
You can render everything to a spherical map (or a cubemap) and render that. If the objects are far away enough,
it's alright that they don't move when the camera does. (If you have need for both, you can use impostors too.)

There's plenty of options. Good luck! :)

I would still keep a Z depth values.

Why if your want your game be 3D view or Oculustrift ready you could choose for a way that supports this.

If you render order would be sky box then imposters that are far far away. Ignore the Z value but set it to max. As it would be close to a infinity setting.

A example would be the X- series game X3 where 3D mode the skybox is renderd just like hud objects in the 3d Z value forground. That look like dogfighting with a starship where the stars are as close as spacefly's on cockpit with double target box with offset. Like they are close to the cockpit. Very weird looking.

But a battle cruiser fly by you see a nice 3D effect wenn it fill out the whole viewport. Those things are 1 to some Km large. Very usefull for flyby.

The trick I use is multiple D3DTS_PROJECTION calls for various depths. If you just use 1 projection matrix with 1 FCP, you will have a LOT of z-fighting. Another thing you might need is:


			HUGEVECTOR3 V=Ship[i].V_Location-GE->MyCamera.CraftLocation;
			D3DXVECTOR3 v=V.Normalize();
			V.Length/=10.0;
			float S=1.0f;
			if (V.Length>10000.0){
				float asd=(20000.0f*57.289961630759f)/float(V.Length+5000.0);
				asd/=180.0f;
				S=asd*D3DX_PI/2.0f;
				v*=10000.0f-(5000.0f*S);
			}
			else v*=float(V.Length);
			S/=10.0f;

I use this for my ships and stations. First I divide all the distances by 10. Then I use a distance formula for anything beyond 10000. I use this formula to scale the object and place it in space before the FCP.

This topic is closed to new replies.

Advertisement