[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=chat title="Pixel Art Games and nSight Shader Analysis" vod_platform=youtube id=Yu8k7a1hQuU annotator=Miblo]
[0:02][Welcome to the digression on pixel art games][:rendering]
[3:03][Launch Children of Morta (through Steam) and NVIDIA Nsight Graphics][:run]
[5:10][Point out the pixel art :rendering artifacts][:run]
[6:08][Create a project in Nsight for Children of Morta, with a few words on launching games through Steam][:admin :rendering]
[11:10][Launch Children of Morta standalone, and then within Nsight][:rendering :run]
[14:46][Capture our first D3D11 frame of Children of Morta and scrub through the draw events][:rendering :run]
[21:11][Swaying tree draw event: Events View][:rendering :run]
[24:25][Swaying tree draw event: API Inspector View - Input Assembler][:rendering :run]
[26:49][Swaying tree draw event: API Inspector View - Vertex Shader][:rendering :run]
[28:11][Swaying tree draw event: API Inspector View - Rasterizer][:rendering :run]
[28:59][Swaying tree draw event: API Inspector View - Pixel Shader][:rendering :run]
[30:55][Swaying tree draw event: API Inspector View - Pixel Shader Disassembly, and Resource Views][:asm :rendering :run]
[33:40][Swaying tree draw event: API Inspector View - Our tree sprite and its assembly][:asm :rendering :run]
[44:11][We got [@Molly a puss]!]
[44:55][Swaying tree draw event: API Inspector View - Understanding our tree sprite's assembly][:asm :rendering :run]
[45:43][How we may perform sub-pixel :sampling][:asm :rendering :run]
[48:57][:Sampling Pixel Art][:blackboard :rendering]
[52:38][The undesirable smearing effect of bilinear :filtering on a pixel (texel) art game][:blackboard :rendering]
[54:54][Panning with bilinear :filtering disabled][:blackboard :rendering]
[1:01:16][Zooming and unaligned panning with bilinear :filtering disabled][:blackboard :rendering]
[1:04:47][Understanding our desired filter in 1D][:blackboard :filtering :rendering]
[1:06:47][Sub-pixel filtering: Brute-force :sampling][:blackboard :filtering :rendering]
[1:08:52][Sub-pixel filtering: UV coefficient bilinear :sampling][:blackboard :filtering :rendering]
[1:20:09][Plea to Unity: Precondition your UV coordinates in the pixel shader][:blackboard :filtering :rendering :sampling]
[1:21:21][Preconditioning your UV coordinates in the pixel shader][:blackboard :filtering :rendering :sampling]
[1:55:47][@mempoedits][@handmade_hero Try "-force-glcore" for launch parameter to force OpenGL]
[1:56:24][Try unsuccessfully to launch Children of Morta in Nsight using the "force-glcore" command line argument][:admin]
[1:58:00][Capture and export a frame of Children of Morta][:rendering :run]
[2:00:54][Inspect our frame export][:admin :rendering]
[2:02:27][Q&A]
[2:03:18][@dithinas][Q: Here's a good side-by-side example of the artifacts you're talking about[ref
    site=Shadertoy
    page="fat-pixel move/scale comparison"
    url=https://www.shadertoy.com/view/ltBGWc]][:filtering :rendering :sampling]
[2:10:10][Understanding the smooth sub-pixel filtering in that Shadertoy[ref
    site=Shadertoy
    page="fat-pixel move/scale comparison"
    url=https://www.shadertoy.com/view/ltBGWc]][:filtering :rendering :research :sampling]
[2:13:39][@raf_85][Q: Children of Morta looks like a fairly ambitious game. Why do you think they didn't bother to implement proper sub-pixel :rendering?][:filtering :sampling]
[2:14:14][@xrxr13579][Q: How did you learn about this artifact / how did you figure out the cause?][:filtering :rendering :sampling]
[2:14:58][@frostyninja][Q: That Shadertoy is by our very own @d7samurai!]
[2:15:13][@omgitsmoe11][Q: Someone posted a link before saying Unity has a pixel perfect 2D package[ref
    site=Unity
    page="2D Pixel Perfect"
    url=https://docs.unity3d.com/Packages/com.unity.2d.pixel-perfect@1.0/manual/index.html]][:filtering :rendering :sampling]
[2:18:02][@gigasightmedia][@handmade_hero How much more work / is any extra work required for oblique viewing?][:filtering :rendering :sampling]
[2:18:33][@zrizi][Q: (Off-topic) How is Pow function implemented? How would you go about implementing an efficient power?[ref
    site="SLEEF Vectorized Math Library"
    url=https://sleef.org/]][:mathematics]
[2:23:38][@zrizi][Q: I thought for cosine and sine we would use a table lookup (instead of series expansion), isn't it?][:mathematics]
[2:27:10][@longboolean][Q: Is there ever a reason not to compute your pixels this way? Is this a 2D only thing, etc?][:filtering :rendering :sampling]
[2:27:50][@xrxr13579][Q: It seems that this artifact is quite well known, at least in your circle. Is there a name for it?][:filtering :rendering :sampling]
[2:29:12][@gigasightmedia][@handmade_hero: This shader can only address artifacting within the texture, but cannot address sub-pixel occlusion artifacting (i.e. the shimmer is still present on exterior edge pixels)][:filtering :rendering :sampling]
[2:30:23][@Brian][Q: It was surprising to see how much latency was on division. Square root seems to have a similar latency, but reciprocal square root (i.e. _mm_rsqrt_ps) is as quick as multiply (with just half the throughput). Why is rsqrt much faster than regular sqrt?[ref
    site=Intel
    page="Intel Intrinsics Guide"
    url=https://software.intel.com/sites/landingpage/IntrinsicsGuide/]][:mathematics :performance]
[2:32:54][@Brian][Q: Is there a less precise version of sqrt then? Because a lot of the math we need in games does not need the full precision][:mathematics]
[2:33:34][@ponkkiz][Q: Could you do something similar inspecting some Unreal Engine 4 game and end the engine war for good?][:filtering :rendering :sampling]
[2:34:23][@gigasightmedia][@handmade_hero: So the artifacting still present here is because there is no border-pixel? If the texture were prepared properly, it would address that as well[ref
    site=Shadertoy
    page="fat-pixel move/scale comparison"
    url=https://www.shadertoy.com/view/ltBGWc]][:filtering :rendering :sampling]
[2:38:24][Wrap it up]
[/video]
