{"@attributes":{"version":"2.0"},"channel":{"title":"Posts on The Danger Zone","link":"https:\/\/therealmjp.github.io\/posts\/","description":"Recent content in Posts on The Danger Zone","generator":"Hugo -- gohugo.io","language":"en-us","lastBuildDate":"Sun, 07 Sep 2025 00:00:00 +0000","item":[{"title":"Ten Years of D3D12","link":"https:\/\/therealmjp.github.io\/posts\/ten-years-of-d3d12\/","pubDate":"Sun, 07 Sep 2025 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/ten-years-of-d3d12\/","description":"For those of us that have been using it from the start, it can be hard to believe that Direct3D 12 has been around for ten years now. Windows 10 was released on July 29th 2015, and D3D12 has been with us ever since. While it&rsquo;s true that this is the longest we&rsquo;ve gone between major D3D version updates, it&rsquo;s also not fair to say that the API has remained static."},{"title":"To Early-Z, or Not To Early-Z","link":"https:\/\/therealmjp.github.io\/posts\/to-earlyz-or-not-to-earlyz\/","pubDate":"Sun, 13 Apr 2025 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/to-earlyz-or-not-to-earlyz\/","description":"Depth In The Logical Rendering Pipeline Where Does Early-Z Fit In? When Does Early-Z Have To Be Disabled? Discard\/Alpha Test Pixel Shader Depth Export UAVs\/Storage Textures\/Storage Buffers Forcing Early-Z Forced Early-Z With UAVs And Depth Writes Rasterizer Order Views\/Fragment Shader Interlock Summary and Conclusion One of the things we often take for granted on GPUs is the idea of early Z testing. It&rsquo;s the main reason why Z prepasses exist at all, and it&rsquo;s one of the things that has allowed forward rendering to remain viable without being completely overwhelmed by pixel shader overdraw (instead it merely gets overwhelmed by quad overshading, but I digress)."},{"title":"Shader Printf in HLSL and DX12","link":"https:\/\/therealmjp.github.io\/posts\/hlsl-printf\/","pubDate":"Sun, 07 Jan 2024 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/hlsl-printf\/","description":"Overall Approach Setting Up The Print Buffer The &ldquo;Magic&rdquo; Debug Info Buffer Dealing With The String Problem A Cursed Path Packing It All Into A Buffer Reading Back On The CPU Going Beyond Printf CR LF Unless you&rsquo;re fortunate enough to to be working exclusively in Cuda, debugging GPU shaders is still very much &ldquo;not great&rdquo; in the year 2024. Tools like RenderDoc and PIX are amazing and do provide the ability to step through a shader and inspect variables, but they&rsquo;re fundamentally tied to a &ldquo;capture&rdquo; workflow."},{"title":"GPU Memory Pools in D3D12","link":"https:\/\/therealmjp.github.io\/posts\/gpu-memory-pool\/","pubDate":"Sun, 31 Jul 2022 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/gpu-memory-pool\/","description":"Basics of GPU Memory Integrated\/UMA GPUs Dedicated\/NUMA GPUs How It Works In D3D12 Common Patterns in D3D12 Textures And The Two-Step Upload Should We Upload Buffers? Working With The COPY Queue Two COPY Queues Are Better Than One? Allocating Staging Memory What About DirectStorage? Results From My Testing App CPU Write Performance CPU Read Performance GPU Read Performance, Normal Access GPU Read Performance, Non-Coalesced Access GPU Read Performance, Various Buffer Sizes Conclusion When the monkey&rsquo;s paw granted our wish for lower-level\/explicit graphics APIs, one of the consequences was that we were much more directly exposed to the fact that GPUs can have their own separate set of physical memory."},{"title":"The Shader Permutation Problem - Part 1: How Did We Get Here?","link":"https:\/\/therealmjp.github.io\/posts\/shader-permutations-part1\/","pubDate":"Mon, 11 Oct 2021 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/shader-permutations-part1\/","description":"It is no secret that we tend to have a bit of a problem with shader permutations in real-time graphics. It&rsquo;s such a bad problem that it not only affects graphics programmers, but also trickles down to all of the other content creators that use an engine. If you don&rsquo;t believe me, just go ahead and search for &ldquo;unreal compiling shaders meme&rdquo; on Google images and see what comes up. There are many great ones to choose from, but personally I am a bit partial to this one:"},{"title":"The Shader Permutation Problem - Part 2: How Do We Fix It?","link":"https:\/\/therealmjp.github.io\/posts\/shader-permutations-part2\/","pubDate":"Mon, 11 Oct 2021 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/shader-permutations-part2\/","description":"Pictured above: Paul Atreides visualizing his full tree of shader permutations and regretting his decisions\nIf you&rsquo;ve read the previous article then you hopefully have a decent understanding of how shader permutations ended up being such a common issue. The good news is that there is some hope for the future: if we look across recent game releases as well as the features available in the latest GPUs and APIs, we do see some promising avenues for digging ourselves out of our self-imposed avalanche of compiled bytecode."},{"title":"Linking DXIL Binaries Using DXC","link":"https:\/\/therealmjp.github.io\/posts\/dxil-linking\/","pubDate":"Tue, 05 Oct 2021 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/dxil-linking\/","description":"While doing some research for a different blog post, I happened to discover that DXC is capable of linking together multiple compiled DXIL binaries into single complete shader program of any stage (vertex, pixel, compute, etc.). I had known that this was a thing you could do for D3D11 with the old fxc-based compiler stack, but I wasn&rsquo;t aware that DXC could now do it as well. It turns out that the new lib_6_x targets aren&rsquo;t just usable for creating DXR state objects: you can also compile whatever you want into libraries and link them together into a full binary for a non-raytracing shader."},{"title":"Read My Chapter in Ray Tracing Gems II!","link":"https:\/\/therealmjp.github.io\/posts\/rtg2-bindless\/","pubDate":"Sun, 22 Aug 2021 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/rtg2-bindless\/","description":"Ray Tracing Gems II was released a few weeks ago, and like the first one it&rsquo;s free to download as a PDF from the publisher&rsquo;s website. There are 50 articles in this thing written by over 80 authors, so I think it&rsquo;s safe to say that this book is absolutely jam-packed with useful knowledge and techniques related to ray tracing.\nYours truly contributed a chapter called &ldquo;Using Bindless Resources With DirectX Raytracing&rdquo;, which as you&rsquo;d expect is all about using bindless techniques in the context of DXR."},{"title":"Approximating Subsurface Scattering With Spherical Gaussians","link":"https:\/\/therealmjp.github.io\/posts\/sss-sg\/","pubDate":"Sun, 09 Feb 2020 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/sss-sg\/","description":"In my previous post, where I gave a quick overview of real-time subsurface scattering techniques, I mentioned that one of the potential downsides of preintegrated subsurface scattering was that it relied on sampling a precomputed lookup texture for storing the appropriate &ldquo;wrapped&rdquo; or &ldquo;blurred&rdquo; lighting response for a given lighting angle and surface curvature. Depending on the hardware you&rsquo;re working with as well as the exact details of the shader program, sampling a lookup texture can be either a good or a bad thing."},{"title":"An Introduction To Real-Time Subsurface Scattering","link":"https:\/\/therealmjp.github.io\/posts\/sss-intro\/","pubDate":"Sun, 06 Oct 2019 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/sss-intro\/","description":"A little while ago I was doing some research into the state-of-the-art for approximating subsurface scattering effects in real-time (mainly for skin rendering), and I had taken a bunch of loose notes to help me keep all of the details straight. I thought it might be useful to turn those notes into a full blog post, in case anyone else out there needs an overview of what&rsquo;s commonly used to shade skin and other materials in recent games."},{"title":"Half The Precision, Twice The Fun: Working With FP16 In HLSL","link":"https:\/\/therealmjp.github.io\/posts\/shader-fp16\/","pubDate":"Tue, 01 Oct 2019 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/shader-fp16\/","description":"Those of you who have been working on desktop and console graphics long enough will remember working with fp16 math in shaders during the D3D9 era. Back then HLSL supported the half scalar type, which corresponded to a floating-point value using 16-bits of precision. Using it was crucial for extracting the best performance from Nvidia&rsquo;s FX series, 6-series, and 7-series hardware, since it could perform many fp16 operations at faster rate than it could for full-precision 32-bit values."},{"title":"Hello, Hugo","link":"https:\/\/therealmjp.github.io\/posts\/hello-hugo\/","pubDate":"Mon, 12 Aug 2019 00:00:00 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/hello-hugo\/","description":"For the past 11(!) years I&rsquo;ve hosted my blog on wordpress.com, which had a very low barrier to entry. But for a year or two now I&rsquo;ve been itching to move on to something that I actually enjoy working with, and that doesn&rsquo;t leave me locked in to the WordPress platform and hosting services. Over the past two weeks or so I&rsquo;ve been working on setting up this new blog, which is hosted on GitHub pages and is generated as a static site using Hugo."},{"title":"Adventures in Retro Development: SNES Edition","link":"https:\/\/therealmjp.github.io\/posts\/adventures-in-retro-development-snes-edition\/","pubDate":"Tue, 15 Jan 2019 05:36:42 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/adventures-in-retro-development-snes-edition\/","description":"When I was growing up, the SNES was easily my favorite console. How could it not be, with top-tier games like Super Metroid and Mega Man X available? I had always wanted to learn how to program for the SNES so that I could develop my own silly games for the hardware that ran my favorite games as a kid. I decided to use this past holiday break as an excuse to finally get started, and I had a great time doing it!"},{"title":"Breaking Down Barriers - Part 6: Experimenting With Overlap and Preemption","link":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-6-experimenting-with-overlap-and-preemption\/","pubDate":"Mon, 10 Dec 2018 02:01:27 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-6-experimenting-with-overlap-and-preemption\/","description":"This is Part 6 of a series about GPU synchronization and preemption. You can find the other articles here:\nPart 1 - What&rsquo;s a Barrier?\nPart 2 - Synchronizing GPU Threads\nPart 3 - Multiple Command Processors\nPart 4 - GPU Preemption\nPart 5 - Back To The Real World\nPart 6 - Experimenting With Overlap and Preemption\nIn the previous art_icl_es we took a look at how barriers typically work on GPUs, and then we examined how multiple hardware queues can help with preemption and overall throughput."},{"title":"Breaking Down Barriers \u2013 Part 5: Back To The Real World","link":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-5-back-to-the-real-world\/","pubDate":"Sun, 09 Sep 2018 00:48:18 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-5-back-to-the-real-world\/","description":"This is Part 5 of a series about GPU synchronization and preemption. You can find the other articles here:\nPart 1 - What&rsquo;s a Barrier?\nPart 2 - Synchronizing GPU Threads\nPart 3 - Multiple Command Processors\nPart 4 - GPU Preemption\nPart 5 - Back To The Real World\nPart 6 - Experimenting With Overlap and Preemption\nWelcome to part 5 of the series! If you&rsquo;ve read all of the articles so far, thanks for hanging in there!"},{"title":"Breaking Down Barriers - Part 4: GPU Preemption","link":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-4-gpu-preemption\/","pubDate":"Wed, 04 Jul 2018 00:57:43 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-4-gpu-preemption\/","description":"This is Part 4 of a series about GPU synchronization and preemption. You can find the other articles here:\nPart 1 - What&rsquo;s a Barrier?\nPart 2 - Synchronizing GPU Threads\nPart 3 - Multiple Command Processors\nPart 4 - GPU Preemption\nPart 5 - Back To The Real World\nPart 6 - Experimenting With Overlap and Preemption\nWelcome back! For the past two articles we&rsquo;ve been taking a in-depth look at how a fictional GPU converts command buffers into lots of shader threads, and also how synchronization of those threads affects the overall performance of the GPU."},{"title":"Breaking Down Barriers - Part 3: Multiple Command Processors","link":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-3-multiple-command-processors\/","pubDate":"Mon, 18 Jun 2018 02:14:52 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-3-multiple-command-processors\/","description":"This is Part 3 of a series about GPU synchronization and preemption. You can find the other articles here:\nPart 1 - What&rsquo;s a Barrier?\nPart 2 - Synchronizing GPU Threads\nPart 3 - Multiple Command Processors\nPart 4 - GPU Preemption\nPart 5 - Back To The Real World\nPart 6 - Experimenting With Overlap and Preemption\nWelcome to Part 3 of the series! In this article, I&rsquo;m going to talk a bit about how multiple command processors can be used to increase the overall performance of a GPU by reducing the amount of time that shader cores sit idle."},{"title":"Breaking Down Barriers - Part 2: Synchronizing GPU Threads","link":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-2-synchronizing-gpu-threads\/","pubDate":"Mon, 02 Apr 2018 06:29:17 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-2-synchronizing-gpu-threads\/","description":"This is Part 2 of a series about GPU synchronization and preemption. You can find the other articles here:\nPart 1 - What&rsquo;s a Barrier?\nPart 2 - Synchronizing GPU Threads\nPart 3 - Multiple Command Processors\nPart 4 - GPU Preemption\nPart 5 - Back To The Real World\nPart 6 - Experimenting With Overlap and Preemption\nWelcome to part 2 of the series! In the previous article, I explained the basics of what a barrier is, and talked about the various reasons for why you need to use a barrier on a GPU."},{"title":"Breaking Down Barriers - Part 1: What's a Barrier?","link":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-1-whats-a-barrier\/","pubDate":"Tue, 06 Mar 2018 09:21:34 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/breaking-down-barriers-part-1-whats-a-barrier\/","description":"This is Part 1 of a series about GPU synchronization and preemption. You can find the other articles here:\nPart 1 - What&rsquo;s a Barrier?\nPart 2 - Synchronizing GPU Threads\nPart 3 - Multiple Command Processors\nPart 4 - GPU Preemption\nPart 5 - Back To The Real World\nPart 6 - Experimenting With Overlap and Preemption\nIf you&rsquo;ve done any amount of D3D12 or Vulkan programming, then you&rsquo;ve probably spent a good bit of that time grappling with barriers."},{"title":"SG Series Part 6: Step Into The Baking Lab","link":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-6-step-into-the-baking-lab\/","pubDate":"Mon, 10 Oct 2016 07:13:58 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-6-step-into-the-baking-lab\/","description":"This is part 6 of a series on Spherical Gaussians and their applications for pre-computed lighting. You can find the other articles here:\nPart 1 -\u00a0A Brief (and Incomplete) History of Baked Lighting Representations\nPart 2 -\u00a0Spherical Gaussians 101\nPart 3 -\u00a0Diffuse Lighting From an SG Light Source\nPart 4 -\u00a0Specular Lighting From an SG Light Source\nPart 5 -\u00a0Approximating Radiance and Irradiance With SG&rsquo;s"},{"title":"SG Series Part 5: Approximating Radiance and Irradiance With SG's","link":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-5-approximating-radiance-and-irradiance-with-sgs\/","pubDate":"Mon, 10 Oct 2016 07:12:13 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-5-approximating-radiance-and-irradiance-with-sgs\/","description":"This is part 5 of a series on Spherical Gaussians and their applications for pre-computed lighting. You can find the other articles here:\nPart 1 -\u00a0A Brief (and Incomplete) History of Baked Lighting Representations\nPart 2 -\u00a0Spherical Gaussians 101\nPart 3 -\u00a0Diffuse Lighting From an SG Light Source\nPart 4 -\u00a0Specular Lighting From an SG Light Source\nPart 5 -\u00a0Approximating Radiance and Irradiance With SG&rsquo;s"},{"title":"SG Series Part 4: Specular Lighting From an SG Light Source","link":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-4-specular-lighting-from-an-sg-light-source\/","pubDate":"Mon, 10 Oct 2016 07:09:20 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-4-specular-lighting-from-an-sg-light-source\/","description":"This is part 4 of a series on Spherical Gaussians and their applications for pre-computed lighting. You can find the other articles here:\nPart 1 -\u00a0A Brief (and Incomplete) History of Baked Lighting Representations\nPart 2 -\u00a0Spherical Gaussians 101\nPart 3 -\u00a0Diffuse Lighting From an SG Light Source\nPart 4 -\u00a0Specular Lighting From an SG Light Source\nPart 5 -\u00a0Approximating Radiance and Irradiance With SG&rsquo;s"},{"title":"SG Series Part 3: Diffuse Lighting From an SG Light Source","link":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-3-diffuse-lighting-from-an-sg-light-source\/","pubDate":"Mon, 10 Oct 2016 07:08:51 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-3-diffuse-lighting-from-an-sg-light-source\/","description":"This is part 3 of a series on Spherical Gaussians and their applications for pre-computed lighting. You can find the other articles here:\nPart 1 -\u00a0A Brief (and Incomplete) History of Baked Lighting Representations\nPart 2 -\u00a0Spherical Gaussians 101\nPart 3 -\u00a0Diffuse Lighting From an SG Light Source\nPart 4 -\u00a0Specular Lighting From an SG Light Source\nPart 5 -\u00a0Approximating Radiance and Irradiance With SG&rsquo;s"},{"title":"SG Series Part 2: Spherical Gaussians 101","link":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-2-spherical-gaussians-101\/","pubDate":"Mon, 10 Oct 2016 07:08:02 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-2-spherical-gaussians-101\/","description":"This is part 2 of a series on Spherical Gaussians and their applications for pre-computed lighting. You can find the other articles here:\nPart 1 -\u00a0A Brief (and Incomplete) History of Baked Lighting Representations\nPart 2 -\u00a0Spherical Gaussians 101\nPart 3 -\u00a0Diffuse Lighting From an SG Light Source\nPart 4 -\u00a0Specular Lighting From an SG Light Source\nPart 5 -\u00a0Approximating Radiance and Irradiance With SG&rsquo;s"},{"title":"SG Series Part 1: A Brief (and Incomplete) History of Baked Lighting Representations","link":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-1-a-brief-and-incomplete-history-of-baked-lighting-representations\/","pubDate":"Mon, 10 Oct 2016 07:05:49 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/sg-series-part-1-a-brief-and-incomplete-history-of-baked-lighting-representations\/","description":"This is part 1 of a series on Spherical Gaussians and their applications for pre-computed lighting. You can find the other articles here:\nPart 1 -\u00a0A Brief (and Incomplete) History of Baked Lighting Representations\nPart 2 -\u00a0Spherical Gaussians 101\nPart 3 -\u00a0Diffuse Lighting From an SG Light Source\nPart 4 -\u00a0Specular Lighting From an SG Light Source\nPart 5 -\u00a0Approximating Radiance and Irradiance With SG&rsquo;s"},{"title":"New Blog Series: Lightmap Baking and Spherical Gaussians","link":"https:\/\/therealmjp.github.io\/posts\/new-blog-series-lightmap-baking-and-spherical-gaussians\/","pubDate":"Mon, 10 Oct 2016 07:05:10 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/new-blog-series-lightmap-baking-and-spherical-gaussians\/","description":"So nearly\u00a0year and a half ago myself and Dave Neubelt gave a presentation at SIGGRAPH\u00a0where we\u00a0described\u00a0the approach that we developed for approximating incoming radiance using Spherical Gaussians in both our lightmaps and 3D probe grids. We had planned on releasing a source code demo as well as course notes that would serve\u00a0as a full set of implementation details, but unfortunately those efforts were sidetracked by other responsibilities."},{"title":"Bindless Texturing for Deferred Rendering and Decals","link":"https:\/\/therealmjp.github.io\/posts\/bindless-texturing-for-deferred-rendering-and-decals\/","pubDate":"Fri, 25 Mar 2016 08:39:36 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/bindless-texturing-for-deferred-rendering-and-decals\/","description":"https:\/\/github.com\/TheRealMJP\/DeferredTexturing\nhttps:\/\/github.com\/TheRealMJP\/DeferredTexturing\/releases\u00a0(Precompiled Binaries)\nTo Bind, or Not To Bind Unless you&rsquo;ve been in a coma for the past year, you&rsquo;ve probably noticed that there&rsquo;s a lot of buzz and excitement around the new graphics API&rsquo;s that are available for PC and mobile. One of the biggest changes brought\u00a0by both D3D12 and Vulkan is that they&rsquo;ve\u00a0ditched the old slot-based system for binding resources that&rsquo;s been\u00a0in use since&hellip;forever."},{"title":"Update For My Shadow Sample Update","link":"https:\/\/therealmjp.github.io\/posts\/update-for-my-shadow-sample-update\/","pubDate":"Mon, 25 Jan 2016 00:24:56 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/update-for-my-shadow-sample-update\/","description":"Recently I was contacted by Christoph Peters (one of the authors of Moment Shadow Mapping)\u00a0regarding a blog post where I compared EVSM to MSM using my sample app. He noticed that I was incorrectly clamping the maximum exponential warp to 10.0 for the 16-bit variant of EVSM, which can result in values that\u00a0are greater than\u00a0what can be stored in a 16-bit floating point texture. Doing this has 2 effects: it causes incorrect results during filtering (clamping the moments\u00a0can lead to negative variance, causing a reconstruction that resembles a step function), and it reduces the\u00a0amount of light bleeding."},{"title":"Stairway To (Programmable Sample Point) Heaven","link":"https:\/\/therealmjp.github.io\/posts\/programmable-sample-points\/","pubDate":"Mon, 14 Sep 2015 03:31:37 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/programmable-sample-points\/","description":"What Is and Should Never Be Historically, the sub-pixel location of MSAA sample points was totally out of your control as a programmer.\u00a0Typically the hardware used rotated grid patterns such as\u00a0this one,\u00a0which\u00a0were fixed for every pixel in your render target. For FEATURE_LEVEL_10_1, D3D added the concept of standard sample patterns that were required to be supported by the hardware. These were nice, in that you could specify the appropriate quality level and know exactly where the samples\u00a0would be located."},{"title":"SIGGRAPH Follow-Up: 2015 Edition","link":"https:\/\/therealmjp.github.io\/posts\/siggraph-2015\/","pubDate":"Mon, 17 Aug 2015 05:17:57 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/siggraph-2015\/","description":"SIGGRAPH 2015\u00a0wrapped up just a few days ago, and it really was fantastic this year! There was tons of great content, and I got a chance to meet up with some of best graphics programmers in the industry. I wanted to thank anyone that came to my talk at Advances in Real-Time Rendering, as well as anyone who came to our talk at the Physically Based Shading course. It&rsquo;s always awesome to see so many people interested in the latest rendering technology, and the other presenters really knocked it out of the park in both courses."},{"title":"Mitsuba Quick-Start Guide","link":"https:\/\/therealmjp.github.io\/posts\/mitsuba-quick-start-guide\/","pubDate":"Sat, 04 Apr 2015 20:36:44 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/mitsuba-quick-start-guide\/","description":"Angelo Pesce&rsquo;s recent blog post\u00a0brought up a great point towards\u00a0the end of the article:\u00a0having a &ldquo;ground-truth&rdquo; for comparison can be extremely\u00a0important\u00a0for evaluating your real-time techniques. For approximations like pre-integrated environment maps it can\u00a0help\u00a0visualize what kind of effect your approximation errors will have on a final rendered image, and and in many other cases it can aid\u00a0you in\u00a0tracking down bugs in your implementation."},{"title":"Some Special Thanks","link":"https:\/\/therealmjp.github.io\/posts\/some-special-thanks\/","pubDate":"Mon, 23 Mar 2015 08:35:45 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/some-special-thanks\/","description":"About a month ago, a little game called The Order: 1886 finally hit store shelves.\u00a0Its release marks the culmination of my past 4 years at Ready At Dawn, which were largely devoted to developing the core\u00a0rendering and engine technology that\u00a0was ultimately used for the\u00a0game. It&rsquo;s also a major milestone for me personally, as it&rsquo;s the first project that I&rsquo;ve worked on full-time from start to finish. I&rsquo;m of course immensely proud of what our team has managed to accomplish, and I feel tremendously lucky to go to work every day with such a talented and dedicated group of people."},{"title":"Shadow Sample Update","link":"https:\/\/therealmjp.github.io\/posts\/shadow-sample-update\/","pubDate":"Wed, 18 Feb 2015 18:00:06 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/shadow-sample-update\/","description":"Update 1\/24\/2016: one of the authors of the Moment Shadow Mapping paper contacted to let me know that there was an issue in my implementation of the 16-bit variant of EVSM. My sample app was clamping the maximum exponential warp factor to 10.0, which can result in overflow for a 16-bit float. This has the effect of reducing light bleeding, but it also causes edge quality to suffer during filtering. This made the light bleeding comparison with MSM16 unfair, particularly since my comparisons did not use high filtering settings."},{"title":"Come see me talk at GDC 2014","link":"https:\/\/therealmjp.github.io\/posts\/come-see-me-talk-at-gdc-2014\/","pubDate":"Wed, 12 Mar 2014 06:49:11 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/come-see-me-talk-at-gdc-2014\/","description":"Myself and fellow lead graphics programmer David Neubelt will be at GDC next week, talking about the rendering technology behind The Order: 1886. Unfortunately the talk came together a bit late, and so it initially started from the talk that we gave back at SIGGRAPH at last year (which is why it has the same title). However we don&rsquo;t want to just rehash the same material, so we&rsquo;ve added tons of new slides and revamped the old ones."},{"title":"Weighted Blended Order-Independent Transparency","link":"https:\/\/therealmjp.github.io\/posts\/weighted-blended-oit\/","pubDate":"Tue, 04 Feb 2014 06:58:04 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/weighted-blended-oit\/","description":"http:\/\/mynameismjp.files.wordpress.com\/2014\/02\/blendedoit.zip\nBack in December, Morgan McGuire and Louis Bavoil published a paper called\u00a0Weighted Blended Order-Independent Transparency. In case you haven&rsquo;t read it yet (you really should!), it proposes an OIT scheme that uses a weighted blend of all surfaces that overlap a given pixel. In other words finalColor = w0 * c0 + w1 * c1 + w2 * c2&hellip;etc. With a weighted blend the order of rendering no longer matters, which frees you from the never-ending nightmare of sorting."},{"title":"Sample Framework Updates","link":"https:\/\/therealmjp.github.io\/posts\/sample-framework-updates\/","pubDate":"Tue, 17 Sep 2013 05:54:02 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/sample-framework-updates\/","description":"You may have noticed that my latest sample now has a proper UI instead of the homegrown sliders and keyboard toggles that I was using in my older samples. What you might not have noticed is that there&rsquo;s a whole bunch of behind-the-scenes changes to go with that new UI! Before I ramble on, here&rsquo;s a quick bullet-point list of the new features:\nSwitched to VS2012 and adopted a few C++11 features New UI back-end provided by AntTweakBar C#-based data-definition format for auto-generating UI Shader hot-swapping Better shader caching, and compressed cache files It occurred to me a little while ago that I could try to develop my framework into something that enables rapid prototyping, instead of just being some random bits of cobbled-together code."},{"title":"A Sampling of Shadow Techniques","link":"https:\/\/therealmjp.github.io\/posts\/shadow-maps\/","pubDate":"Wed, 11 Sep 2013 07:45:40 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/shadow-maps\/","description":"A little over a year ago I was looking to overhaul our shadow rendering at work in order to improve overall quality, as well as simplify the workflow for the lighting artists (tweaking biases all day isn&rsquo;t fun for anybody). After doing yet another round of research into modern shadow mapping techniques, I decided to do what I usually do and starting working on sample project that I could use as a platform for experimentation and comparison."},{"title":"DX11.2 Tiled Resources","link":"https:\/\/therealmjp.github.io\/posts\/dx11-2-tiled-resources\/","pubDate":"Sat, 07 Sep 2013 06:21:28 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/dx11-2-tiled-resources\/","description":"Tiled resources seems to be the big-ticket item for the upcoming DX11.2 update. While the online documentation has some information about the new functions added to the API, there&rsquo;s currently no information about the two tiers of tiled resource functionality being offered. Fortunately there is a sample app available that provides some clues. After poking around a bit last night, these were the differences that I noticed:\nTIER2 supports MIN and MAX texture sampling modes that return the min or max of 4 neighboring texels."},{"title":"SIGGRAPH Follow-Up","link":"https:\/\/therealmjp.github.io\/posts\/siggraph-follow-up\/","pubDate":"Mon, 29 Jul 2013 06:15:04 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/siggraph-follow-up\/","description":"So I&rsquo;m hoping that if you&rsquo;re reading this, you&rsquo;ve already attended or read the slides from my presentation about The Order: 1886 that was part of the Physically Based Shading Course at SIGGRAPH last week. If not, go grab them and get started! If you haven&rsquo;t read through the course notes already there&rsquo;s a lot of good info there, in fact there&rsquo;s almost 30 pages worth! The highlights include:\nFull description of our Cook-Torrance and Cloth BRDF&rsquo;s, including a handy optimization for the GGX Smith geometry term (for which credit belongs to Steve McAuley) Analysis of our specular antialiasing solution Plenty of details regarding the material scanning process HLSL sample code for the Cook-Torrance BRDF&rsquo;s as well as the specular AA roughness modification Lots of beautiful LaTeX equations If you did attend, I really appreciate you coming and I hope that you found it interesting."},{"title":"What I've been working on for the past 2 years","link":"https:\/\/therealmjp.github.io\/posts\/what-ive-been-working-on\/","pubDate":"Wed, 12 Jun 2013 07:48:45 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/what-ive-been-working-on\/","description":"The announce trailer for Ready At Dawn&rsquo;s latest project was shown during Sony&rsquo;s E3 press conference yesterday, but if you missed it you can watch it here. There&rsquo;s also a few full-res screenshots available here, with less compress-o-vision. It feels\u00a0really good to finally be able to tell people what game I&rsquo;ve been working on, and that we&rsquo;re making a PS4 title. I&rsquo;m also insanely proud of the trailer itself, as well as the in-house tech we&rsquo;ve developed that made it possible."},{"title":"HLSL User Defined Language for Notepad++","link":"https:\/\/therealmjp.github.io\/posts\/hlsl-udl\/","pubDate":"Mon, 05 Nov 2012 07:09:39 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/hlsl-udl\/","description":"When it comes to writing shaders, Notepad++ is currently my editor of choice. The most recent release of Notepad++ added version 2.0 of their User Defined Language (UDL) system, which adds quite a few improvements. I&rsquo;ve been using an HLSL UDL file that I downloaded from somewhere else for a while now, and I decided to upgrade it to the 2.0 format and also make it work better for SM5.0 profiles."},{"title":"Experimenting with Reconstruction Filters for MSAA Resolve","link":"https:\/\/therealmjp.github.io\/posts\/msaa-resolve-filters\/","pubDate":"Mon, 29 Oct 2012 07:33:31 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/msaa-resolve-filters\/","description":"Previous article in the series: A Quick Overview of MSAA\nUpdate 8\/26\/2017: while working on The Order I improved upon the work described here, which I presented at SIGGRAPH 2015. I also created an updated MSAA + TAA filtering demo that you can find on GitHub, which just about completely supersedes the demo that&rsquo;s linked at the end of the article. So make sure that you look at the new one as well!"},{"title":"A Quick Overview of MSAA","link":"https:\/\/therealmjp.github.io\/posts\/msaa-overview\/","pubDate":"Thu, 25 Oct 2012 07:03:27 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/msaa-overview\/","description":"Previous article in the series: Applying Sampling Theory to Real-Time Graphics\nUpdated 1\/27\/2016 - replaced the MSAA partial coverage image with a new image that illustrates subsamples being written to, as suggested by\u00a0Simon Tr\u00fcmpler.\nMSAA can be a bit complicated, due to the fact that it affects nearly the entire rasterization pipeline used in GPU\u2019s. It\u2019s also complicated because really understanding why it works requires at least a basic understanding of signal processing and image resampling."},{"title":"Applying Sampling Theory To Real-Time Graphics","link":"https:\/\/therealmjp.github.io\/posts\/applying-sampling-theory-to-real-time-graphics\/","pubDate":"Mon, 22 Oct 2012 06:59:09 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/applying-sampling-theory-to-real-time-graphics\/","description":"Previous article in the series: Signal Processing Primer\nComputer graphics is a field that constantly deals with discrete sampling and reconstruction of signals, although you might not be aware of it yet. This article focuses on the ways in which sampling theory can be applied to some of the common tasks routinely performed in graphics and 3D rendering.\nImage Scaling The concepts of sampling theory can are most easily applicable to graphics in the form of image scaling."},{"title":"Signal Processing Primer","link":"https:\/\/therealmjp.github.io\/posts\/signal-processing-primer\/","pubDate":"Mon, 15 Oct 2012 08:20:18 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/signal-processing-primer\/","description":"For a theoretical understanding of aliasing and anti-aliasing, we can turn to the fields of signal processing[1] and sampling theory[2]. This article will explain some of the basics of\u00a0these two related field in my own words, taking a more theoretical point of view. In the following article the concepts covered here will be used to analyze common aspects of real-time graphics, so that we can describe them in terms of signal processing."},{"title":"Upcoming Series on Signal Processing and MSAA","link":"https:\/\/therealmjp.github.io\/posts\/upcoming-series-on-signal-processing-and-msaa\/","pubDate":"Mon, 15 Oct 2012 08:00:47 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/upcoming-series-on-signal-processing-and-msaa\/","description":"Aliasing is everywhere in graphics. Almost everything we do uses discrete sampling, which means almost everything can produce a variety of aliasing artifacts. The folks in the film industry have historically taken a \u201cno aliasing allowed\u201d stance in their work, but in real-time graphics we\u2019re still producing games with more sparkling and shimmering than a glitzy prom dress. If we\u2019re going to do anything about that problem, I think it\u2019s important that we all try to have at least a basic understanding of signal processing."},{"title":"OpenGL Insights","link":"https:\/\/therealmjp.github.io\/posts\/opengl-insights\/","pubDate":"Mon, 06 Aug 2012 04:50:49 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/opengl-insights\/","description":"Some time ago Charles de Rousiers adapted my Bokeh Depth of Field sample to OpenGL, and we contributed it as a chapter to the recently-released OpenGL Insights. Bokeh is still an ongoing area of R&amp;D for myself, and hopefully I&rsquo;ll be able to share some more improvements and optimizations once my current project is announced or released.\nThere&rsquo;s going to be an author meet-up\/book signing a the CRC Press SIGGRAPH booth (#929) this Tuesday from 2-3PM, and I&rsquo;ll most likely be stopping by."},{"title":"Looking for a job?","link":"https:\/\/therealmjp.github.io\/posts\/looking-for-a-job\/","pubDate":"Sat, 28 Apr 2012 22:55:10 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/looking-for-a-job\/","description":"My company, Ready At Dawn Studios, is hiring pretty much across the board. Our jobs page has the full details, but the gist of it is that we&rsquo;re working on a new AAA IP for a next-generation home console. I can&rsquo;t really say more than that about the project, but I will say that we&rsquo;re doing some *really* exciting work in terms of graphics. If you&rsquo;re interested, send your resume to jobs[at]readyatdawn."},{"title":"A quick note on shader compilers","link":"https:\/\/therealmjp.github.io\/posts\/a-quick-note-on-shader-compilers\/","pubDate":"Sat, 14 Apr 2012 04:56:04 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/a-quick-note-on-shader-compilers\/","description":"This morning I was wrestling with\u00a0a particularly complicated compute shader, which was taking just shy of 10 minutes to compile using D3DCompiler_43 from the June 2010 DirectX SDK. After a few failed attempts to speed it up by rearranging the code, I figured I&rsquo;d try it out with the new version of the compiler that comes with the Windows 8 SDK. I wasn&rsquo;t expecting any miracles, but to my surprise it compiled my shader in about 45 seconds!"},{"title":"Light Indexed Deferred Rendering","link":"https:\/\/therealmjp.github.io\/posts\/light-indexed-deferred-rendering\/","pubDate":"Sun, 01 Apr 2012 02:53:53 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/light-indexed-deferred-rendering\/","description":"There&rsquo;s been a bit of a stir on the Internet lately due to AMD&rsquo;s recent Leo demo, which was recently revealed to be using a modern twist on Light Indexed Deferred Rendering. The idea of light indexed deferred has always been pretty appealing, since it gives you some of the advantages of deferred rendering (namely using the GPU to decide which lights affect each pixel) while still letting you use forward rendering to actually apply the lighting to each surface."},{"title":"10 Things That Need To Die For Next-Gen","link":"https:\/\/therealmjp.github.io\/posts\/things-that-need-to-die\/","pubDate":"Tue, 06 Dec 2011 09:54:34 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/things-that-need-to-die\/","description":"Lately I&rsquo;ve been thinking about things in graphics that have long worn out their welcome, and I started a list of techniques that I hope will be nowhere in sight once everyone moves on to next-gen console hardware (or starts truly exploiting high-end PC hardware). Here they are, in no particular order:\nPhong\/Blinn-Phong - we need more expressive BRDF&rsquo;s for our materials, and these guys are getting in the way. Phong is just plain bad, as it doesn&rsquo;t even produce realistic streaks at glancing angles (due to using the reflection vector and not the halfway vector like with microfacet-based BRDF&rsquo;s)."},{"title":"GPU Profiling in DX11 with Queries","link":"https:\/\/therealmjp.github.io\/posts\/profiling-in-dx11-with-queries\/","pubDate":"Thu, 13 Oct 2011 08:59:37 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/profiling-in-dx11-with-queries\/","description":"For profiling GPU performance on the PC, there aren&rsquo;t too many options. AMD&rsquo;s GPU PerfStudio and Nvidia&rsquo;s Parallel Nsight can be pretty handy due to their ability to query hardware performance counters and display the data, but they only work on each vendor&rsquo;s respective hardware. You also might want to integrate some GPU performance numbers into your own internal profiling systems, in which case those tools aren&rsquo;t going to be of much use."},{"title":"Average luminance calculation using a compute shader","link":"https:\/\/therealmjp.github.io\/posts\/average-luminance-compute-shader\/","pubDate":"Wed, 10 Aug 2011 09:31:03 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/average-luminance-compute-shader\/","description":"A common part of most HDR rendering pipelines is some form of average luminance calculation. Typically it&rsquo;s used to implement Reinhard&rsquo;s method of image calibration, which is to map the geometric mean of luminance (log average) to some &ldquo;key value&rdquo;. This, combined with some time-based adaptation, allows for a reasonable approximation of auto-exposure or human eye adaptation.\nIn the old days of DX9, the average luminance calculation was usually done repeatedly downscaling a luminance texture as if generating mipmaps."},{"title":"I am officially a published author","link":"https:\/\/therealmjp.github.io\/posts\/i-am-officially-a-published-author\/","pubDate":"Fri, 05 Aug 2011 06:04:11 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/i-am-officially-a-published-author\/","description":"I recently collaborated with fellow DX MVP&rsquo;s Jason Zink and Jack Hoxley to write a D3D11-focused book entitled Practical Rendering and Computation with Direct3D 11, which just came up for sale on Amazon today. I wrote the HLSL and Deferred Rendering chapters in particular. All of the code samples are up on the Hieroglyph 3 CodePlex site, if you want to get an idea of the content. Or you can just take my word for it that it&rsquo;s awesome."},{"title":"Anamorphic lens flares: the lens flare of the 2010's?","link":"https:\/\/therealmjp.github.io\/posts\/lens-flares\/","pubDate":"Fri, 10 Jun 2011 06:57:41 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/lens-flares\/","description":"Since the dawn of time, the greatest struggle of the graphics programmer is to ensure that bright stuff looks really damn bright. We&rsquo;re stuck with displays that have a limited displayable range, which means it&rsquo;s fallen upon us to come up with new hacks and tricks to make sure the player at least feels like he&rsquo;s blinded by the sun, even if we can&rsquo;t really cause physical damage to their eyes (if only!"},{"title":"Bokeh II: The Sequel","link":"https:\/\/therealmjp.github.io\/posts\/bokeh-ii-the-sequel\/","pubDate":"Wed, 20 Apr 2011 06:59:20 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/bokeh-ii-the-sequel\/","description":"After I finished the bokeh sample, there were a few remaining issues that I wanted to tackle before I was ready to call it &ldquo;totally awesome&rdquo; and move on with my life.\nGood blur - in the last sample I used either a 2-pass blur on a poisson disc performed at full resolution, or a bilateral Gaussian blur performed at 1\/4 resolution (both done in a pixel shader). The former is nice because it gives you variable filter width per-pixel, but you get some ugly noise-like artifacts due to insufficient sampling."},{"title":"Crashes on Nvidia hardware","link":"https:\/\/therealmjp.github.io\/posts\/crashes-on-nvidia-hardware\/","pubDate":"Sat, 26 Mar 2011 07:23:30 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/crashes-on-nvidia-hardware\/","description":"A few people have told me that my past two samples (Bokeh and RadiosityDX11) were crashing on Nvidia GPU&rsquo;s, which I verified myself on my coworker&rsquo;s GTX 470. The crash appears to be a driver bug, since it happens deep in the Nvidia runtime DLL on a worker thread and also because it works fine on AMD hardware and the REF device. This morning we managed to narrow it down to the shadow map filtering shader code (shader code can crash drivers apparently, who knew?"},{"title":"How To Fake Bokeh (And Make It Look Pretty Good)","link":"https:\/\/therealmjp.github.io\/posts\/bokeh\/","pubDate":"Mon, 28 Feb 2011 08:18:35 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/bokeh\/","description":"Before I bought a decent DSLR camera and started putting it in manual mode, I never really noticed bokeh that much. I always just equated out-of-focus with blur, and that was that. But now that I&rsquo;ve started noticing, I can&rsquo;t stop seeing it everywhere. And now every time I see depth of field effects in a game that doesn&rsquo;t have bokeh, it just looks wrong. A disc blur or even Gaussian blur is fine for approximating the look of out-0f-focus areas that are mostly low-frequency, but the hot spots just don&rsquo;t look right at all (especially if you don&rsquo;t do it in HDR)."},{"title":"Radiosity, DX11 Style","link":"https:\/\/therealmjp.github.io\/posts\/radiosity-dx11-style\/","pubDate":"Mon, 31 Jan 2011 08:08:09 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/radiosity-dx11-style\/","description":"Radiosity isn&rsquo;t exactly new. According to Wikipedia it&rsquo;s been used for rendering since the early 80&rsquo;s, and this page looks like it may have been the first web page on the Internet. The basic premise is dead simple: for each point where you want to bake lighting (typically either a texel in a lightmap, or a vertex in a mesh), render the rest of the scene and any exterior light sources (skydome, area lights, sun, whatever) in all directions within a hemisphere surrounding the surface normal at that point."},{"title":"Position From Depth in GLSL","link":"https:\/\/therealmjp.github.io\/posts\/position-from-depth-glsl-style\/","pubDate":"Sun, 09 Jan 2011 01:47:45 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/position-from-depth-glsl-style\/","description":"Commenter &ldquo;Me&rdquo; was kind enough to share his GLSL implementation of a deferred point light shader, which makes use of one of the methods I previously posted for reconstructing position from depth. So I figured I&rsquo;d post it here, for all of you unfortunate enough to be stuck with writing shaders in GLSL. :P\n\/\/ deferred shading VERTEX (GEOMETRY) varying vec3 normalv, posv; void main( void ) { normalv = ( gl_NormalMatrix * gl_Normal )."},{"title":"Conservative Depth Output (and Other Lesser-Known D3D11 Features)","link":"https:\/\/therealmjp.github.io\/posts\/d3d11-features\/","pubDate":"Mon, 15 Nov 2010 02:24:48 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/d3d11-features\/","description":"D3D11 came with a whole bunch of new big-ticket features that received plenty of attention and publicity. Things like tessellation, compute shaders, and multithreaded command submission have the subject of many presentations, discussion, and sample apps. However D3D11 also came with a few other features that allow more &ldquo;traditional&rdquo; rendering approaches to benefit from the increased programmability of graphics hardware. Unfortunately most of them have gone relatively unnoticed, which isn&rsquo;t surprising when you consider that most of them have little or no documentation, (much like some of the cool stuff that came in D3D10."},{"title":"Position From Depth 3: Back In The Habit","link":"https:\/\/therealmjp.github.io\/posts\/position-from-depth-3\/","pubDate":"Mon, 06 Sep 2010 07:11:52 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/position-from-depth-3\/","description":"A friend of mine once told me that you could use &ldquo;back in the habit&rdquo; as the subtitle for any movie sequel. I think it works.\nSo a lot of people still have trouble with reconstructing position from depth thing, judging by the emails I get and also the threads I see in the gamedev forums made by people who read my earlier blog posts.\u00a0Can&rsquo;t say I blame them&hellip;it&rsquo;s pretty tricky, and easy to screw up."},{"title":"Deferred MSAA","link":"https:\/\/therealmjp.github.io\/posts\/deferred-msaa\/","pubDate":"Mon, 16 Aug 2010 08:57:37 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/deferred-msaa\/","description":"A long while ago I was looking into morphological antialiasing (MLAA) to see if I could somehow make it practical for a GPU that isn&rsquo;t the latest monster from Nvidia or ATI. With MLAA most people talk about how nicely it cleans up edges (which it certainly does), but for me the really cool part is how it&rsquo;s completely orthogonal to the technique used to render the image.\u00a0It could have been rasterized and forward rendered, it could be the product of a deferred rendering, or it could even be ray-traced: in all cases the algorithm works the same."},{"title":"MSAA Sample Pattern Detector","link":"https:\/\/therealmjp.github.io\/posts\/msaa-sample-pattern-detector\/","pubDate":"Wed, 07 Jul 2010 08:42:23 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/msaa-sample-pattern-detector\/","description":"Recently I&rsquo;ve been experimenting with AA techniques, and one of the avenues I was pursuing required me to read back subsamples and use them to compute coverage.\u00a0However I quickly ran into the problem that I didn&rsquo;t know the sample position for a given subsample index.\u00a0With FEATURE_LEVEL_10_1 and FEATURE_LEVEL_11 there are standard MSAA patterns you can use, but unfortunately I&rsquo;m still stuck on a 10-level GPU so that wasn&rsquo;t an option."},{"title":"A Closer Look At Tone Mapping","link":"https:\/\/therealmjp.github.io\/posts\/a-closer-look-at-tone-mapping\/","pubDate":"Fri, 30 Apr 2010 08:47:17 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/a-closer-look-at-tone-mapping\/","description":"A few months ago my coworker showed me some slides from a presentation by tri-Ace regarding their game &ldquo;Star Ocean 4&rdquo;.\u00a0The slides that really caught my eye were pages 90 to 96, where they discussed their approach to tone mapping. Instead of using the standard Reinhard tone mapping operator that everybody is so fond of, they decided to instead use curves based on actual specifications from different film types and CMOS sensors."},{"title":"Attack of the depth buffer","link":"https:\/\/therealmjp.github.io\/posts\/attack-of-the-depth-buffer\/","pubDate":"Tue, 23 Mar 2010 07:42:36 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/attack-of-the-depth-buffer\/","description":"In these exciting modern times, people get a lot of mileage out of their depth buffers. Long gone are the days where we only use depth buffers for visibility and stenciling, as we now make use of the depth buffer to reconstruct world-space or view-space position of our geometry at any given pixel.\u00a0This can be a powerful performance optimization, since the alternative is to output position into a &ldquo;fat&rdquo; floating-point buffer."},{"title":"D3D Performance and Debugging Tools Round-Up: PerfHUD","link":"https:\/\/therealmjp.github.io\/posts\/d3d-performance-and-debugging-tools-round-up-perfhud\/","pubDate":"Sun, 07 Mar 2010 05:42:44 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/d3d-performance-and-debugging-tools-round-up-perfhud\/","description":"Officially, Nvidia&rsquo;s PerfHUD is a performance-monitoring and debugging application for use with Nvidia GPU&rsquo;s. Unofficially, it&rsquo;s pure awesomeness for a graphics programmer.\u00a0While I personally find PIX to be a more useful tool when it comes to debugging, the fact that PerfHUD gives you hardware-specific details makes it infinitely more useful for profiling. At work I find myself using it every time there&rsquo;s a performance issue on the PC. Here&rsquo;s some of the things I like to do with it (warning, it&rsquo;s a long list!"},{"title":"D3D Performance and Debugging Tools Round-Up: PIX","link":"https:\/\/therealmjp.github.io\/posts\/d3d-performance-and-debugging-tools-round-up-pix\/","pubDate":"Mon, 15 Feb 2010 05:17:18 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/d3d-performance-and-debugging-tools-round-up-pix\/","description":"So at this point just everybody knows about knows about PIX. I mean it comes with the DirectX SDK, for crying out loud.\u00a0This handy little program started its like as the Performance Investigator for Xbox (original Xbox, that is) and today is useful performance and debugging tool for both Windows and the Xbox 360.\u00a0Since it&rsquo;s a DirectX tool, most of the information you can gather from it is hardware-independent."},{"title":"New Series: D3D Performance and Debugging Tools Round-Up","link":"https:\/\/therealmjp.github.io\/posts\/new-series-d3d-performance-and-debugging-tools-round-up\/","pubDate":"Mon, 15 Feb 2010 05:16:17 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/new-series-d3d-performance-and-debugging-tools-round-up\/","description":"Recently I&rsquo;ve been spending a lot of time with the various performance and debugging utilities available for Direct3D, and I thought it might be useful to give a quick overview of what&rsquo;s out there.\u00a0I&rsquo;m sure most people who do a lot of Direct3D\/XNA work are aware of these tools, but probably aren&rsquo;t familiar with all of the really cool things you can do with them.\nWhat I&rsquo;m going to do is run through each tool one at a time, and share some of the common use cases and show some screenshots of features I think are neat."},{"title":"Name Change","link":"https:\/\/therealmjp.github.io\/posts\/name-change\/","pubDate":"Sat, 06 Feb 2010 23:22:13 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/name-change\/","description":"I got tired having an awkward mouthful of a blog name, so I decided to shorten it to something much snappier.\u00a0Hence &ldquo;MJP&rsquo;s XNA Danger Zone&rdquo; becomes simply &ldquo;The Danger Zone&rdquo;. I like it better already.\nActually the main reason for the change is that I&rsquo;ve been taking a break from the XNA stuff so that I can finally play around with DX11 a bit. In fact I&rsquo;ve been working on a simple and flexible DX11 sample framework, so you may see a few DX11 samples from me in the future."},{"title":"Inferred Rendering","link":"https:\/\/therealmjp.github.io\/posts\/inferred-rendering\/","pubDate":"Sun, 10 Jan 2010 17:30:10 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/inferred-rendering\/","description":"So like I said in my last post, I&rsquo;ve been doing some research into Inferred Rendering.\u00a0If you&rsquo;re not familiar with the technique, Scott Kircher has the original paper and presentation materials hosted on his website.\u00a0The main topic of the paper is what they call &ldquo;Discontinuity Sensitive Filtering&rdquo;, or &ldquo;DSF&rdquo; for short.\u00a0Basically it&rsquo;s standard 2x2 bilinear filtering, except in addition to sampling the texture you&rsquo;re interested in you also sample what they call a a &ldquo;DSF buffer&rdquo; containing depth, an instance ID (semi-unique for each instance rendering on-screen), and a normal ID (a semi-unique value identifying areas where the normals are continuous)."},{"title":"Correcting XNA's Gamma Correction","link":"https:\/\/therealmjp.github.io\/posts\/correcting-xnas-gamma-correction\/","pubDate":"Thu, 31 Dec 2009 22:31:58 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/correcting-xnas-gamma-correction\/","description":"One thing I never used to pay attention to is gamma correction.\u00a0This is mainly because it rarely gets mentioned, and also because you can usually get pretty good results without ever even thinking about it.\u00a0However it only took a few days at my new job for me to realize just how essential it is if you want professional-quality results.\nLately I&rsquo;ve been doing some research into inferred rendering (more on that later), and while working up a prototype renderer in XNA I decided that I would (for once)\u00a0be gamma-correct throughout the pipeline."},{"title":"More Post-Processing Tricks: Lens Flare","link":"https:\/\/therealmjp.github.io\/posts\/more-post-processing-tricks-lens-flare\/","pubDate":"Tue, 15 Dec 2009 08:53:17 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/more-post-processing-tricks-lens-flare\/","description":"I was playing Killzone 2 the other day, which reminded me of the lens flare trick they used.\u00a0Unlike most games, which use some sprites controlled by an occlusion query, they applied the effect as a post-process similar to bloom.\u00a0The upside is that it works for all bright areas and not pre-defined areas (the sun), and you don&rsquo;t have to do occlusion queries or anything like that since that&rsquo;s handled automatically."},{"title":"Two Samples For The Price Of One","link":"https:\/\/therealmjp.github.io\/posts\/two-samples\/","pubDate":"Sun, 06 Dec 2009 04:22:29 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/two-samples\/","description":"Today I have two XNA samples fresh out of the oven: a Motion Blur Sample, and Depth Of Field Sample.\u00a0I figure all of the kids these days wanna add fancy post-processing tricks to their games, right?\u00a0The motion blur sample shows you how to do camera motion blur using a depth buffer, or full object motion blur using a velocity buffer. The depth of field sample shows you how to do a standard blur-based DOF, a slightly-smarter blur-based DOF that doesn&rsquo;t blur across edges, and the somewhat more physically accurate disc blur approach."},{"title":"New Tutorial: Using PIX With XNA","link":"https:\/\/therealmjp.github.io\/posts\/pix-with-xna\/","pubDate":"Fri, 16 Oct 2009 15:49:13 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/pix-with-xna\/","description":"Ladies and gentlemen, I present you with the most epic of tutorials: Using PIX With XNA.\u00a0This 37-page monster teaches PIX for the XNA programmer, and includes an in-depth explanation of the XNA\/D3D9 relationship as well as 6 excercises that show you the how to solve common problems (full source code and XNA 3.1 projects included).\u00a0I sure hope somebody finds this thing useful&hellip;it took me forever to write this thing."},{"title":"Scintillating Snippets: Storing Normals Using Spherical Coordinates","link":"https:\/\/therealmjp.github.io\/posts\/storing-normals-using-spherical-coordinates\/","pubDate":"Wed, 17 Jun 2009 16:36:06 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/storing-normals-using-spherical-coordinates\/","description":"Update:\u00a0n00body posted this link in the comments, which is way more in-depth than my post.\u00a0Check it out!\nIf you&rsquo;ve ever implemented a deferred renderer, you know that one of the important points is keeping your G-Buffer small enough as to be reasonable in terms of bandwidth and your number of render targets.\u00a0Thanks to that constant struggle between good and evil, people have come up with some reasonable clever approaches towards packing necessary attributes in your G-Buffer."},{"title":"What's good on the menu, waiter?","link":"https:\/\/therealmjp.github.io\/posts\/whats-good-on-the-menu-waiter\/","pubDate":"Wed, 20 May 2009 16:28:39 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/whats-good-on-the-menu-waiter\/","description":"I remember reading someone say on gamedev.net that at some point everyone tries to write their own UI system, and usually gets it wrong.\u00a0Apparently he&rsquo;s right (or at least about the first part), because I&rsquo;ve gone ahead and written a menu\/UI system.\u00a0While it initially started out as part of the engine\/framework I&rsquo;ve been working on for my game, as I worked on it I decided it might be better off if I decoupled it from the rest of the engine components and made it a standalone library\/editor package so that other people could make use of it."},{"title":"Reconstructing Position From Depth, Continued","link":"https:\/\/therealmjp.github.io\/posts\/reconstructing-position-from-depth-continued\/","pubDate":"Tue, 05 May 2009 20:09:33 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/reconstructing-position-from-depth-continued\/","description":"Picking up where I left off here&hellip;\nAs I mentioned, you can also reconstruct a world-space position using the frustum ray technique.\u00a0The first step is that you need your frustum corners to be rotated so that they match the current orientation of your camera.\u00a0You can do this by transforming the frustum corners by a &ldquo;camera world matrix&rdquo;, which is a matrix representing the camera&rsquo;s position and orientation in world-space."},{"title":"Undo and Redo: Take 2","link":"https:\/\/therealmjp.github.io\/posts\/undo-and-redo-take-2\/","pubDate":"Thu, 30 Apr 2009 19:37:03 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/undo-and-redo-take-2\/","description":"Please excuse the rhyming in the title&hellip;sometimes I just can&rsquo;t help myself.\u00a0It&rsquo;s a problem.\nA few weeks ago I started working on a\u00a0super-duper-secret project (to be revealed soon), a big part of which was a new editor.\u00a0Since I&rsquo;m the kind of guy who gets all worked up about having proper undo and redo support, I took the opportunity to make it an up-front part of my design rather than just shoving it in afterwords."},{"title":"There's More Than One Way To Defer A Renderer","link":"https:\/\/therealmjp.github.io\/posts\/theres-more-than-one-way-to-defer-a-renderer\/","pubDate":"Fri, 27 Mar 2009 19:21:49 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/theres-more-than-one-way-to-defer-a-renderer\/","description":"While the idea of deferred shading\/deferred rendering isn&rsquo;t quite as hot as it was\u00a0year or two ago (OMG, Killzone 2 uses deferred rendering!), it&rsquo;s still a cool idea that gets discussed rather often.\u00a0People generally tend to be attracted to way a &ldquo;pure&rdquo; deferred renderer neatly and cleanly separates your geometry from your lighting, as well as the idea of being able to throw lights everywhere in their scene.\u00a0However as anyone who&rsquo;s done a little bit of research into the topic surely knows, it comes with a few drawbacks."},{"title":"Scintillating Snippets: Reconstructing Position From Depth","link":"https:\/\/therealmjp.github.io\/posts\/reconstructing-position-from-depth\/","pubDate":"Tue, 10 Mar 2009 19:06:31 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/reconstructing-position-from-depth\/","description":"There are times I wish I&rsquo;d never responded to this thread over at GDnet, simply because of the constant stream of PM&rsquo;s that I still get about it.\u00a0Wouldn&rsquo;t it be nice if I could just pull out all the important bits, stick it on some blog, and then link everyone to it?\u00a0You&rsquo;re right, it would be!\nFirst things first: what am I talking about?\u00a0I&rsquo;m talking about something that finds great use for deferred rendering: reconstructing the 3D position of a previously-rendered pixel (either in view-space or world-space) from a single depth value."},{"title":"Scintillating Snippets: Programatically Adding Content To A Content Project","link":"https:\/\/therealmjp.github.io\/posts\/snippet-content-project\/","pubDate":"Thu, 19 Feb 2009 21:36:05 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/snippet-content-project\/","description":"One of the tools I made for my current project is a model editor.\u00a0Basically it can import in .fbx or .x models, and then you can apply my custom effects, set parameters, set textures, and then save it using my custom model format I named &ldquo;.jsm&rdquo; (it&rsquo;s just XML&hellip;don&rsquo;t tell anyone!).\u00a0Anyway one of the neat features I wanted it to have was the ability to add a model to my game&rsquo;s Content project so that you wouldn&rsquo;t have to manually do it through Visual Studio."},{"title":"Deferred Cascaded Shadow Maps","link":"https:\/\/therealmjp.github.io\/posts\/deferred-cascaded-shadow-maps\/","pubDate":"Wed, 18 Feb 2009 04:22:32 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/deferred-cascaded-shadow-maps\/","description":"For my next sample I was planning on extending my deferred shadow maps sample to implement cascaded shadow maps.\u00a0I got an email asking about how to make the sample look decent with large viewing distances which is exactly the problem CSM&rsquo;s solve.\u00a0So I decided to bump up my plans a little early and get the code up and running.\u00a0It&rsquo;ll be a while before I get the write-up finished, but until then feel free to play around with code (PC and 360 projects included)."},{"title":"Profiling Events vs. Virtual Functions On The 360","link":"https:\/\/therealmjp.github.io\/posts\/profiling-events\/","pubDate":"Fri, 23 Jan 2009 17:31:19 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/profiling-events\/","description":"Over the past week or so I&rsquo;ve been completely reworking my collision system in order to better decouple it from other areas of code, and also make it more flexible.\u00a0One part I got stuck on for a bit was deciding on the mechanism to use for notifying owners of collision components when the component collides with something.\u00a0I narrowed it down to two options:\nnotify owners via the ICollisionOwner interface I was using OR"},{"title":"Deferred Shadow Maps Sample","link":"https:\/\/therealmjp.github.io\/posts\/deferred-shadow-maps-sample\/","pubDate":"Tue, 20 Jan 2009 01:24:19 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/deferred-shadow-maps-sample\/","description":"Got a new sample ready, this one\u00a0shows how you can defer shadow map calculations to a separate screen-space pass using a depth buffer.\u00a0Check it out on Ziggyware!\nComments: sam - Feb 4, 2009\nThis sample does not works for me. I see the blank screen. My Video card is GF 9800 GT.\n#### [Alejandro Martinez](http:\/\/www.gaspgames.com\/www.battletennis.com \"amartinez1660@gmail.com\") - Feb 2, 2010 1.\/2. Points taken! 3. That&rsquo;s quite a boost for the shadow map render and sampling (HW PCF or Ati&rsquo;s Fetch4)."},{"title":"Teach Your Effects A New Trick","link":"https:\/\/therealmjp.github.io\/posts\/teach-your-effects-a-new-trick\/","pubDate":"Mon, 19 Jan 2009 19:51:51 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/teach-your-effects-a-new-trick\/","description":"The Effects Framework is a pretty damn awesome tool.\u00a0However I&rsquo;m afraid that&rsquo;s not totally obvious to a lot of newbies, who either just don&rsquo;t what it can do or haven&rsquo;t been exposed to some of the situations where Effect&rsquo;s can really come in handy.\nOne neat thing Effect&rsquo;s can do that isn&rsquo;t obvious from the documentation or samples is auto-generate variants of shaders for you based on the value of uniform parameters."},{"title":"Fun With Compiled Content","link":"https:\/\/therealmjp.github.io\/posts\/fun-with-compiled-content\/","pubDate":"Sun, 18 Jan 2009 21:36:14 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/fun-with-compiled-content\/","description":"EDIT:\u00a0I realized it was probably a much smarter idea to just zip up the code along with the designer code and upload it somewhere.\u00a0So here it is.\nWouldn&rsquo;t it be neat to be able to have a dialog you could pop up that would show all the pre-compiled content of a certain Type, with it all listed in a nice tree showing the directory structure?\u00a0Of course it would!"},{"title":"Book Recommendation: Real-Time Collision Detection","link":"https:\/\/therealmjp.github.io\/posts\/book-recommendation-real-time-collision-detection\/","pubDate":"Sat, 17 Jan 2009 23:27:18 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/book-recommendation-real-time-collision-detection\/","description":"I just recently ordered and received Real-Time Collision Detection from Amazon, and it was worth every penny.\u00a0Collision detection was never something I was never particularly interested in, and in that past I was always willing to just leave it all up to a physics package to handle.\u00a0But as anyone else working on an XNA game for the 360 knows, a physics engine isn&rsquo;t really a practical option this time around."},{"title":"Undo and Redo: Yes you have to implement it","link":"https:\/\/therealmjp.github.io\/posts\/undo-and-redo\/","pubDate":"Fri, 19 Dec 2008 19:05:15 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/undo-and-redo\/","description":"A professional developer on the gamedev.net forums once said &ldquo;if you&rsquo;ve implemented Undo and Redo in your app, then you&rsquo;re in the top 1% of applicants for a tools developer position&rdquo;.\u00a0That&rsquo;s funny to me, because I have no idea how you could possibly have a useful tool without such a fundamental element of GUI application development.\u00a0I mean&hellip;people screw up.\u00a0It&rsquo;s nice for users to know that their mistake can go away with a single press of &ldquo;ctrl+z&rdquo;."},{"title":"LogLuv Encoding for HDR","link":"https:\/\/therealmjp.github.io\/posts\/logluv-encoding-for-hdr\/","pubDate":"Fri, 12 Dec 2008 17:00:59 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/logluv-encoding-for-hdr\/","description":"Okay so this marks the third time I&rsquo;ve posted this blog entry somewhere.\u00a0What can\u00a0I say&hellip;I like it!\u00a0I also think it&rsquo;s something useful for just about anyone trying to do HDR on the 360 through XNA, and I&rsquo;m hoping some people will stumble upon it.\nDesigning an effective and performant HDR implementation for my game&rsquo;s engine was a step that was complicated a bit by a few of the quirks of running XNA on the Xbox 360."},{"title":"Jamming to the oldies","link":"https:\/\/therealmjp.github.io\/posts\/oldies\/","pubDate":"Fri, 12 Dec 2008 16:39:21 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/oldies\/","description":"Just wanted to post some links to old blog entries from gamedev.net&hellip;\nWorking With Unicode in the Windows API\nDon&rsquo;t Cast Function Pointers (Unless You Really Know What You&rsquo;re Doing)\nPosting WM_DESTROY is *not* how you destroy a window"},{"title":"Cleared for takeoff","link":"https:\/\/therealmjp.github.io\/posts\/cleared-for-takeoff\/","pubDate":"Wed, 10 Dec 2008 21:22:13 +0000","guid":"https:\/\/therealmjp.github.io\/posts\/cleared-for-takeoff\/","description":"Look out interwebs, I have a new blog to call my own!\n*insert trumpet fanfare here*\nHere&rsquo;s what I plan on doing with it: -integrating some of the stuff I&rsquo;ve been posting on gamedev.net and xnainfo.com in one place -put up some samples\/tutorials\/tools\/code I&rsquo;ve come up with -yammer on about JumpSwitch, the Xbox 360 game I&rsquo;m working on -set up a page to show some sweet pics and vids of JumpSwitch, so everyone can see how awesome it is -post links to cool and helpful stuff I find -try to somewhat serious (not likely to happen)"}]}}