Hello.
I apologize in advance for my poor English.
I use cesium for unity.
I placed several objects on the map with the CesiumGlobeAnchor component.
Each of these objects has a camera and in my canvas I display their camera views on separate pages.
My problem is that because the objects are far from the 0,0 unity position, the object cameras do not render the area correctly and display very poor quality.
I don’t know if it is more correct to ask this question here or on the unity site, because I know that this is basically a problem of unity that cannot render objects that are very far away in coordinates correctly.
Maybe they do this on purpose for better performance under normal circumstances.
But according to the search I did on the web, it seems that Cesium has a component that probably wants to do the same thing.
CesiumOriginShift
And I realized that there should only be one object in my environment with this component.
Given this explanation, is there a way to solve my problem here or should I ask my question somewhere else?
Note: My objects are very far apart and may be thousands of kilometers apart.
Another point is that my camera is initially several million kilometers away from the Earth in order to display the entire Earth.
The last point is that the mentioned component is currently connected to my main camera.
Thank you for your time.
Hi @amir_hamed,
That’s a tricky one. As you mentioned, the CesiumOriginShift can be used to keep the Unity origin near a camera, in order to avoid the precision problems that result when the origin is too far away in Unity’s single-precision engine. But if you have multiple cameras, very far away from each other, displayed simultaneously… you would essentially need a separate Unity coordinate system for each camera, and each object’s position would need to be expressed relative to each camera separately. I’m not aware of any way to do that in Unity.
For what it’s worth, this wouldn’t be a problem in Unreal Engine 5, because it uses double-precision coordinates.
It might be worth asking this question on a more general Unity forum, in case someone there is aware of a solution that we’re not.
Thanks for your reply.
I hope I can find a solution there.
Migrating from Unity to Unreal is too complicated and time consuming for a large project I have.
Thanks ![]()
Hi @amir_hamed,
I’m going to propose a very ambitious solution that might be complicated to implement. I wonder if you can make use of the fact that you can tell Unity cameras to only draw specific layers and/or objects? For instance, there is the cullingMask property on a Camera that lets you cull certain layers from a camera view:
See these threads for example:
Now… I can’t promise good performance with this approach, but you could technically have multiple copies of CesiumGeoreference with a Cesium3DTileset displaying the same tileset. You could set a different Layer on each Cesium3DTileset instance. Then, each camera would only draw one layer, and thus one tileset per camera. You should also use Cesium Camera Manager to specify exactly which cameras are viewing a given tileset, so that you’re only selecting tiles from one camera per tileset.
This probably won’t scale well with a lot of cameras, or with really big datasets, but it’s probably the most feasible way I could think of for now. Let us know if you try it out or find any other alternative solution!
Hello and thank you for your answer.
Sorry for the late reply.
This solution does not work for my work. It causes a huge performance decrease.
While I do heavy work on my objects and each of the objects is responsible for heavy work, so I cannot use this method.
But thank you again for your answer.
I hope it was useful for other friends.