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

Fix for stray point in center of screen #5599

Merged
merged 2 commits into from
Sep 27, 2017
Merged

Conversation

sir-chaos
Copy link
Contributor

@sir-chaos sir-chaos commented Jul 7, 2017

A stray point appeared in the center of screen instead of discarding under some systems when there were points with show = false style.
This should fix the issue.
See #5598

A stray point appeared in the center of screen instead of discarding under some systems when there were points with show = false style.
This should fix the issue.
@lilleyse
Copy link
Contributor

lilleyse commented Jul 7, 2017

Hm unfortunately I don't think this fix works on my end. It seems like my hardware does not allow point sizes smaller than 1.

var viewer = new Cesium.Viewer('cesiumContainer');

var scene = viewer.scene;
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
    url : '../../../Specs/Data/Cesium3DTiles/PointCloud/PointCloudWithPerPointProperties/'
}));

tileset.readyPromise.then(function() {
    var boundingSphere = tileset.boundingSphere;
    viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -1.0, 50.0));
    viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
}).otherwise(function(error) {
    throw(error);
});

tileset.style = new Cesium.Cesium3DTileStyle({
    pointSize : 5,
    show : '${POSITION}[0] > 0.0'
});

point_size

@lilleyse
Copy link
Contributor

lilleyse commented Jul 7, 2017

Just for testing, does substituting with code like:

vs += ' gl_Position.x += (1.0 - show) * 5.0; \n';

work for you?

Edit: actually this code is not super reliable as it fails depending on the current projection matrix.

@sir-chaos
Copy link
Contributor Author

Unfortunately I don't have access to workstation where the bug showed up at the moment (on my current system all works fine). If the suggesteed fix fails in your situation, maybe nullification for both gl_Position and gl_PointSize would help?

@lilleyse
Copy link
Contributor

Yeah that approach sounds good.

@lilleyse
Copy link
Contributor

I made the change here. Does that work on your end too?

Also please add yourself to CONTRIBUTORS.md.

@rjeli
Copy link

rjeli commented Jul 28, 2017

Thank you, this fixed it for me as well, had the point at center of screen and could not zoom. Now works perfectly. Chrome on Ubuntu with Nvidia card.

@mramato
Copy link
Contributor

mramato commented Sep 27, 2017

@lilleyse what's the status of this PR?

@lilleyse
Copy link
Contributor

Should be ready to merge.

@mramato mramato merged commit 0115e26 into CesiumGS:master Sep 27, 2017
@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 28, 2017

@lilleyse please update CHANGES.md in master if you haven't already.

@sir-chaos can you please add yourself to CONTRIBUTORS.md and send in a Contributor License Agreement since this PR includes one of your commits?

lilleyse added a commit that referenced this pull request Sep 28, 2017
@lilleyse
Copy link
Contributor

Updated CHANGES.md here: 2d6a5cf

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.

5 participants