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

Hidden entity remains visible on Linux #8043

Closed
mathiasfn opened this issue Aug 6, 2019 · 4 comments
Closed

Hidden entity remains visible on Linux #8043

mathiasfn opened this issue Aug 6, 2019 · 4 comments

Comments

@mathiasfn
Copy link

  1. A concise explanation of the problem you're experiencing.
    If i create an entity with point graphics and change its "show" property to false it doesn't hide, instead, it positions itself in the center of the screen while still being visible.
    this issue only occurs when I'm in a Ubuntu environment

  2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
    I've created an example to demonstrate my issue:
    https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=fVN/a9swEP0qWvZHHHCUpGtguGlYSTMa2m2wZoNBYMi24ojKkpHObrKS776THCdOO2aw0btf792dXDFDKsGfuSHXRPFnMuNWlDn96W1BN/FwphUwobjphuRl37taqQrzCm0FCK0w85A1YwbwxNQHujY6v+WZ4dwGoxEdh2Q89t9hk84VCNhhcs1PPRbcUpamwctKEXwaiuh4ChuHUBCRQ5i3iC2Xj+IPj8hoGJ7siZbaREeFDtHv89s6YL9Svh1UVIuwCSpWjwVL+LxCRXdMpdLZOSxUUcJN4kQE61LVh14joe6G2o1+xpbetSCW34cN/+Or+stdwenD/PPy9+xhMbs/05KwnBtGpdZPNxAcB9Be02ngwTDEvutPz4/4H0WWhim71iYPDvlfGBixvaSL2/nX5WL5q3fVCTsTCzvJp3Vfn0ReaAOkNDKgdAA8LyRDzkFcJk8caGKtY3Oh70FrGeNmW1uJWfKUGV2qNCImi1lweRGS5h3Sj02u3yAuXqgsIpfFtmWOtUm56RuWitK2nftXtMItqE1ecQMiYbLPpMjwDuUixWW+ZeyDLiJyccbauGINoPO2F2kng2ZEk1RURKTXq86rP2XVIYlk1qJnXUp/MVed6WSA8WdpUjPH8w21SrZzIZvR9KE2UkonA4Rvsw4tY3ityXmmd1xkG2iCvbkeCeAlwyRcfoYicAwKUR8vCh06yLYIG2SBFw7iMWXA+rFQjrBissQ/a+MpQuLhjwIj0Nj1LN2TmDNW4FtwdXEAiMb/q+srNPr/Ag

  3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
    I need to be able to toggle entities visibility rather than destroying and recreating

  4. The Cesium version you're using, your operating system and browser.
    Cesium version: 1.60
    Operating system: Ubuntu 18.04.2 LTS
    Browser: Google Chrome Version 76.0.3809.87 (Official Build) (64-bit)

@OmarShehata OmarShehata changed the title Can't hide point entities Hidden entity remains visible on Linux Aug 8, 2019
@OmarShehata
Copy link
Contributor

Thanks for the Sandcastle example @mathiasfn . I'm dual booting Windows 10 and Kubuntu, and I can confirm that this only happens on the Linux side.

I suspect the problem is different driver implementations, so it's something we're doing in our shaders. The logic to hide points happens in the shader. You can see where this gets initially packed as a shader attribute in PointPrimitiveCollection, and here's where it's used in the shader:

https://github.com/AnalyticalGraphicsInc/cesium/blob/54acd32f50c332605615a7b37b774c04690ef55c/Source/Shaders/PointPrimitiveCollectionVS.glsl#L94

What's quite peculiar to me here is that this shader is "hiding" points by multiplying the xyz by 0, which may explain why it gets centered at the origin instead of actually disappearing (but then why does this work fine on Windows?)

We can fix this if we multiply the color by the show value instead, so at the bottom of that shader it would be:

v_color = color;
v_color.a *= translucency * show;
v_outlineColor = outlineColor;
v_outlineColor.a *= translucency * show;

@mramato
Copy link
Contributor

mramato commented Aug 8, 2019

Duplicate of #7557?

Only happens for me under Nvidia on linux (my intel card can't reproduce it) @OmarShehata sounds like a good PR to open to get this fixed.

@OmarShehata
Copy link
Contributor

Sean mentioned that the technique of hiding a point by multiplying xyz by 0 is actually intentional here. The idea is to move it out of the clip space, so it's not generating fragments at all, effectively discarding it, as opposed to just making it transparent.

Point clouds are hidden in a similar way:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/PointCloud.js#L1177-L1178

I can open a PR for this soon.

@OmarShehata
Copy link
Contributor

This was fixed in #8054.

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

No branches or pull requests

3 participants