Far away objects

Blitz3D Forums/Blitz3D Programming/Far away objects

PowerPC603(Posted 2004) [#1]
Suppose I wanted to make a space-sim (which I'm trying to) and I place some space-stations very far away (about 1.000.000 units, as I want to create big space-sectors, like Freelancer) and the camera-range is only 50.000 units, does Blitz render the objects behind that range?

Also, when the camera-range is 50.000 units and the camera-fog-range is only 10.000 units, will Blitz render objects which are 25.000 units away (but they cannot be seen because of the fog)?

Or should I hide/show the objects manually in code?

How big can the 3D-space be actually?


jhocking(Posted 2004) [#2]
The whole point of CameraRange is that nothing beyond the far range is rendered. Fogged objects are still rendered, just displayed in the fog color.

As for the "how big" question, I would recommend against placing objects 1,000,000 units from the origin. Your camera range of 50,000 is already way big. By that far away from the origin things start getting flaky because of inaccuracies in numerical values. To implement a huge space sim you shouldn't be literally placing objects relative to each other as per real life, you should be using tricks to make the scene appear larger than it really is. Tricks like LOD and using texture imposters for distant objects. This is the idea with a skybox after all; instead of literally placing some mountains in the distance, you put pictures of mountains all around the player. Think of a Hollywood set.


Genexi2(Posted 2004) [#3]
[EDIT] Dangit jhocking beat me to it.

does Blitz render the objects behind that range?


As far as I know, no.

will Blitz render objects which are 25.000 units away (but they cannot be seen because of the fog)?


From the looks of my code here it seems to render them only when they're out of the camera's range\view :



How big can the 3D-space be actually?


If you can keep the scale of the blitz units small, you can make the space larger without issues....though I have heard Blitz gets weird on very large numbers in a 3d space....


sswift(Posted 2004) [#4]
If an object is beyond the far clipping pane of your camera, it is not rendered.


"lso, when the camera-range is 50.000 units and the camera-fog-range is only 10.000 units,"

I'm pretty sure the answer is yes.


PowerPC603(Posted 2004) [#5]
I haven't though about LOD yet.

But I would be using: 1 unit = 1 meter (but this could change if neccessary).
If I should implement some giant Carrier-ships (few kilometers long), then the camera-range should be big enough (I think) to get it on my screen from a distance.

P.S.: I was just using some numbers, I don't know yet how big a sector will be eventually.

I'm still creating the editor (without it the game cannot run).
I'm using the editor to create datafiles, which state the position of all objects (and name, shield-strength, ...).
Without those datafiles, the game cannot build a sector (it uses this data to place all stuff).


jhocking(Posted 2004) [#6]
That scale is one issue right away. Don't do 1 unit=1 meter for a huge space sim. Doing a 3,000 unit size spaceship makes sense for, say, a level of a first-person shooter set inside the spaceship, but for a large-scale space sim you want *ahem* a larger scale. Depending on what exactly you are doing you might consider 1 unit=1 decameter (10 meters) or even 1 hectameter (100 meters.) Thus a 3 kilometer long spaceship is only 30 units.

That said, you should probably be flexible about that scale over the course of your game. In shots representing a universe all at once you would want a bigger scale, while in shots on a planet's surface you would want a smaller scale. Scale/resize all the objects around the camera and simply change your mental notion of what units mean as appropriate.

You better start thinking about LOD, because managing assets over enormous expanses is the main difficulty in writing a space sim. I would recommend doing stuff like only representing the couple thousand units immediately surrounding the camera with real geometry and using texture stand-ins for everything further away, never moving the camera too far from the origin (move the world around the camera instead,) and the aforementioned changing of scale (resize objects around the camera and change what you think units represent.)


Rottbott(Posted 2004) [#7]
A space game is hard because if it was in scale, and a huge spaceship was, say, 1 unit long, then Earth would probably be a few million units across.


Ross C(Posted 2004) [#8]
Yeah, you need to have a system that scales your world as you go through it. Like say a planet was 100,000 units away, you would make it 10,000 units away, but it would move closer at the speed fo the craft, but much slower. The speed it moves at would increase the closer you get, till it's within range and it moves to normal speed.


PowerPC603(Posted 2004) [#9]
I thought about moving the sector instead of moving the player.

Then the player-ship would stay at position 0,0,0.
But if there are many objects to move, would this be a big slowdown?

I can imagine Blitz would reposition all vertexes of these objects, which can be a lot more CPU-intensive then just moving the player-ship.

If I should take this approach, should I rotate the sector too (or just rotate the player-ship)?

And of course the scale could be 1 unit = 1000 meters (don't have any idea yet).
The player would not be allowed to fly his ship through the atmosphere anyways (like Elite).
I don't even think that players can land on planets (but that could change of course).

And I'm not going to try to recreate our entire solar system (or something that big).

It should be something like Freelancer / X-2 (not Elite).

In X-2, the sector-size is only 100km (from eastside to westside, also northside to southside).

If I would do something similar (and take 1 unit = 1 meter), then the maximum offset from the center would be 50.000 units (as the size goes from -50km to +50km).

Better would be: 1 unit = 100 meters (then the entire sector is only 1000 units big and reach from -500 to +500 units).

Then it would be good, I think.
Then I could move and rotate the player-ship (and leave the sector alone).

If I used a far-camera-range of 50, I suppose that's ok.
Then I could create battleships which are 2000 meters long (= 20 units) easily.


_PJ_(Posted 2004) [#10]
Galctic Allegiance uses a 1 unit=1m scale for movement, spaceships, asteroids and space-stations etc. however planets, moons and distances do not fit this scale, but are still quite proportionately large. True space-scale just doesn't work with Blitz because the numbers are phenomenal.


From my experience with G.A.,
I would recommend using a camera range with a scale of 1/1000 and movement adjusted to fit this (movement within that range can be 1/100 to scale without z-buffer issues)

If you need to display objects further away than this, substitute sprites at a relative position right at the edge of camera, until the objects are within a suitable range.


-Rick-(Posted 2004) [#11]
I had these exact problems a few days ago. The sollution is a mixture of moving the camera until i passes a specific distance then "normalizing" your environment so that everything shifts and you are back at 0,0,0 with you camera. This way you arent doing update math every code pass.

Here is the relevant link : http://www.blitzbasic.com/Community/posts.php?topic=36648

There is yet another link in there that leads you to a discussion on BlitzCoder that will provide the code and explanation to use it. My ranges were from 10,000,000,000 down to .000001 and my gfx became a huge mess as my camera moved around and I tried working on those scales. I've now managed to get everthing working great and no longer have "far from center" graphics anomolies.

Good luck!