{"action":"created","issue":{"url":"https://api.github.com/repos/highfidelity/hifi/issues/8560","repository_url":"https://api.github.com/repos/highfidelity/hifi","labels_url":"https://api.github.com/repos/highfidelity/hifi/issues/8560/labels{/name}","comments_url":"https://api.github.com/repos/highfidelity/hifi/issues/8560/comments","events_url":"https://api.github.com/repos/highfidelity/hifi/issues/8560/events","html_url":"https://github.com/highfidelity/hifi/pull/8560","id":174639872,"number":8560,"title":"Introducing Clustered Lighting and improve Lighting performances","user":{"login":"samcake","id":2230265,"avatar_url":"https://avatars.githubusercontent.com/u/2230265?v=3","gravatar_id":"","url":"https://api.github.com/users/samcake","html_url":"https://github.com/samcake","followers_url":"https://api.github.com/users/samcake/followers","following_url":"https://api.github.com/users/samcake/following{/other_user}","gists_url":"https://api.github.com/users/samcake/gists{/gist_id}","starred_url":"https://api.github.com/users/samcake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samcake/subscriptions","organizations_url":"https://api.github.com/users/samcake/orgs","repos_url":"https://api.github.com/users/samcake/repos","events_url":"https://api.github.com/users/samcake/events{/privacy}","received_events_url":"https://api.github.com/users/samcake/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/highfidelity/hifi/labels/QA%20Ready","name":"QA Ready","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-09-01T22:22:42Z","updated_at":"2016-10-04T20:43:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/highfidelity/hifi/pulls/8560","html_url":"https://github.com/highfidelity/hifi/pull/8560","diff_url":"https://github.com/highfidelity/hifi/pull/8560.diff","patch_url":"https://github.com/highfidelity/hifi/pull/8560.patch"},"body":"This PR is doing a large refactoring of the management of the lighting in the rendering engine to improve the performances and provide a new unified solution for a better lighting in general.\r\n\r\n Here are the changes:\r\n- RenderableLightEntityItem now rely on a new introduced LightPayload that separate the entity from the render item. LightPayload doesn't know about the entity. LightPayload is the default render item to add a light in the scene. The light entity manages its corresponding RenderItem through the scene update mechanism.\r\n\r\n- All the light RenderItems in the current scene are gathered in a single buffer in the Light Stage so they can be indexed into. Their values are updated only if needed from the payload.\r\n\r\n- A new technique called Cluster Lighting is introduced with this PR. during a frame pipeline, once the visible LightRenderItems have been fetched,  each light is assigned to clusters in a view dependent grid. The grid and the list of lights per cluster is stored in a gpu resource buffer which is then available for the rest of the frame to be indexed into. Once the opaque have been rendered, the lighting with locals lights is now fully depending on the the LightCLusters datastructure to get per fragment the cluster to which it belongs and subsequently, the list of lights potentially touching that fragment. THe fragment lighting then happens in a for loop with that list of lights. The light clusters is generated in a new  JOB working on the CPU which has a relatively modest cost in our tests (< 0.5ms per frame).\r\n\r\n\r\n- We introduced a new developer script to debug and understand the way the Light Clusters behave. it's lightClustering.js in the developer/utilities/render folder. THis allows to adjust the dimension of the grid (right now it s 16x16x16) and visualize it (Draw grid).\r\nYou can also represent the number of lights touching the surface with a color ramp by checking the draw content. REd means 12 lights are actually touching that pixel which is kind of our maximum budget right now for an acceptable fps in hmd.\r\n\r\n- With this new data structure in place, all the lights in the current frame are now available for rendering at any time (deferred or forward) for a given position in the frame. so we will be able to bring \"local lights\" to transparent and other similar features in the near future.\r\n\r\nFor excellent reference on the topic i would recommend the sigraph course from 2015 by Ola Olsonn and Emil Persson\r\nhttps://newq.net/publications/more/s2015-many-lights-course\r\nMore recently a doom frame breakdown provide a nice explanation too:\r\nhttp://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/highfidelity/hifi/issues/comments/251507328","html_url":"https://github.com/highfidelity/hifi/pull/8560#issuecomment-251507328","issue_url":"https://api.github.com/repos/highfidelity/hifi/issues/8560","id":251507328,"user":{"login":"hifi-gustavo","id":4554450,"avatar_url":"https://avatars.githubusercontent.com/u/4554450?v=3","gravatar_id":"","url":"https://api.github.com/users/hifi-gustavo","html_url":"https://github.com/hifi-gustavo","followers_url":"https://api.github.com/users/hifi-gustavo/followers","following_url":"https://api.github.com/users/hifi-gustavo/following{/other_user}","gists_url":"https://api.github.com/users/hifi-gustavo/gists{/gist_id}","starred_url":"https://api.github.com/users/hifi-gustavo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hifi-gustavo/subscriptions","organizations_url":"https://api.github.com/users/hifi-gustavo/orgs","repos_url":"https://api.github.com/users/hifi-gustavo/repos","events_url":"https://api.github.com/users/hifi-gustavo/events{/privacy}","received_events_url":"https://api.github.com/users/hifi-gustavo/received_events","type":"User","site_admin":false},"created_at":"2016-10-04T20:43:14Z","updated_at":"2016-10-04T20:43:14Z","body":"Build console output for commit: 1c2a6722149ea66b50543041fe1488e2670d5fb8 available at: https://gist.github.com/64d916b38ef4a180507530c19d6dc798<br/><br/>Installers available for download at: <br/>Windows: http://cachefly.highfidelity.com/HighFidelity-Beta-PR8560-1c2a672.exe<br/>OS X: http://cachefly.highfidelity.com/HighFidelity-Beta-PR8560-1c2a672.dmg"}}
{"actor":{"display_login":"hifi-gustavo"}}