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

Clamp Billboards and Labels to terrain #2653

Merged
merged 43 commits into from
May 7, 2015
Merged

Conversation

bagnell
Copy link
Contributor

@bagnell bagnell commented Apr 21, 2015

NOTE: This is into the globe-depth branch because the globe depth texture is required.

Opening for early review. Still needs to be done:

  • Performance improvements
  • Doc
  • Tests

@mramato
Copy link
Contributor

mramato commented Apr 21, 2015

I know we talked about this a little offline, but I propose we replace clampToGround with a heightReference property and new enum, HeightReference. The three initial choices would be NONE (i.e. just use the ECF position) CLAMP_TO_GROUND and RELATIVE_TO_GROUND (where the height of the position is added to the terrain height). This would also allow for easily adding new height references in the future (such as RELATIVE_TO_SEA_FLOOR or RELATIVE_TO_MSL). All of these are needed to support KML (and Google gx extensions).

Will Models be handled in similar fashion?

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 21, 2015

I propose we replace clampToGround with a heightReference

OK with me.

Will Models be handled in similar fashion?

Yes.

Cartesian3.clone(Cartesian3.UNIT_X, scratchRay.direction);
}

var position = object._newTile.data.pick(scratchRay, mode, projection, false, scratchPosition);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this is already part of the performance plans, but we must be able to optimize the general-purpose ray intersection given we have the specific case of a ray normal to the ellipsoid surface. I'm talking about the actual number crunching...this is in addition to the spatial data structure / adjacency info / temporal coherence / etc.

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 21, 2015

  • Add an item to the terrain Sandcastle example
  • Update CHANGES.md

#ifdef TEST_GLOBE_DEPTH
vec4 offsetPosition = positionEC + vec4(0.0, 0.0, -positionEC.z * 0.05, 0.0);
vec4 wc = computePositionWindowCoordinates(offsetPosition, vec2(0.0, 0.0), scale, direction, origin, vec2(0.0), pixelOffset, alignedAxis, rotation);
float d = texture2D(czm_globeDepthTexture, wc.xy / czm_viewport.zw).r;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if number of vertex shader texture units is zero or depth textures are not supported? We don't need to throw an exception, but there should be a trivial way for the user to see if clamp-to-ground is supported and perhaps we should warn in the console if they ask if it and the system doesn't support it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks for reminding me. I wasn't sure whether to throw or not. I also need to check if we can create a fbo with a floating-point color attachment. I've had issues before where floating-point textures were supported but the fbos were incomplete.

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 21, 2015

That's all for this round.

bagnell added 2 commits April 22, 2015 14:42
…e when we walk the tree. Add an event to the quadtree that fires when a tile is queued for rendering.
… none, clamp to ground or relative to ground. Clean up modifications to quadtree when destroying a billboard or label.
@pjcozzi
Copy link
Contributor

pjcozzi commented May 4, 2015

I don't know if this is related to this issue (or Mac or Chrome vs. FF), but do you get horizontal black lines above and below labels?

image

@pjcozzi
Copy link
Contributor

pjcozzi commented May 4, 2015

I also get billboards that are partly behind terrain:

image

Then zoom in and it is OK:

image

@pjcozzi
Copy link
Contributor

pjcozzi commented May 4, 2015

Here's the WebGL Report if it is useful:

image

@pjcozzi
Copy link
Contributor

pjcozzi commented May 4, 2015

I don't know if this is related to this issue (or Mac or Chrome vs. FF), but do you get horizontal black lines above and below labels?

Perhaps Chrome only. FF is OK.

@bagnell
Copy link
Contributor Author

bagnell commented May 4, 2015

do you get billboards that disappear (and stay hidden until you move more) when zooming in

I've seen that for top-down views where a billboard or label is in a valley, but not for a horizon view like you posted. I'll try to reproduce it.

@bagnell
Copy link
Contributor Author

bagnell commented May 4, 2015

do you get horizontal black lines above and below labels?

I haven't seen that. Perhaps Mac Chrome only?

@bagnell
Copy link
Contributor Author

bagnell commented May 4, 2015

I also get billboards that are partly behind terrain

I've seen that at frustum boundaries. Is that the case for you?

@pjcozzi
Copy link
Contributor

pjcozzi commented May 4, 2015

I also get billboards that are partly behind terrain:

image

Then zoom in and it is OK:

image

I'm pretty sure this is a multi-frustum issue (use Cesium Inspector to confirm). If the fix is non-trivial, I am OK with writing an issue for it and merging anyway.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 4, 2015

I also get billboards that are partly behind terrain
I've seen that at frustum boundaries. Is that the case for you?

Yes.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 4, 2015

do you get horizontal black lines above and below labels?
I haven't seen that. Perhaps Mac Chrome only?

Appears to be Mac and Chrome only. No concern.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 4, 2015

I submitted a few ideas to #2685. Update it as you see fit. The terrain heights are fast enough to merge this, but we should optimize them when we get some time.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 4, 2015

@bagnell did you check the bounding sphere?

@bagnell
Copy link
Contributor Author

bagnell commented May 5, 2015

did you check the bounding sphere?

Yes. There were no code changes needed.

@bagnell
Copy link
Contributor Author

bagnell commented May 5, 2015

@pjcozzi This is ready for another look.

I'm looking at the frustum issue. It's really noticeable if you switch to labels.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 5, 2015

I'm still getting issues. Here we are looking east:

image

Zoom in a bit and billboards disappear in the top left (north east corner):

image

Also, this can be too aggressive with the offset for the case where the billboard is on the face of Seneca Rocks and the viewer is on the other side and zooming out.

If we have to err one way or the other, I would rather be too aggressive about making labels visible, but I also think a smarter offset could get us a 90% win.

@bagnell
Copy link
Contributor Author

bagnell commented May 5, 2015

You'll have to show me that tomorrow. I can't tell what is going on from the screen shot.

I've tried a bunch of different views and have been able to rationalize that its correct. I have seen billboards disappear as you zoom in because they are behind the terrain. As the billboards remain a constant size, parts pop out from behind the terrain. But, instead of only seeing that part, we determine that the whole thing should be visible so it pops into view.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 6, 2015

do you get horizontal black lines above and below labels?

I haven't seen that. Perhaps Mac Chrome only?

Appears to be Mac and Chrome only. No concern.

Fixed in the latest Chrome.

@bagnell
Copy link
Contributor Author

bagnell commented May 7, 2015

Add an item to the terrain Sandcastle example

Do we want to keep the development example I added? Should I still add an example to the terrain Sandcastle example or wait for entity support?

@bagnell
Copy link
Contributor Author

bagnell commented May 7, 2015

@pjcozzi This is ready.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 7, 2015

Do we want to keep the development example I added?

I think so.

Should I still add an example to the terrain Sandcastle example or wait for entity support?

Wait.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 7, 2015

This is OK to go into the globe-depth branch, but given the flicker due to the false positives, I would not merge into master until we figure out #2691.

pjcozzi added a commit that referenced this pull request May 7, 2015
…o-ground

Clamp Billboards and Labels to terrain
@pjcozzi pjcozzi merged commit 94dc317 into globe-depth May 7, 2015
@pjcozzi pjcozzi deleted the billboard-clamp-to-ground branch May 7, 2015 16:42
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 this pull request may close these issues.

4 participants