To that end, I've produced a test scene.
First things first, multiple cameras. In order to get close and far viewing without z-buffer fighting, two cameras are bound together. The first should have its clipping set to near 0.01 and far 1,000. Ensure that this has a low depth priority (using a default scene camera, this should be -1). The second camera, with a near 1,000 and far 1,000,000 (or whatever you fancy) and a priority higher than the first (say, -2).
Depth priority means that the higher value is rendered first, then the lower values rendered over the top. It's important to set the first (lower priority) cameras clear flag to Depth only otherwise it draws over the far away items.
For a custom coordinate system, I crafted a small Vector3d setup using doubles. So far I've only needed to implement the constructor, magnitude, distance and the subtraction operator. The main idea here is to put an awareness bubble around the player (who stays at the origin in world space).
Moving the player object simply adjusts the Vector3d that belongs to it. Once the distance between the other objects and the player falls inside the awareness bubble I trigger the rendering of the non-player item and position it at the edge of the bubble. Its "local" position for drawing is then in relation to the movement values the player changes.
Throwing in some real planetary scales and distances brings the odd trouble, but probably require some shenanigans around faking scale ranges. This is a nice core double based system that should allow for some driving about.
No comments:
Post a Comment