{"id":207,"date":"2013-03-20T02:08:27","date_gmt":"2013-03-20T09:08:27","guid":{"rendered":"http:\/\/www.teamfizzgames.com\/Matt\/?p=207"},"modified":"2013-03-20T03:11:21","modified_gmt":"2013-03-20T10:11:21","slug":"goodgraphics23-png-more-lighting-more-transparency-and-performance","status":"publish","type":"post","link":"https:\/\/www.teamfizzgames.com\/Matt\/goodgraphics23-png-more-lighting-more-transparency-and-performance\/","title":{"rendered":"GoodGraphics23.png, More Lighting, More Transparency, And Performance"},"content":{"rendered":"<p>So, a lot of backend updates have been happening in the last month, but the visual part of this update actually happened the day after the last GoodGraphics post. \u00a0But school&#8217;s been busy (what&#8217;s new?). \u00a0And then I got Premake and FXC working and wanted to post about that. \u00a0And then school&#8217;s been busy&#8230; \u00a0it isn&#8217;t like it&#8217;s a pattern or anything.<\/p>\n<p>The visual part is that after talking with designers and artists, the simplest solution to dealing with transparency in the new lighting system was to just not illuminate transparent objects at all. \u00a0While it would be nice to have light partially &#8220;hit&#8221; and partially go through transparent objects, it just isn&#8217;t feasible for me to do it in a way that both looks good and keeps reasonable performance at this point in the year. \u00a0So, instead I just exclude transparent objects from the depth buffer used by the light accumulator. \u00a0The loss of not illuminating transparent objects is pretty minor compared to the gain of seeing light sources through them.<\/p>\n<p>&nbsp;<\/p>\n<div style=\"width: 631px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.anguishgames.com\/download\/images\/GoodGraphics23.png\"><img loading=\"lazy\" decoding=\"async\" class=\" \" alt=\"\" src=\"http:\/\/www.anguishgames.com\/download\/images\/GoodGraphics23.png\" width=\"621\" height=\"481\" \/><\/a><p class=\"wp-caption-text\">GoodGraphics23.png, lighting through transparent objects.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>One of the major backend changes I&#8217;ve made is to start using instanced drawing. \u00a0I had originally, and incorrectly, assumed that I could write a very optimized material system to generate the fewest number of state changes and data transfers, and couple that with the reduced overhead of draw calls since DirectX 9, and be alright. \u00a0Turns out that while draw call overhead has been reduced, it is still pretty major, and making a separate draw call for every object takes a toll. \u00a0As a result, I&#8217;ve switched my lighting over to using DrawIndexedInstanced and it has made a huge difference. \u00a0A lot of our levels are now able to handle the entire light accumulation pass in a single draw call, and frame times have cut in half. \u00a0So, I&#8217;m pretty stoked about that.<\/p>\n<p>Beyond that, I&#8217;ve been working to move as much calculation from pixel shaders to vertex shaders to cut down overall instruction counts without sacrificing visual fidelity, and it&#8217;s been pretty successful. \u00a0The only major outstanding calculation left in a pixel shader that I think I can move is the inverse view projection matrix\u00a0multiplication\u00a0in the light accumulation shader that uses depth to recreate pixel position in world space. \u00a0And I think the information in <a title=\"Thread on light pre-pass\" href=\"http:\/\/www.gamedev.net\/topic\/506573-reconstructing-position-from-depth-data\/\" target=\"_blank\">this thread<\/a> has everything I need to solve that. \u00a0Here&#8217;s hoping!<\/p>\n<p>So, that&#8217;s it. \u00a0I&#8217;ve nearly got our particle system working (finally), so hopefully there&#8217;ll be a new post up soon about that. \u00a0And if all goes well, it should be a two for one with texture animation as well (which I wrote last year, but still haven&#8217;t gotten around to integrating into this engine yet). \u00a0I&#8217;d really like to get it implemented and post about it before heading off to GDC next week, but you know, school. \u00a0We&#8217;ll see what happens.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, a lot of backend updates have been happening in the last month, but the visual part of this update actually happened the day after the last GoodGraphics post. \u00a0But school&#8217;s been busy (what&#8217;s new?). \u00a0And then I got Premake and FXC working and wanted to post about that. \u00a0And \u2026 <a class=\"continue-reading-link\" href=\"https:\/\/www.teamfizzgames.com\/Matt\/goodgraphics23-png-more-lighting-more-transparency-and-performance\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[2],"tags":[11,12],"class_list":["post-207","post","type-post","status-publish","format-standard","hentry","category-graphicsdev","tag-light-pre-pass","tag-transparency"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p39ImV-3l","_links":{"self":[{"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/comments?post=207"}],"version-history":[{"count":6,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":224,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts\/207\/revisions\/224"}],"wp:attachment":[{"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/media?parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/categories?post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/tags?post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}