{"id":297,"date":"2013-10-21T23:12:34","date_gmt":"2013-10-22T06:12:34","guid":{"rendered":"http:\/\/www.teamfizzgames.com\/Matt\/?p=297"},"modified":"2013-10-21T23:12:34","modified_gmt":"2013-10-22T06:12:34","slug":"back-to-square-one","status":"publish","type":"post","link":"https:\/\/www.teamfizzgames.com\/Matt\/back-to-square-one\/","title":{"rendered":"Back to Square One?"},"content":{"rendered":"<p>So, in my last post, I said that my big goal was to thread my renderer and to do a better job of writing it against a public interface so that it could be a stand-alone library. \u00a0Good goals, but now that they&#8217;re basically finished I have a lot of new goals. \u00a0However, since that post was made a week+ after the work it described, and it&#8217;s now been a month since that post, I think my primary goal is to get better at writing these more regularly. \u00a0It might mean that the technology changes in each update is less dramatic, but I think it&#8217;ll let me spend more time to properly illustrate what I&#8217;m working on at the time and lead to overall better posts. \u00a0We&#8217;ll see how that turns out.<\/p>\n<p>So, previously I had reworked my rendering pipeline to be multi-threaded, and managed to draw a triangle. \u00a0Which is great and terrible at the same time. \u00a0But, since the rewrite was still 85% built on my framework from last year, once the core worked in the new thread-safe system it was much less work to re-implement everything else I had last year. \u00a0I was quickly able to bring in refactored versions of my previous material and lighting processes and get to a point where I could render a lit scene that was as complex as I cared to hard code (since the editor wasn&#8217;t quite ready to go yet). \u00a0As you can tell from the image, I did&#8217;t care to hard code very much.<\/p>\n<div style=\"width: 673px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.anguishgames.com\/download\/images\/GoodGraphics27.png\"><img loading=\"lazy\" decoding=\"async\" class=\"  \" alt=\"\" src=\"http:\/\/www.anguishgames.com\/download\/images\/GoodGraphics27.png\" width=\"663\" height=\"387\" \/><\/a><p class=\"wp-caption-text\">GoodGraphics27.png, toxic tables!<\/p><\/div>\n<p>So, that&#8217;s what you can see; let&#8217;s talk about what you can&#8217;t see. \u00a0Last year, I built my render target class to own a back buffer and a depth buffer, and created a system to copy a depth buffer from one render target into another. \u00a0I was told it was strange to not share a single depth buffer across my render targets, but there were cases where I wanted the main geometry buffer for a process and I wanted to change it for current use without changing it for geometry. \u00a0There were also cases where I down and up scaled render targets, which necessitated different depth buffers with different sizes; it&#8217;s how I achieved my geometry occluded outlines last year. \u00a0It worked for me, but it didn&#8217;t come without it&#8217;s difficulties. \u00a0And as I was re-implementing render targets this year, I realized that I overlooked a lot of potential performance gains last year.<\/p>\n<p>I was re-using depth information for geometry occluded outlines, and I was using it to generate lighting information, but I wasn&#8217;t actually using it to cut down on overdraw. \u00a0And overdraw was a huge problem in Evac (especially the final level, which was huge). \u00a0So, I re-factored my render target system to instead keep a pool of back and depth buffers, and a render target now makes associations to the buffers in the pool that it wants. \u00a0This allows easy sharing of buffers between targets (and without DirectX complaining about binding a buffer for read and write simultaneously!) in a way that let me do a Z Pre-pass process that is intended to build the shared depth buffer but remain lightweight by only ever engaging the vertex shader. \u00a0Once that depth buffer is built, all processes that utilize it can set their depthstencil state to D3D11_COMPARISON_EQUAL to ensure that each screen pixel is engaged by a pixel shader only once. \u00a0And since the pixel shader is often where you can find pipeline bottlenecks, optimizing it&#8217;s usage can be key to keeping a high performing renderer. \u00a0So, ensuring that each process pass at most engages a pixel shader once per pixel is a huge boon and I was very pleased with the results.<\/p>\n<p>The other thing you can tell from the image is that I&#8217;ve started work on my post-processing system. \u00a0It&#8217;s not going to be terribly different from last year&#8217;s base system, but I&#8217;m looking to implement a new set of effects to give the game a filmic look. \u00a0It starts with the depth of field effect you can see here, but there&#8217;s a lot more in the works to eventually make the game look good. \u00a0I hope. \u00a0Also, with the re-organization and re-optimization of the whole system, I&#8217;m hoping to have the frame time available to do a LOT more post-processing this year.<\/p>\n<p>So, that&#8217;s all for this time. \u00a0There were actually a lot of errors going on behind the scenes around this time that looked correct enough to not notice them right away, but which created huge problems when I tried to tweak data. \u00a0I&#8217;ll probably talk about them next time as I think that they&#8217;re pretty interesting, and might be useful to anyone implementing a similar system. \u00a0Also, I&#8217;ll be talking about my initial work on terrain, so look forward to that. \u00a0Hopefully it won&#8217;t take a month.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, in my last post, I said that my big goal was to thread my renderer and to do a better job of writing it against a public interface so that it could be a stand-alone library. \u00a0Good goals, but now that they&#8217;re basically finished I have a lot of \u2026 <a class=\"continue-reading-link\" href=\"https:\/\/www.teamfizzgames.com\/Matt\/back-to-square-one\/\"> 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":[],"class_list":["post-297","post","type-post","status-publish","format-standard","hentry","category-graphicsdev"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p39ImV-4N","_links":{"self":[{"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts\/297","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=297"}],"version-history":[{"count":1,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":299,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts\/297\/revisions\/299"}],"wp:attachment":[{"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}