-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a component to identify cesium camera #421
Conversation
Thanks for the PR @raggnic! Can I please bug you to sign our Contributor License Agreement so that we can review this? |
I'm waiting for approval of my managers before signing it |
Sorry for the delay. I've signed the CLA |
Thanks @raggnic! We'll review this soon. |
Thanks for the PR @raggnic, and sorry for the delay in reviewing it! This looks really good for supporting an alternate camera. I think it would be straightforward - and worthwhile! - to extend it to support multiple cameras as well. I think it would just be a matter of making the static field on In any case, I'm going to move this PR out of tomorrow's release. I definitely want to get it into the August release, though! |
No problem about the delay, I'm not in position to complain :-) I'm little concerned about having several active cesium cameras, but I'm going to try where it goes |
I've extended the static field to support multiple cameras, but in cameramanager I only consider the first camera of the list |
Hi @raggnic, can you elaborate on where you're running into trouble? Multiple cameras with multiple frustums are already supported on the cesium-native side. I think it should just be a matter of calling this line multiple times, once for each camera:
|
Still needs a bit more work, so I'm moving this out of today's release. |
Hi Kevin |
Hi @kring . FYI I've taken your suggestion into account |
Thanks for all your work on this @raggnic! As I was reviewing this, I realized the collection of cameras should probably be a component rather than a global list, so that we can use different cameras in different scenes. So now there's a And then the question became, how do we know which I resolved this by getting rid of the The checkboxes allow you to disable the automatic use of the MainCamera and the Editor scene view camera. As a bonus, I also fixed an unrelated bug where a Cesium3DTileset that is not nested inside a CesiumGeoreference would throw a NullReferenceException when attempting to load. @raggnic can you take a look and see if you're equally happy with this solution? |
For our need in mixed reality the key point is to be able to separate the mainCamera from the one used to select tiles, so I approve this solution. |
Will we be able to edit this component in real time? That is, must it be constant at the unity bootstrap, or can we add or remove cameras depending on user logic? Right now, we are using a variant of Raggnic's code to handle this, as our main server cant actually load cesium. For that server, we have a special asmdef that disables Cesium in its entirety. The clients however have Cesium active, and they inject the appropriate camera after loading a particular scene, to avoid having null references in our servers logs. |
I suggest you try it out with a build from this branch if you have any doubts @Reag. But I think it shouldn't be a problem. The way it works is that the Cesium3DTileset finds the CesiumCameraManager when it's first enabled, but then it asks the camera manager for the set of cameras every frame. So you can programmatically add and remove cameras at will, and the change should take effect on the next frame. |
Thanks for taking a look @raggnic! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kring Tested this out and it works great! Most of my comments are UI / doc nitpicks that I would push myself, but I haven't figured out how to do so for forked branches yet 😓
I've addressed all your comments, so this should be ready for another look. Your nitpicks are always valuable suggestions by the way, not nitpicks at all! |
This PR gives the possibility to distinguish the camera used by cesium with a specific component.
It allows to have one camera to let cesium compute the frustum and the tiles to load. It will not render anything.
The rendering will be done by another camera. It is useful for a platform like the hololens to separate the actual rendering that is always done by the main camera from the tiles retrieval.
All of this is optional and if no camera use the CesiumCamera component Cesium will use the main camera