World scale

Hi again.

What is the best/usual scale for a world / camera in a 3D game.
Is it usual to have a camera’s farplane of 2000 for ex ? or is it better to have 20000 ?
I have a lot of models to load, but all of them are not using the same scale, so… I’m trying to sort of normalize these. And by the way, wondering if for ex GTA5 has a farplane of 100000 or only 4000 and the scale of objects fit in.

I’m planning to make a space game, and so the farplane must be really really far.
Spaceships are really small compared to a planet… So what would be the best scale to not show spaceships as points :slight_smile:

Much of this question really relates to timing.

The projection matrix with perspective itself just does two things well 3.
0) Takes xy positions and turns them into or scales them to -1 to 1 by the near plane

  1. Takes z positions and turns them into z 0 to 1 by the far plane
  2. Takes xy positions and puts them closer to the center of the screen depending on there z values by both far and near planes.

In 3d near far planes determine were you wont draw pixels the card clips negative z values. less then 0 in the case of monogame because it flips the z to be negative for the view frustrum.
The gpu itself draws from -1 to +1 a total unit length or scale of 2

That said.
Placing your near plane at 1 basically gives you a screen sized draw for a quad that is a total length of 2. Which begs the question how big are the models how big should they be for you.
I usually put my near at like .75 or .5 and far at 1000.

The far plane can be whatever you want what you need is other things to conform to it.

One consideration for your far plane is your skybox or sphere you use.
As well as how fast things move compared to how long it will take them to get to the far plane from 0.

Will it take 2 seconds to go from a dot to fully in your face or 10 minutes?

What you really should think about is scaling each model you load to be some controlled size that you will use as a standard measure in your game that pixels represent and what that standard is. That is completely your choice but you should try to bring everything you load into line with your standard.

In the very end it boils down not to size but timing things against how they appear to behave. You make the sizes of things conform to your own standards for distance and times.

After all size is relative and in this case it must relate to how you want your universe to appear and play.

that might be the coolest sounding thing ive said in a while.

1 Like

that might be the coolest sounding thing ive said in a while.

Sounds like a S. Hawking sentence :wink:

My models range from a fighter to capital class ship up to universe: asteroid fields, blackholes, gas nebulas,
galaxies. I’m planning to use a streaming technique to load all this.
Let’s say you will be able to zoom on ships, and the farthest you can see you can move there (so, about a lightyears to start with: 2 /3 LY)
My Farplane will be far ^^

Let’s say you will be able to zoom on ships, and the farthest you can see you can move there
(so, about a lightyears to start with: 2 /3 LY)
My Farplane will be far ^^

But how many pixels is a 2/3 lightyears and how big is a float ?

i can say my ship is 1f and thats huge or miniscule because depending were my camera is it is.
i can print to screen when its a dot that it is 1 * a bazillion meters away and that my ship moves .1f per second which is 1 tenth of a bazillion but in the float its just .1f and the float has a finite storage capacity of bits.

or from the reverse perspective.

How big is a float and how big is a screen pixel well its always just 1 position in real life we line them up next to each other. So how many pixels do i want 2/3rds of a light year to represent in my game if my ships are 6.6 light years from bow to stearn across(like my ships are made out of planets lol) thats like 10 pixels at 2/3rds of a light year distance. How fast will my ship move. btw don’t forget about collisions bullets need to move faster then ships but they also need to traverse less space then the size of a hitbox in a single frame so they don’t skip right thru it. Which in a space game your going to have point like bullets missiles most likely.

In general id try to keep it simple but lets say you start going with more realistic sizes.

You start off with the idea of having smaller ships be 1 unit length total and cap ships around 10 to 100 then planets i dunno 1000 +. Then your skybox or sphere which you don’t want it to clip planets so its gotta be even bigger. So then your far plane will need to be pretty big.
But really you might even want a smaller set of scales for a big play space.
So divide all that by 10 to keep the proportion. Then you have hit boxes for small ships that are scaled to about .1 in length at max. Bullets that are moving at .099 each frame so hitboxes can catch them and a speed limit on ships which is less then bullets by a good amount.
Unless your talking about more advanced collisions which is entire subject itself. So there is a lot of things to consider at once and you really do need to make the size of things conform to your needs.

btw it takes like 9 months for light to travel 2/3rds of a light year so that scale might be crazy big as a ship you saw at that distance would be a ship were it was 9 months earlier.

Deferred rendering and LOD spring to mind…

Is this 3D? if so, perhaps look into this?

You may have to load up Unity to see the code if possible at all… if not… oh well… could not find any actual source code… but I thought this may be useful here…

Sorry for the foggy answer but two things you should look into / keep in mind:

  1. Too much distance between near / far plane will increase z-fighting (Wiki Z-fighting)

  2. If I recall correctly when I just started with MonoGame I tried making meshes where 1 unit = 1 meter (eg average model was around 1-2 units) and near plane was around 0.1 far was around 75 (don’t remember exactly the details) and I was having problems with ray casting and collision - it was simply inaccurate. When I increased the far plane and multiplied everything by 10 factor, suddenly ray casting worked perfectly. I guess it has something to do with floating point.

Just because you want to be able to see stuff that’s two lightyears away doesn’t mean your far plane should be that far out. Like @GeonBit said, you’ll run into precision issues. You should do what everyone in computer graphics does, cheat :stuck_out_tongue: Figure out what objects you want to be able to see that are really far away and draw them closer by at a smaller scale or with some effect.
Another thing to note is that your depth buffer doesn’t need to be linear. You don’t need the same precision for far away stuff than you need for stuff that’s close to the near plane.

1 Like

Hummm I was planning to use sort of impostors to do this :wink:
After all, making a game is like being a magician, lure the player’s eye to immerse them (with a good story too) in our world.

@MrValentine It is 3D, and of course LOD will not be an option I think.

Thanks to all, I’ll take all these advices into account and think about all this.
I’ll come back with a screenshot “when it’s done” (ndlr: :wink: DukeNukem project…) in about a few days if I have some spare time to work on it.

maybe interesting for you, not sure if applicable

Why does this require a wink eye :stuck_out_tongue:

TGC? :joy:

But yeah it could work, bill-boarding and whatnot… and as animations can occur, like a galaxy rotation [depending on time speed lol] it could be cut out and simply display a 2D bill-board… at various scales/LODs