{"action":"created","issue":{"url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/6393","repository_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium","labels_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/6393/labels{/name}","comments_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/6393/comments","events_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/6393/events","html_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/6393","id":309954527,"number":6393,"title":"Materials on Ground Primitives","user":{"login":"likangning93","id":5395255,"avatar_url":"https://avatars3.githubusercontent.com/u/5395255?v=4","gravatar_id":"","url":"https://api.github.com/users/likangning93","html_url":"https://github.com/likangning93","followers_url":"https://api.github.com/users/likangning93/followers","following_url":"https://api.github.com/users/likangning93/following{/other_user}","gists_url":"https://api.github.com/users/likangning93/gists{/gist_id}","starred_url":"https://api.github.com/users/likangning93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/likangning93/subscriptions","organizations_url":"https://api.github.com/users/likangning93/orgs","repos_url":"https://api.github.com/users/likangning93/repos","events_url":"https://api.github.com/users/likangning93/events{/privacy}","received_events_url":"https://api.github.com/users/likangning93/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":28,"created_at":"2018-03-30T01:58:52Z","updated_at":"2018-05-03T18:31:48Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/pulls/6393","html_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/6393","diff_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/6393.diff","patch_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/6393.patch"},"body":"Fixes #5025\r\n\r\nOpening a PR for some early review, and also to say this is \"stable\" if anyone wants to play with it.\r\nTODO before full review:\r\n* [x] texcoord rotations\r\n* [x] Support for 2D/CV\r\n* [x] better picking?\r\n* [x] fix log depth incompatibility?\r\n* [x] cleanup/doc\r\n* [x] tests\r\n* [x] fix planar texture coordinates ([see below](https://github.com/AnalyticalGraphicsInc/cesium/pull/6393#issuecomment-384699993))\r\n* [ ] IE fallback\r\n* [ ] update CHANGE.md, Sandcastle?\r\n\r\nThis PR adds support for materials on ground primitives and also adds batching for non-overlapping, \"similarly sized\" ground entities with the same material. Quick rundown of how things work:\r\n\r\n### Materials on Ground Primitives\r\nNormals and texture coordinates and the like are computed in the fragment shader, almost like a post-process. Normals are easy - sample the depth texture (which has to be enabled for this to work), do some eye space math, lovely.\r\nTexture coordinates are done in either of two ways:\r\n* for entities large enough that the curve of the Earth is noticeable, a world position is computed from the depth texture and is then used to approximate the latitude/longitude at the fragment using spherical coordinates and approximate inverse trigonometry. This spherical coordinate is then compared with a spherical extent per-instance attribute to compute [0-1] range texcoords.\r\n* for small entities, we compute the distance from the fragment in eye space to a pair of planes, also in eye space, which are computed in the vertex shader from a double-precision position and a pair of offset vectors that form a bounding box in the local ENU coordinate system centered around the entity.\r\n\r\n### Batching\r\nWe couldn't batch ground entities before because of overdraw problems - the shadow volumes used to color terrain often extend well beyond the area they're supposed to cover in screen space and sometimes overlap in the camera plane, leading to artifacts.\r\n\r\nThis PR adds the ability to use texture coordinates to clip fragments outside a lat/long volume (rectangle) in space, preventing overdraw as long as the batched primitives' rectangles on the globe don't overlap.\r\n\r\nGround entities with per-instance color are no longer batched by color but based on overlap, so it's now possible to render ~10,000 uniquely colored non-overlapping ground entities in a scene on a mid-range mobile GPU like the GT 750M without crashing. More performance anecdotes to follow.\r\n\r\nWe may also want to discuss if batching everything that's batchable is a little naive, since in some cases we can actually suffer from loss of culling benefits (I think...). "},"comment":{"url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/comments/386393578","html_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/6393#issuecomment-386393578","issue_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/6393","id":386393578,"user":{"login":"mramato","id":1495196,"avatar_url":"https://avatars2.githubusercontent.com/u/1495196?v=4","gravatar_id":"","url":"https://api.github.com/users/mramato","html_url":"https://github.com/mramato","followers_url":"https://api.github.com/users/mramato/followers","following_url":"https://api.github.com/users/mramato/following{/other_user}","gists_url":"https://api.github.com/users/mramato/gists{/gist_id}","starred_url":"https://api.github.com/users/mramato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mramato/subscriptions","organizations_url":"https://api.github.com/users/mramato/orgs","repos_url":"https://api.github.com/users/mramato/repos","events_url":"https://api.github.com/users/mramato/events{/privacy}","received_events_url":"https://api.github.com/users/mramato/received_events","type":"User","site_admin":false},"created_at":"2018-05-03T18:31:48Z","updated_at":"2018-05-03T18:31:48Z","author_association":"MEMBER","body":"> [EDIT] actually, I'll just have it fall back to earlier behavior where non-color appearances just show up as regular primitives instead of GroundPrimitives.\r\n\r\nProbably the best (and easiest) choice."}}
{"actor":{"display_login":"mramato"}}