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

Remove the dependency on ApproximateTerrainHeights from GroundPrimitive and GroundPolylinePrimitive #8480

Open
IanLilleyT opened this issue Dec 19, 2019 · 7 comments

Comments

@IanLilleyT
Copy link
Contributor

IanLilleyT commented Dec 19, 2019

Currently GroundPrimitive and GroundPolylinePrimitive set their shadow volume bounds based on approximateTerrainHeights.json, a file full of earth's min and max heights at different longitudes/latitudes. If a user has a custom terrain dataset or uses terrain exaggeration, these approximate heights no longer work and the ground geometry will be clipped.

To fix exaggeration, we could add a height vertex attribute and scale it by terrain exaggeration in the shader. This is a little tricky because there's no more room for attributes for polylines. We could oct encode one of the normals to make space but I don't know if that's a good idea. Another option is to use a uniform or batch table entry with the min and max height, but since the geometry is created in the worker after the batch table / uniforms is created, it doesn't know the values. Also we would need a geodetic surface normal to offset the vert in the right direction. I would prefer baking the exaggeration into the verts if possible. Would need some rearchitecting.

For custom terrain datasets, I don't know... the polyline geometry would have to be rebuilt whenever the terrain underneath it changes.

See #8436 (comment) for an example of polylines breaking.

@IanLilleyT IanLilleyT changed the title Remove the dependency on ApproximateTerrainHeights from ground primitives and polylines Dec 19, 2019
@malaretv
Copy link
Contributor

Seems like this could also fix the issue I've been having with GroundPrimitives on a lunar ellipsoid (see #7552)

@malaretv
Copy link
Contributor

malaretv commented Nov 5, 2021

Is the team still thinking of moving this direction? We're highly interested in either moving away from the approximateTerrainHeights dependency or being able to at least swap in different values at runtime

@ggetz
Copy link
Contributor

ggetz commented Jul 11, 2023

Issue with this reported in #11385.

@ggetz
Copy link
Contributor

ggetz commented Jul 20, 2023

Also reported in #10274

@ggetz
Copy link
Contributor

ggetz commented Oct 19, 2023

Issue with this reported in #11570.

@ggetz
Copy link
Contributor

ggetz commented Nov 10, 2023

Issue with this reported in #11616.

@ggetz
Copy link
Contributor

ggetz commented Jan 29, 2024

Manifestation of this reported in #11791.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment