Skip to content
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

DebugCameraPrimitive uses FrameState's frustum splits even when using a custom camera #8848

Closed
IanLilleyT opened this issue May 13, 2020 · 1 comment · Fixed by #8849
Closed

Comments

@IanLilleyT
Copy link
Contributor

IanLilleyT commented May 13, 2020

Brought up on the forum: https://community.cesium.com/t/debugcameraprimitive-depth/9603

Example

Notice how the debug camera frustum is extremely large even though the near and far planes are 1.0 and 10000000.0, which should cover less than the earth.

The problem is DebugCameraPrimitive is using FrameState's frustum splits to render frustums, which doesn't make sense when passing in a custom Camera object. This creates a feedback loop where the DebugCameraPrimitive is created, FrameState adjusts its frustums to fit the DebugCameraPrimitive, then DebugCameraPrimitive uses FrameState's frustum splits to grow even larger, then FrameState adjusts its frustums to fit the larger DebugCameraPrimitive, and so on, eventually getting quite large.

DebugCameraPrimitive shouldn’t be using FrameState's frustum splits at all, since they come from a different Camera. But then this will mean DebugCameraPrimitive can only render one frustum per camera, as Camera doesn’t have a concept of multi-frustum, which will break some debug visualizations in the cesium inspector.

Some fix ideas:

  1. DebugCameraPrimitive only renders one frustum. The cesium inspector would have to render multiple frustum geometries manually using the scene's camera and the associated FrameState frustum splits.
  2. Create a new debug primitive type that takes a list of frustums as arguments.
  3. Add multi-frustum to the Camera class. Not sure how this would work exactly.

I'm leaning towards option 1.

@tkazik
Copy link

tkazik commented May 13, 2020

Thank you for opening that issue. I agree and think that option 1 is probably the best shot:

  • It is the easiest to implement
  • It should be enough for 95% of the use cases

As a next step, we then could think about multiple frusta...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants