{"id":313,"date":"2014-02-25T16:54:00","date_gmt":"2014-02-26T00:54:00","guid":{"rendered":"http:\/\/www.teamfizzgames.com\/Matt\/?p=313"},"modified":"2014-05-25T20:20:29","modified_gmt":"2014-05-26T03:20:29","slug":"the-shift-to-ggx-and-a-glimpse-of-things-to-come","status":"publish","type":"post","link":"https:\/\/www.teamfizzgames.com\/Matt\/the-shift-to-ggx-and-a-glimpse-of-things-to-come\/","title":{"rendered":"The Shift To GGX And A Glimpse Of Things To Come"},"content":{"rendered":"<p>I&#8217;m just going to jump into things and not really explain why there&#8217;s been a 4 month gap since the last post. \u00a0It should be pretty sufficient to just say&#8230; school. \u00a0However, I now have a lot of stuff to post about, so I&#8217;m hoping that means a lot of posts in quick succession. \u00a0And I think a lot of them are going to be a lot more directly technical in nature, complete with code samples. \u00a0We&#8217;ll see how that actually shakes out.<\/p>\n<p>So, as mentioned in my last post, one of the things I wanted to do this year is move towards a more physically based system for rendering. \u00a0Now, I might have pipe dreams of implementing global illumination and a full microfacet model and really doing this thing right, but let&#8217;s be realistic. \u00a0I only get so much time around the rest of my classes and staying sane, and it can&#8217;t all be spent on my lighting pipeline. \u00a0I have to deliver features and tools so my team can make the game we&#8217;re making, and when it comes down to it our game could ship just fine on last year&#8217;s lighting model if it had to. \u00a0Luckily, short of implementing CryEngine there were a number of much smaller things I could accomplish that made significant impact to both the visual fidelity of the system as well as the ability for artists to more properly represent a wider range of materials. \u00a0The first of these was to change the distribution function for my specular calculation.<\/p>\n<p>Now a little back story. \u00a0Over the summer, Blizzard sent all of their graphics programmers to SIGGRAPH, and they were gracious enough to have that include me despite just being an intern. \u00a0While there, I attended the Physically Based Shading course, and it presented me with a lot of information that I hadn&#8217;t necessarily previously considered, but which made a lot of sense as soon as I saw it; it was basically my experience at GDC last year, all over again. \u00a0All of the talks brought a lot of useful information, but Brian Karis&#8217; <a title=\"UE4 Shading!\" href=\"http:\/\/blog.selfshadow.com\/publications\/s2013-shading-course\/karis\/s2013_pbs_epic_slides.pdf\" target=\"_blank\">talk about UE4&#8217;s rendering system<\/a> ended up being the true catalyst of that morning. \u00a0I did a lot more research on my own and ended up replacing my Blinn distribution function with GGX, and the results were pretty astonishing despite not adopting any other part of the\u00a0Cook-Torrance microfacet model. \u00a0This change also rendered the specular texture completely unnecessary; I ended up repurposing those channels to store material properties like roughness, and it opened up a lot more possibilities as far as having varied materials across a single model.<\/p>\n<p>Here is a before and after comparison of the distribution functions:<\/p>\n<p><a href=\"http:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/Blinn.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-319\" alt=\"Blinn\" src=\"http:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/Blinn-1024x554.png\" width=\"800\" height=\"432\" srcset=\"https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/Blinn-1024x554.png 1024w, https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/Blinn-300x162.png 300w, https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/Blinn-250x135.png 250w, https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/Blinn-150x81.png 150w, https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/Blinn.png 1920w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/GGX.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-320\" alt=\"GGX\" src=\"http:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/GGX-1024x554.png\" width=\"800\" height=\"432\" srcset=\"https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/GGX-1024x554.png 1024w, https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/GGX-300x162.png 300w, https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/GGX-250x135.png 250w, https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/GGX-150x81.png 150w, https:\/\/www.teamfizzgames.com\/Matt\/wp-content\/uploads\/2014\/02\/GGX.png 1920w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p>Now, as a programmer, I am perfectly capable of designing and implementing this system. \u00a0However, I am no artist, and Photoshop is definitely not my friend. \u00a0So, the results here are based on very terrible texture manipulation by me, and you might be scratching your head over how much of an improvement this really was. \u00a0But I still think it proves my point well enough. \u00a0In the top image, the entire car looks plasticy, which is pretty common for Blinn. \u00a0In the bottom, the highlight tails vary, but overall feel much warmer. \u00a0The yellowness of the near pointlight also has more effect on the objects in the scene in the GGX version. \u00a0And due to storing material properties in textures, the GGX version is also able to present the canopy as shiny while the body is much more dull.<\/p>\n<p>So, while this is certainly still not a fully physically based system, I was able to make significant improvements relatively quickly, and maintain near equal computational complexity. \u00a0I call that a win. \u00a0Next time, I plan to delve into my finished multithreaded renderer, and talk about how incredibly wrong some elements of the code I previously posted in regards to it were. \u00a0So, it&#8217;ll be fun. \u00a0Especially for me. \u00a0Look forward to it!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m just going to jump into things and not really explain why there&#8217;s been a 4 month gap since the last post. \u00a0It should be pretty sufficient to just say&#8230; school. \u00a0However, I now have a lot of stuff to post about, so I&#8217;m hoping that means a lot of \u2026 <a class=\"continue-reading-link\" href=\"https:\/\/www.teamfizzgames.com\/Matt\/the-shift-to-ggx-and-a-glimpse-of-things-to-come\/\"> 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":[21,20],"class_list":["post-313","post","type-post","status-publish","format-standard","hentry","category-graphicsdev","tag-ggx","tag-lighting"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p39ImV-53","_links":{"self":[{"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts\/313","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=313"}],"version-history":[{"count":11,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts\/313\/revisions"}],"predecessor-version":[{"id":361,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/posts\/313\/revisions\/361"}],"wp:attachment":[{"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/media?parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/categories?post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.teamfizzgames.com\/Matt\/wp-json\/wp\/v2\/tags?post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}