{"action":"created","issue":{"url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/3798","repository_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2","labels_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/3798/labels{/name}","comments_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/3798/comments","events_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/3798/events","html_url":"https://github.com/OpenRCT2/OpenRCT2/pull/3798","id":158028884,"number":3798,"title":"Expanded rendering - light fx","user":{"login":"JeroenDStout","id":14242454,"avatar_url":"https://avatars.githubusercontent.com/u/14242454?v=3","gravatar_id":"","url":"https://api.github.com/users/JeroenDStout","html_url":"https://github.com/JeroenDStout","followers_url":"https://api.github.com/users/JeroenDStout/followers","following_url":"https://api.github.com/users/JeroenDStout/following{/other_user}","gists_url":"https://api.github.com/users/JeroenDStout/gists{/gist_id}","starred_url":"https://api.github.com/users/JeroenDStout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeroenDStout/subscriptions","organizations_url":"https://api.github.com/users/JeroenDStout/orgs","repos_url":"https://api.github.com/users/JeroenDStout/repos","events_url":"https://api.github.com/users/JeroenDStout/events{/privacy}","received_events_url":"https://api.github.com/users/JeroenDStout/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-06-01T23:23:34Z","updated_at":"2016-06-02T23:02:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/pulls/3798","html_url":"https://github.com/OpenRCT2/OpenRCT2/pull/3798","diff_url":"https://github.com/OpenRCT2/OpenRCT2/pull/3798.diff","patch_url":"https://github.com/OpenRCT2/OpenRCT2/pull/3798.patch"},"body":"*Very* early experiment for real-time light. _Not for immediate merging._\r\n\r\n![map](https://cloud.githubusercontent.com/assets/14242454/15727650/57061ae8-2858-11e6-90a8-0f14a3d83a2c.jpg)\r\n\r\n![train 3](https://cloud.githubusercontent.com/assets/14242454/15727666/695a1be0-2858-11e6-9033-e9439380a306.gif)\r\n\r\nIn this implementation, any bit of code can add a 3d positioned light via `lightfx_add_3d_light` (3d game space) or `lightfx_add_3d_light_magic_from_drawing_tile` (relative to drawing tile 3d space). This means many functions can be altered to inject a light. For now, entrances and some vehicles get a larger light, staff gets a smaller light.\r\n\r\nThe light is calculated into a second 8bpp screen-sized buffer, where each byte represents the intensity. A value of 0x10 is used for 'full bright', anything beyond that is over-exposed. This makes stacking lights possible.\r\n\r\nThe 8bpp->32bpp step (for hardware rendering) is moved to a separate thread. This means the lighting can be calculated while the game renders the next frame. Some minimal back-buffering has set up. For now the dirty drawing is disabled, but this can be re-enabled.\r\n\r\nTwo palettes are used. The regular palette (a modified day/night version) and a palette for the lights, which is a yellow-ish version of the regular palette and varies in brightness depending on night-ness. Some extra effects light fog are incorporated in this as well. The 8bpp->32bpp looks up on both of these palettes and combines them through addition.\r\n\r\nThe lights use 8bpp bitmaps, currently baked at initial start up. Each light type (by design) has 4 versions, each 2× the size of the previous, any of which can be inserted. Zooming out makes the light rendering take one version lower, or remove the light.\r\n\r\n![lit up 2](https://cloud.githubusercontent.com/assets/14242454/15728848/70f975e2-285f-11e6-888c-2bdda8955e38.jpg)\r\n\r\nFor now larger textures and screenshots have no light, this can be fixed.\r\n\r\nAll of this code, I need to emphasize, is _very_ experimental. A lot of things I wrote as a sketch to get to this working prototype so please cast a forgiving eye on some of the more disagreeable short-cuts I took.\r\n\r\nCulling behind landscape (occlusion and underground), as well as user-placed lights, are two features I would be interested in for the near future."},"comment":{"url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/comments/223447953","html_url":"https://github.com/OpenRCT2/OpenRCT2/pull/3798#issuecomment-223447953","issue_url":"https://api.github.com/repos/OpenRCT2/OpenRCT2/issues/3798","id":223447953,"user":{"login":"IntelOrca","id":1482259,"avatar_url":"https://avatars.githubusercontent.com/u/1482259?v=3","gravatar_id":"","url":"https://api.github.com/users/IntelOrca","html_url":"https://github.com/IntelOrca","followers_url":"https://api.github.com/users/IntelOrca/followers","following_url":"https://api.github.com/users/IntelOrca/following{/other_user}","gists_url":"https://api.github.com/users/IntelOrca/gists{/gist_id}","starred_url":"https://api.github.com/users/IntelOrca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IntelOrca/subscriptions","organizations_url":"https://api.github.com/users/IntelOrca/orgs","repos_url":"https://api.github.com/users/IntelOrca/repos","events_url":"https://api.github.com/users/IntelOrca/events{/privacy}","received_events_url":"https://api.github.com/users/IntelOrca/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T23:02:13Z","updated_at":"2016-06-02T23:02:13Z","body":"Lights need to be drawn after viewports, under windows etc. it can't all be done at the end."}}
{"actor":{"display_login":"IntelOrca"}}