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

3D Tiles - Support batch table binary #4228

Merged
merged 4 commits into from
Aug 26, 2016
Merged

Conversation

lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Aug 23, 2016

For CesiumGS/3d-tiles#32

This adds support for a batch table binary section to b3dm, i3dm, and pnts.

To do:

  • Need instancedWithBatchTableBinary tileset for testing. (This causes one test to fail)
  • Possibly remove handleTranslucent check for pnts, should be able to support transparent and opaque together.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 24, 2016

In the Sandcastle example with the new batched point cloud, picking works well when zoomed out, but when zoomed in, it often flickers between the back and front faces of the sphere as the mouse moves, which is expected.

No action now, but when we do, for example, the edge-preserving blur, we'll need to determine how to "blur" the pick ids, e.g., think more like nearest texture filtering, not linear.

*
* @exception {DeveloperError} name is not a valid value.
*/
ComponentDatatype.fromName = function(name) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add to CHANGES.md since this is a public class.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could also cherry-pick this into master.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 24, 2016

Can you verify that test coverage is solid?

Looks great!

@lilleyse
Copy link
Contributor Author

In the Sandcastle example with the new batched point cloud, picking works well when zoomed out, but when zoomed in, it often flickers between the back and front faces of the sphere as the mouse moves, which is expected.

I should be able to make this better by using normals and doing back-face culling on the points.

@lilleyse
Copy link
Contributor Author

Ah..... I accidentally committed some large pnts tiles, I'll squash my changes with smaller versions.

@lilleyse lilleyse force-pushed the batch-table-binary branch 3 times, most recently from ee2dc07 to 2806d11 Compare August 25, 2016 15:24
@lilleyse
Copy link
Contributor Author

Updated.

This also lays the foundation for dynamic styling in the shader. Here is a point cloud that stores a secondaryColor (shades of red) and temperature (3d noise values) as per-point properties in the batch table, loaded in as vertex attributes and styled in the vertex shader.
capture2

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 25, 2016

This also lays the foundation for dynamic styling in the shader...

Very nice.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 25, 2016

Do you still plan to do this in this PR?

  • Possibly remove handleTranslucent check for pnts, should be able to support transparent and opaque together.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 25, 2016

Should the arraybuffer/view memory concerns we discussed offline be addressed in this PR or another?

@@ -51,7 +51,7 @@ define([
'../ThirdParty/gltfDefaults',
'../ThirdParty/Uri',
'../ThirdParty/when',
'./getModelAccessor',
'./getBinaryAccessor',
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you cherry-pick this into master?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, thanks for reminding me.

@lilleyse
Copy link
Contributor Author

Do you still plan to do this in this PR?

Possibly remove handleTranslucent check for pnts, should be able to support transparent and opaque together.

I think I may pass on that for later. I'm a bit worried about the performance hit associated with doing all the pass/translucent checks per point. As of now supporting opaque and translucent together is only an issue for batched points, and maybe just setting the render state to translucent may be enough.

var hasStyleableProperties = defined(styleableProperties);

// Use per-point normals to hide back-facing points.
var backFaceCulling = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Check out hidden point removal in http://www.crs4.it/vic/cgi-bin/multimedia-page.cgi?id=160

Could be a nice reading group paper when we are ready to implement it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also add a TODO here for how to expose this, e.g., will the Cesium API have a point cloud specific style, is this a tileset property, etc.

@lilleyse
Copy link
Contributor Author

Should the arraybuffer/view memory concerns we discussed offline be addressed in this PR or another?

I'll handle it here.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 25, 2016

I think I may pass on that for later. I'm a bit worried about the performance hit associated with doing all the pass/translucent checks per point. As of now supporting opaque and translucent together is only an issue for batched points, and maybe just setting the render state to translucent may be enough.

Good plan.

for (var name in styleableProperties) {
if (styleableProperties.hasOwnProperty(name)) {
var property = styleableProperties[name];
// TODO : this will not handle matrix types currently
Copy link
Contributor

Choose a reason for hiding this comment

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

Not part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can probably get something working for this, but I'm not sure of the benefits. Would the styling language even support the concept of matrices?

Copy link
Contributor

Choose a reason for hiding this comment

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

It could...and it likely will at some point...but I would rather roadmap this since it is not in the most promient use cases, update CesiumGS/3d-tiles#2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to roadmap.

@@ -403,10 +562,21 @@ define([
vs += ' vec3 position = a_position; \n';
}

// TODO : only for testing
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep this for now, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to remove it. This was mainly for anyone reviewing the PR to see how it works.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, look at the shader generation in the Batch Table, but I think we want to prefix these more specifically than style_.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 25, 2016

Just those comments. Really liking the direction here.

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 25, 2016

The points batched example in Sandcastle comes up blank here: http://cesium-dev.s3-website-us-east-1.amazonaws.com/cesium/batch-table-binary/Apps/Sandcastle/index.html?src=3D%20Tiles.html&label=Showcases

Does it for you?

@lilleyse
Copy link
Contributor Author

Updated.

The points batched example in Sandcastle comes up blank here: http://cesium-dev.s3-website-us-east-1.amazonaws.com/cesium/batch-table-binary/Apps/Sandcastle/index.html?src=3D%20Tiles.html&label=Showcases

This works now.

The memory issues are also addressed. Model doesn't hold on to the array buffer: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Model.js#L3697.

@@ -238,6 +238,8 @@ define([
if (batchTableBinaryByteLength > 0) {
// Has a batch table binary
batchTableBinary = new Uint8Array(arrayBuffer, byteOffset, batchTableBinaryByteLength);
// Copy the batchTableBinary section and let the underlying ArrayBuffer be freed
batchTableBinary = new Uint8Array(batchTableBinary);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does any part of Model.js need to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 26, 2016

Part of #3241


// TODO : How to expose this? Will this be part of the point cloud styling or a property of the tileset?
// Use per-point normals to hide back-facing points.
var backFaceCulling = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

I changed this to false by default since many users will want go inside point clouds, e.g., like the church model.

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.

2 participants