- Home /
Object with camera shaking at 40000 distance.
I have 10 different star systems at x0,y0,z0 / 0,0,40000 / 0,0,-40000 / 40000, 40000, 40000 etc.
Each star system is large so you can travel to and fro, visit a galaxy, star, planet satellite.
Problem smaller objects with a scale of 1,1,1 shake at a distance around 40000, worser the larger the number. The maximum orbit distance for satellite is 200, planet is max 4400, star is 44000, Galaxy 40000. Object don't shake when galaxy is at 0,0,0.
Satellite rotates, orbits planet, orbits star, orbits galaxy. The galaxies do not orbit, they stay still. When I move the galaxy from 40000 to 0 it stops shaking, but I can't have all galaxies at 0 they would be overlapping. I don't see any difference why it should be a problem, they are only coordinates. The galaxy is not orbiting anything. When Im in one of the galaxies I turn the other galaxies off, but when Im at the cosmos are, I need see all galaxies, to be able to choose which one to travel to, therwise I would of kept all galaxies at 0,0,0.
Any solutions?
I would guess the renderer is unable to handle objects at very large distances?
Hi, Depending on your computations, you may reach 32bits floating point precision limits. You can get info on that here: http://www.gamasutra.com/view/news/165567/ and here someone had a similar problem I guess: http://floatingorigin.com/mirror/oneil_01.htm
Answer by flaviusxvii · Dec 13, 2013 at 04:56 PM
Here the guys from Kerbal Space Program explain how they dealt with that issue.
$$anonymous$$ove the world and not the camera, good idea, only problem is that in the scene window I can't scroll north south west east, only click and it will zoom to that area even if its offscreen.
$$anonymous$$oving the world can be a good idea, but that really depends on what is in your game. In the case of $$anonymous$$SP there is not much going on apart from some planets and your vessels. If you plan of having hundreds of ships and stations an what not, you would have to move all of them relative to your ship, which could be a performance killer.
This was really insightful. Thank you. I've had these jitters for 2 years now... :O On my voxel game, >= 999 it gets real bad. https://deus0.itch.io/zoxel
Answer by DaDonik · Dec 13, 2013 at 04:43 PM
I'm also doing a spacegame and i encountered that jittering problem before, using other engines. The best approach i found is to create a second camera and a layer where all your galaxies, planets,... all the big stuff goes in. Make sure that your main camera does not render this "background" layer and also scale your big objects down, so you don't ever reach more than say 10000 units in one direction. Now all you have to do is move your background camera with a small percentage of the movement of your main camera. That way it will look as if you fly for minutes and finally reach that galaxy, even though it's only a few hundred units away from the origin of your background world.
How small can an object be? What is the $$anonymous$$imum size of an object?
I haven't tried anything smaller than 1 unit, but you could go smaller for sure. At some point you will get the same floating point issues, so i would not make it 0.0001 units small. Do you really need such a massive environment? I mean let's assume you put your star system 4000 units away from the origin. Having that system in the background world with the slower moving camera (as described in my last post), that could mean your system will look as if it is 400000 units away, using 0.01 as a mulitplier for the background camera movment. Thats already more than i have seen in any game i can think of.
I tried with the satellite at 0.1 and it has a terrible shaky effect, with a distance of the distance from the scene center 0,0,0, is 3200 unit. Then I ran into clipping panes problem, since I can't get close enough to view the satellite at 0,3 near clip.
Your answer
Follow this Question
Related Questions
Distance between a waypoint and the object 2 Answers
Picking Up Objects Within Range 2 Answers
[2D] Object at X distance to Y direction from point 1 Answer
Camera distance 1 Answer
how can i find the closest object (with the tag Point) 1 Answer