-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add clamped vector polylines #9398
Conversation
Thanks for the pull request @ebogo1!
Reviewers, don't forget to make sure that:
|
sources: [PolylineCommon, vsSource], | ||
}); | ||
var fs = new ShaderSource({ | ||
defines: ["VECTOR_TILE"], |
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.
This is where DEBUG_SHOW_VOLUME
would go if you wanted to debug the volumes, CC https://github.com/CesiumGS/cesium/blob/master/Source/Scene/GroundPolylinePrimitive.js#L406.
If we wanted it to be toggleable we'd probably have to wire something through to Cesium3DTileset
.
|
||
var previousCompressedCartographicScratch = new Cartographic(); | ||
var currentCompressedCartographicScratch = new Cartographic(); | ||
function removeDuplicates(uBuffer, vBuffer, heightBuffer, counts) { |
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.
This might be handy to have elsewhere in vector tiles too, wherever positions are getting unpacked from those quantized u/v buffers. It'll need a more specific name if it becomes its own file though.
I removed the unused property in There is also the line from #9399 (comment). |
@likangning93 had some minor changes for CI to pass but should be ready for another look. I added the |
@ebogo1 you mentioned it above, but make sure to address #9399 (comment) soon |
Is there a sandcastle that we could play with? Screenshots? Maybe we can tile some non-customer data. @likangning93 do you know if we have any data like that? Normally I would also suggest a new official sandcastle example but given that this is for the older Also, we should have units tests for the new behavior. |
The code is currently crashing because the Here's a sandcastle I put together for testing: Sandcastle What's interesting is that even after that problem is fixed there's still some issue where the polylines don't show up at all. Is it because of our usage of |
This one's kind of random, but in #8726 I had to render shadow volumes with premultiplied alpha blending instead of regular alpha blending since alpha blending against a black framebuffer like the globe translucency framebuffer would result in darker colors than normal. The same sort of change needs to happen here - I pushed the change: 0351120. This is what I was starting to test in the comment above. The commented out lines will enable globe translucency. I think similar changes will be needed in #9399 as well and I'll look at that once the changes here are confirmed to work. |
False alarm, the sandcastle was wrong. |
Can confirm clamping behavior is working on Cartersville TIN mesh after 4668ca6 |
I realized I had to make some adjustments to the premultiplied alpha code because it wasn't taking into account the fact that the batch table overwrites These are the sandcastles I used for testing: vctr-sandcastle, b3dm-classification-sandcastle, geom-sandcastle |
Here's the relevant chunks of import CullFace from "./CullFace.js";
//...
function getRenderState(mask3DTiles) {
return RenderState.fromCache({
cull: {
enabled: true, // prevent double-draw. Geometry is "inverted" (reversed winding order) so we're drawing backfaces.
face: CullFace.FRONT
}, I don't know why this is the case though, since the geometry code in the vertex shader and the indices for each volume should basically be creating "inside-out" geometry already. |
There might also be something about the [EDIT] I did notice that when we use logarithmic depth,
|
… by culling front faces
… in Vector3DTileClampedPolylines
Investigating "When viewing a clamped polyline tileset from above, artifacts like this begin to appear."I made some shader and render state changes off 6e4d7ef to try to get to the bottom of these, resulting in the two commits below. Here's the Sandcastle I used for testing.
The algorithm we're using to draw clamped line segments does something like:
The goal is to draw the "inside" faces of the volume instead of "outside," so that when the camera enters the volume it should still see the decal instead of backface-culling it all. In other words, we were drawing front/outside faces, not back/inside faces. Flipping the face culling (or reversing the indices in the geometry) fixes the problem, but I still don't fully understand why the geometry is drawing front/outside faces in the first place. investigateFaceFlip6e4d7ef.patch.zip
With face-flipping turned on and no other changes, "smaller" chunks of the polyline were still missing. Moving the camera along the line segment caused the artifacts to "slide" instead of staying where they can't hurt us. This looked a little like parallax to me, so I switched the debug bounding volumes back on. Lo and behold! Even drawing back/inside faces correctly (as evidenced by the "sides" of the current volume being visible), the bottom of the volume wasn't drawing, hence the lack of classification! Now, this was drawing using the actual-size shadow volumes, which go something like -100,000 meters below and 9,000 meters above the ellipsoid in this area. Here's a patch to reproduce the gifs for this part: investigateDepthClip6e4d7ef.patch.zip Side-note, I also noticed that |
With some more help from @likangning93 I was able to get rendering and picking specs to pass as well. I think this is good for another round of review! |
I renamed EDIT: we'll see how CI handles it #9398 (comment) Make sure to do the same rename in SC once the newer version of CesiumJS is pulled in. |
I also left a comment above: #9398 (review) EDIT: is was a simple change so I pushed it 4fd49c5 |
By the way, excellent detective work @likangning93 |
Thanks @ebogo1 @likangning93 ! |
Opening as a draft to make sure things are in their place before adding specs.
decodeVectorPolylinePositions
logic to its own file in CoreexamineVectorLinesFunction
andminimumMaximumVectorHeights
properties toCesium3DTileset
Vector3DTileClampedPolylines
classVector3DTileContent