deferred rendering with masa

Posted minggoddess

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了deferred rendering with masa相关的知识,希望对你有一定的参考价值。

https://docs.nvidia.com/gameworks/content/gameworkslibrary/graphicssamples/d3d_samples/antialiaseddeferredrendering.htm

https://github.com/NVIDIAGameWorks/D3DSamples/tree/master/samples/DeferredShadingMSAA

 {

  float3 worldNormal = normalize(pixel.worldNorm);

  float viewDepth = pixel.viewDepth / 1000.0f;

   

  float3 diffuse = bTextured > 0 ? texDiffuse.Sample(textureSampler, float2(1, 1) - pixel.uv).rgb : DiffuseColor;

  float edge = coverage != 0xf;

   

  result.fragment1 = float4(worldNormal, viewDepth);

  result.fragment2 = float4(diffuse, edge);

  result.fragment3 = coverage;

}

coverage这个方法我倒是看懂了 缺点是 mesh的边缘都会被标记 实际上这里可能不需要超采样

这是另外一个方法判断 normal detph的连续性

    if(UseDiscontinuity == 1)
        {
            float4 gBuf1 = texGBufferMS1.Load(pixel.pos.xy, 0);
            float4 gBuf2 = texGBufferMS2.Load(pixel.pos.xy, 0);
            
            float3 normal = gBuf1.xyz;
            float depth = gBuf1.w;
            float3 albedo = gBuf2.xyz;
    

            [unroll]
            for(int i = 1; i < SAMPLE_COUNT; i++)
            {
                float4 nextGBuf1 = texGBufferMS1.Load(pixel.pos.xy, i);
                float4 nextGBuf2 = texGBufferMS2.Load(pixel.pos.xy, i);
                    
                float3 nextNormal = nextGBuf1.xyz;
                float nextDepth = nextGBuf1.w;
                float3 nextAlbedo = nextGBuf2.xyz;
    

                [branch]
                if(abs(depth - nextDepth) > 0.1f || abs(dot(abs(normal - nextNormal), float3(1, 1, 1))) > 0.1f || abs(dot(albedo - nextAlbedo, float3(1, 1, 1))) > 0.1f)
                {
                    clip(-0.5f);
                    return 0;
                }
            }
        }

一看就巨费 depth normal albedo大于某阈值就标记为complex pixle

用上述两种结果做光照

gbuffer 用msaa生成

但我总觉得我在哪还见过一篇 msaa+deferred的解决方案

msaa 的srv 用mstex.load(uv,sampleID) 放循环里

 

以上是关于deferred rendering with masa的主要内容,如果未能解决你的问题,请参考以下文章

Deferred shading rendering path翻译

Tutorial - Deferred Rendering Shadow Mapping 转

续 · 延迟渲染(Deferred Rendering)的前生今世

Unity渲染路径 Rendering Paths_1_Deferred Lighting 延时光照

为啥在使用`with`时会延迟`not deferable`约束?

[RxJS] Basic DOM Rendering with Subscribe