{"action":"created","issue":{"url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/5047","repository_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge","labels_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/5047/labels{/name}","comments_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/5047/comments","events_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/5047/events","html_url":"https://github.com/MinecraftForge/MinecraftForge/pull/5047","id":342189910,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyMTQ3NzU3","number":5047,"title":"Allow item model rendering to detect emissive quads and render them properly","user":{"login":"tterrag1098","id":3751664,"node_id":"MDQ6VXNlcjM3NTE2NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3751664?v=4","gravatar_id":"","url":"https://api.github.com/users/tterrag1098","html_url":"https://github.com/tterrag1098","followers_url":"https://api.github.com/users/tterrag1098/followers","following_url":"https://api.github.com/users/tterrag1098/following{/other_user}","gists_url":"https://api.github.com/users/tterrag1098/gists{/gist_id}","starred_url":"https://api.github.com/users/tterrag1098/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tterrag1098/subscriptions","organizations_url":"https://api.github.com/users/tterrag1098/orgs","repos_url":"https://api.github.com/users/tterrag1098/repos","events_url":"https://api.github.com/users/tterrag1098/events{/privacy}","received_events_url":"https://api.github.com/users/tterrag1098/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-18T06:12:11Z","updated_at":"2018-07-18T21:14:44Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/pulls/5047","html_url":"https://github.com/MinecraftForge/MinecraftForge/pull/5047","diff_url":"https://github.com/MinecraftForge/MinecraftForge/pull/5047.diff","patch_url":"https://github.com/MinecraftForge/MinecraftForge/pull/5047.patch"},"body":"## Purpose\r\nThis PR aims to add support for \"emissive\" rendering on items, a feature which is currently only available on blocks. It does this by hooking into `RenderItem` and adding detection for the same lighting data that `VertexLighterFlat` uses to provide this feature. That is to say, it looks at the `TEX_2S` element (lightmap) and uses values which are higher than the current world lighting.\r\n\r\n## Implementation Notes\r\nIf the implementation seems \"complicated\" or \"ugly\" please bear in mind that is necessary to maintain the overall order of quads from a model. This means I cannot batch quads in a way that changes the order, i.e. by light values. I must render the quads as they come, but the algorithm is careful to use as few draw calls as possible. \r\n\r\nThe common case (a model with no quads with a vertex format that isn't `ITEM`) is optimized as much as possible, all expensive operations are skipped and the quad list is drawn as a single \"segment\" and GL operations are minimized.\r\n\r\nTo test the changes I installed a custom build of [CTM](https://github.com/Chisel-Team/ConnectedTexturesMod) (the current release has code to prevent light data being added to item models) and enabled the [CTP resource pack](https://github.com/Chisel-Team/ConnectedTexturesPack). CTP makes use of the CTM systems to add emissive rendering to a few blocks, the Redstone Block is the most obvious of those.\r\n\r\n#### Before\r\n![Rendering Before](https://user-images.githubusercontent.com/3751664/42862196-7d5f6a22-8a2c-11e8-998a-ed8d04c14ff2.png)\r\n\r\n#### After\r\n![Rendering After](https://user-images.githubusercontent.com/3751664/42862197-7d6a8ef2-8a2c-11e8-832e-8f1d5b630ab6.png)\r\n\r\nThis implementation has gone through quite a few stages as seen in the commit history, and I want to thank @sfPlayer1 in particular for leading me towards the current one.\r\n\r\n## Performance Tests\r\nI understand that this is a hotspot for rendering, so I've run a few tests on the impact in the worst case, with JEI drawing every single item in vanilla at once. The results show an impact (impossible to avoid) but it is minimized. However if you see a spot that could be better, let me know in a review.\r\n\r\nAll tests were performed in a void, during the day, with no clouds, minimum render distance, unlimited FPS, no particles, and no VSync\r\n\r\n### JEI rendering all items - FPS\r\n\r\n#### Before (hovers near 200)\r\n![FPS Before](https://user-images.githubusercontent.com/3751664/42862549-0242e9d4-8a2e-11e8-9418-ec721ea7d3a4.png)\r\n\r\n#### After (hovers near 180)\r\n![FPS After](https://user-images.githubusercontent.com/3751664/42862574-170293ec-8a2e-11e8-83f7-4a11d5573136.png)\r\n\r\n### JEI rendering all items - VisualVM\r\nSample was run on a 20ms interval for approximately 10 seconds.\r\n\r\n#### Before\r\n![Sample Snapshot Before](https://user-images.githubusercontent.com/3751664/42862773-f2d9a68a-8a2e-11e8-8f59-d991afff6a06.png)\r\n[Snapshot Data (.nps)](https://transfer.sh/LaZ22/emissive_test_before.nps)\r\n\r\n#### After\r\n![Sample Snapshot After](https://user-images.githubusercontent.com/3751664/42862957-780baf6a-8a2f-11e8-8c40-fce95bce1740.png)\r\n[Snapshot Data (.nps)](https://transfer.sh/Bvj9k/emissive_test_after.nps) "},"comment":{"url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/comments/406076631","html_url":"https://github.com/MinecraftForge/MinecraftForge/pull/5047#issuecomment-406076631","issue_url":"https://api.github.com/repos/MinecraftForge/MinecraftForge/issues/5047","id":406076631,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjA3NjYzMQ==","user":{"login":"tterrag1098","id":3751664,"node_id":"MDQ6VXNlcjM3NTE2NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3751664?v=4","gravatar_id":"","url":"https://api.github.com/users/tterrag1098","html_url":"https://github.com/tterrag1098","followers_url":"https://api.github.com/users/tterrag1098/followers","following_url":"https://api.github.com/users/tterrag1098/following{/other_user}","gists_url":"https://api.github.com/users/tterrag1098/gists{/gist_id}","starred_url":"https://api.github.com/users/tterrag1098/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tterrag1098/subscriptions","organizations_url":"https://api.github.com/users/tterrag1098/orgs","repos_url":"https://api.github.com/users/tterrag1098/repos","events_url":"https://api.github.com/users/tterrag1098/events{/privacy}","received_events_url":"https://api.github.com/users/tterrag1098/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T21:14:44Z","updated_at":"2018-07-18T21:14:44Z","author_association":"MEMBER","body":"Thanks for the suggestions @bs2609, I noticed a marked improvement of FPS to consistently over 180. Nothing huge but I also think the code is cleaner laid out this way."}}
{"actor":{"display_login":"tterrag1098"}}