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

Visualize fog for 3D Tiles/Models #11716

Closed
ptrgags opened this issue Dec 21, 2023 · 1 comment · Fixed by #11744
Closed

Visualize fog for 3D Tiles/Models #11716

ptrgags opened this issue Dec 21, 2023 · 1 comment · Fixed by #11744

Comments

@ptrgags
Copy link
Contributor

ptrgags commented Dec 21, 2023

Splitting up #4196 into smaller, more focused tasks.

While #11715 focuses on the performance aspects of fog, this issue focuses on the visual aspects of fog.

The main objective is to add a FogPipelineStage to the Model pipeline that applies fog to models far away from the camera in horizon views. I had started prototyping such an architecture in the branch .

Some details, like using czm_fog() are straightforward. However, the main difficulty comes from computing the atmosphere color. Most of the details here are documented in other issues, so see:

Note that fog rendering is enabled separately from ground atmosphere, I'll open a different issue for the latter.

@ptrgags
Copy link
Contributor Author

ptrgags commented Jan 3, 2024

Yesterday I was talking to @jjhembd about the difficulties with projecting a vertex to the ellipsoid surface, and he had some good insights and resources to look at. Recording them here for the future:

Approach 1: Use a local azimuthal radius of curvature

  • Formula can be found in this PDF page 4.
  • It's used in VerticalExaggerationStageVS.glsl
  • This makes use of local curvature at the camera position, using the center of the tile may be more accurate. This might be important since fog applies to tiles far in the distance
  • Background concepts about the azimuthal radii of curvature:
    • There's more context on this Wikipedia page
    • The "prime vertical radius of curvature" is a fancy name for the principal curvature in the east-west direction. diagram
    • The "meridional radius of curvature" is a fancy name for the principal radius of curvature in the north-south direction,
    • The "azimuthal radius of curvature" is an (non-linearly) interpolated radius of curvature along an direction other than north or east.
  • This approach compares the ellipsoidal height at the camera position and the position of the vertex. The azimuthal radius of curvature gives a height correction due to the surface being curved.

Approach 2: Convert problem to 2D and use an iterative solver

  • This uses the assumption that X and Y radii are equal for the ellipsoid
  • This is used for voxels in convertUvToEllipsoid.glsl
  • Another version, nearestPointOnEllipse is on the ellipsoid-voxels branch
  • Since WGS84 is close to a sphere, using less than 3 iterations may be reasonable.

@ptrgags ptrgags mentioned this issue Jan 5, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants