{"action":"created","issue":{"url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/5919","repository_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium","labels_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/5919/labels{/name}","comments_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/5919/comments","events_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/5919/events","html_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/5919","id":267272913,"number":5919,"title":"Add Material Support to Globe","user":{"login":"jasonbeverage","id":326626,"avatar_url":"https://avatars0.githubusercontent.com/u/326626?v=4","gravatar_id":"","url":"https://api.github.com/users/jasonbeverage","html_url":"https://github.com/jasonbeverage","followers_url":"https://api.github.com/users/jasonbeverage/followers","following_url":"https://api.github.com/users/jasonbeverage/following{/other_user}","gists_url":"https://api.github.com/users/jasonbeverage/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonbeverage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonbeverage/subscriptions","organizations_url":"https://api.github.com/users/jasonbeverage/orgs","repos_url":"https://api.github.com/users/jasonbeverage/repos","events_url":"https://api.github.com/users/jasonbeverage/events{/privacy}","received_events_url":"https://api.github.com/users/jasonbeverage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-10-20T19:01:51Z","updated_at":"2017-11-03T20:39:38Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/pulls/5919","html_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/5919","diff_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/5919.diff","patch_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/5919.patch"},"body":"Hi all!\r\n\r\nThis PR adds Material support to the Globe, as well as adding new height and slope values to the czm_materialInput struct so that it can be used as input when generating the materials.\r\n\r\nI've added a new sandcastle example that you can play with [here](https://cesiumglobematerial.netlify.com/apps/sandcastle/?src=Globe%20Materials.html&label=Showcases)\r\n\r\nThe main goal of this effort was to visualize changes in slope on the terrain, but I tried to make it more generic by utilizing the existing Material support so we could do some more interesting effects in the future.  I've added some new materials that you can see in use in the sandcastle example\r\n* ElevationContour - Displays elevation contour lines on the terrain with the spacing controled via a uniform.  You can drag the slider in the sandcastle example to change the spacing.\r\n* ElevationRamp - Colors the terrain by applying a color ramp to the elevation.  The elevation is scaled between minHeight and maxHeight uniforms and then does a texture lookup into the ramp to get the color.  This ended up being really cool because you can generate nice color ramps programatically using a canvas and the createLinearGradient function.\r\n* SlopeRamp - Colors the terrain by applying a color ramp to the slope.\r\n\r\nSome notes on the implementation:\r\n*  I tried to keep the changes as minimal as possible and just re-use the great work already done in the existing Material framework.\r\n*  The Globe now has a new material property which you can set to any Material you like.\r\n*  Globe has a new dirtyShaders function that is called when you change the material so the correct material shader is injected in the globe shader.\r\n*  If there is no material there shouldn't be a performance penalty b/c it's wrapped in a APPLY_MATERIAL define which is only set if there is material present.\r\n*  GlobeSurfaceShader has a new material property so it can detect when the material has changed and a new shader needs to be generated.\r\n*  GlobeSurfaceTileProvider has a new uniformMap property that is set to the materials uniforms so they are incorporated in the tile draw calls.\r\n*  Currently the material only effects the diffuse color of the terrain.  The original imagery color is blended with the materials color based on the materials alpha.  This allows you to return an alpha value less than 1 to get the original imagery color to blend though.  For example, try changing one of the color stops in the color ramp to \"transparent\" or \"rgba(255,0,0,0.5)\" and see the imagery come through.\r\n\r\nThanks!\r\n\r\nJason\r\n\r\n![heightramp](https://user-images.githubusercontent.com/326626/31837021-3f86f92e-b5a5-11e7-8751-1658617789f2.jpg)\r\n\r\n![contourmap](https://user-images.githubusercontent.com/326626/31836941-07569d34-b5a5-11e7-987f-9b65cf1673d6.jpg)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/comments/341821034","html_url":"https://github.com/AnalyticalGraphicsInc/cesium/pull/5919#issuecomment-341821034","issue_url":"https://api.github.com/repos/AnalyticalGraphicsInc/cesium/issues/5919","id":341821034,"user":{"login":"lilleyse","id":915398,"avatar_url":"https://avatars2.githubusercontent.com/u/915398?v=4","gravatar_id":"","url":"https://api.github.com/users/lilleyse","html_url":"https://github.com/lilleyse","followers_url":"https://api.github.com/users/lilleyse/followers","following_url":"https://api.github.com/users/lilleyse/following{/other_user}","gists_url":"https://api.github.com/users/lilleyse/gists{/gist_id}","starred_url":"https://api.github.com/users/lilleyse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lilleyse/subscriptions","organizations_url":"https://api.github.com/users/lilleyse/orgs","repos_url":"https://api.github.com/users/lilleyse/repos","events_url":"https://api.github.com/users/lilleyse/events{/privacy}","received_events_url":"https://api.github.com/users/lilleyse/received_events","type":"User","site_admin":false},"created_at":"2017-11-03T20:39:38Z","updated_at":"2017-11-03T20:39:38Z","author_association":"CONTRIBUTOR","body":"Remaining TODO:\r\n\r\n* [ ] Tests\r\n* [ ] Improve contour lines: https://github.com/AnalyticalGraphicsInc/cesium/pull/5919/#issuecomment-341295918"}}
{"actor":{"display_login":"lilleyse"}}