浏览代码

Code cleanup, mostly updating TODO comments.

Signed-off-by: santorac <[email protected]>
santorac 2 年之前
父节点
当前提交
bddac853a7

+ 4 - 1
Materials/Pipelines/PrototypeDeferredPipeline/DeferredMaterialPass.azsli

@@ -16,6 +16,7 @@ struct VSInput
 {
     float3 m_position : POSITION;
     float3 m_normal : NORMAL;
+    //TODO(DeferredPOC): Support tangent space and normal mapping
     //float4 m_tangent : TANGENT; 
 };
 
@@ -23,6 +24,7 @@ struct VSOutput
 {
     precise linear centroid float4 m_position : SV_Position;
     float3 m_normal: NORMAL;
+    //TODO(DeferredPOC): Support tangent space and normal mapping
     //float3 m_tangent : TANGENT; 
     float3 m_worldPosition : UV0;
 };
@@ -36,6 +38,7 @@ VSOutput MaterialVS(VSInput IN)
     adjustableVertexData.InitializeToZero();
     adjustableVertexData.positionWS = LocalSpaceToWorldSpace(IN.m_position);
     adjustableVertexData.normalLS = IN.m_normal;
+    //TODO(DeferredPOC): Support tangent space and normal mapping
     //adjustableVertexData.tangentLS = IN.m_tangent;
 
     MaterialFunction_AdjustVertexData(IN.m_position, adjustableVertexData);
@@ -44,6 +47,7 @@ VSOutput MaterialVS(VSInput IN)
     output.m_worldPosition = adjustableVertexData.positionWS;
     output.m_position = mul(ViewSrg::m_viewProjectionMatrix, float4(output.m_worldPosition, 1.0));
     output.m_normal = adjustableVertexData.normalLS;
+    //TODO(DeferredPOC): Support tangent space and normal mapping
     //output.m_tangent = adjustableVertexData.tangentLS.xyz;
 
     return output;
@@ -92,7 +96,6 @@ DeferredMaterialOutput MaterialPS(VSOutput IN)
     OUT.m_baseColor = float4(surface.baseColor, 1);
     OUT.m_roughnessMetal = float4(surface.roughnessLinear, surface.metallic, 0, 0);
     OUT.m_normal.rgb = EncodeNormalSignedOctahedron(surface.normal);
-    
     OUT.m_normal.a = EncodeUnorm2BitFlags(o_enableIBL, o_specularF0_enableMultiScatterCompensation);
 
     return OUT;

+ 5 - 9
Passes/PrototypeDeferredPipeline/DeferredLighting.azsl

@@ -43,7 +43,6 @@ ShaderResourceGroup PassSrg : SRG_PerPass
 
     Texture2D<uint4> m_tileLightData;
     StructuredBuffer<uint> m_lightListRemapped;
-    //Texture2D<float> m_linearDepthTexture;
     
     Texture2DMS<float2>   m_depthStencilTexture;
 
@@ -54,7 +53,7 @@ ShaderResourceGroup PassSrg : SRG_PerPass
 
 #define FORCE_OPAQUE 1 // Because there is no transparency in deferred, so we don't want the o_opacity_mode shader option
 
-// TODO: Figure out how to support different lighting models.
+//TODO(DeferredPOC): Support multiple lighting models, not just StandardLighting
 #include <Atom/Features/PBR/Lighting/StandardLighting.azsli>
 #include <Atom/Features/PBR/Lights/Ibl.azsli>
 #include <Atom/Features/PBR/Decals.azsli>
@@ -66,13 +65,12 @@ struct PSOutput
     float4 m_specularColor : SV_Target1;     //!< RGB = Specular Lighting, A = Unused
     float4 m_albedo : SV_Target2;            //!< RGB = Surface albedo pre-multiplied by other factors that will be multiplied later by diffuse GI, A = specularOcclusion
     float4 m_specularF0 : SV_Target3;        //!< RGB = Specular F0, A = roughness
-
-    //float4 m_normal : SV_Target4;            //!< RGB10 = EncodeNormalSignedOctahedron(worldNormal), A2 = Flags (IBL/Multiscatter enabled)
 };
 
 // Since the visual results of the deferred pipeline are (in theory) identical to the results
 // of the main pipeline, this option can be enabled to draw a watermark that confirms what
 // you are seeing is actually the deferred pipeline.
+// TODO(DeferredPOC): Make a way to turn this off by default, and only turn it on as needed for testing. Right now we don't have a way to turn it on programmatically.
 option bool o_deferredPipelineWatermark = true;
 
 PSOutput MainPS(VSOutput IN, in uint sampleIndex : SV_SampleIndex)
@@ -104,11 +102,11 @@ PSOutput MainPS(VSOutput IN, in uint sampleIndex : SV_SampleIndex)
     Surface surface;
     surface.position = surfacePosWS;
 
-    // TODO: We don't actually have the vertex normal right now
+    // TODO(DeferredPOC): We don't actually have the vertex normal, so just use the per-pixel normal for now
     surface.vertexNormal = normal;
     surface.normal = normal;
     surface.roughnessLinear = roughnessMetallic.x;
-    float specularF0Factor = 0.5f; // TODO
+    float specularF0Factor = 0.5f; // TODO(DeferredPOC): Consider passing the actual specF0 through a GBuffer
     surface.SetAlbedoAndSpecularF0(baseColor, specularF0Factor, roughnessMetallic.y);
     surface.clearCoat.InitializeToZero();
         
@@ -138,7 +136,7 @@ PSOutput MainPS(VSOutput IN, in uint sampleIndex : SV_SampleIndex)
     ApplyDirectLighting(surface, lightingData, IN.m_position);
 
     // Apply Image Based Lighting (IBL)
-    // TODO: how can we support a reflection probe in deferred?
+    // TODO(DeferredPOC): how can we support a localized reflection probe in deferred?
     ReflectionProbeData unusedReflectionProbe; 
     TextureCube unusedReflectionProbeCubeMap;
     ApplyIBL(surface, lightingData, true, false, unusedReflectionProbe, unusedReflectionProbeCubeMap);
@@ -158,7 +156,5 @@ PSOutput MainPS(VSOutput IN, in uint sampleIndex : SV_SampleIndex)
     OUT.m_specularF0 = lightingOutput.m_specularF0;
     OUT.m_albedo = lightingOutput.m_albedo;
 
-    //OUT.m_diffuseColor.xyz = float3(1,1,0); 
-
     return OUT;
 }

+ 0 - 1
Passes/PrototypeDeferredPipeline/DeferredMaterial.pass

@@ -10,7 +10,6 @@
                 // Inputs...
                 {
                     "Name": "DepthStencilInputOutput",
-                    // TODO: I don't think this needs to be InputOutput, I think it can just be an Input.
                     "SlotType": "InputOutput",
                     "ScopeAttachmentUsage": "DepthStencil"
                 },

+ 5 - 4
Passes/PrototypeDeferredPipeline/DeferredOpaqueParent.pass

@@ -71,6 +71,7 @@
                     "TemplateName": "DeferredMaterialPassTemplate",
                     "Connections": [
                         // Inputs...
+
                         // Input/Outputs...
                         {
                             "LocalSlot": "DepthStencilInputOutput",
@@ -83,10 +84,8 @@
                     "PassData": {
                         "$type": "RasterPassData",
                         "DrawListTag": "deferredMaterial",
-                        "PipelineViewTag": "MainCamera"//,
-                        //"PassSrgShaderAsset": {
-                        //    "FilePath": "Passes/PrototypeDeferredPipeline/DeferredMaterialPassSrg.shader"
-                        //}
+                        "PipelineViewTag": "MainCamera"
+                        // No PassSrgShaderAsset is needed here because the material pass only packs GBuffers, and doesn't need any per-pass resources
                     }
                 },
                 {
@@ -408,6 +407,7 @@
                         }
                     }
                 },
+                // TODO(DeferredPOC): Try to hook up subsurface scattering again
                 //{
                 //    "Name": "MSAAResolveScatterDistancePass",
                 //    "TemplateName": "MSAAResolveColorTemplate",
@@ -467,6 +467,7 @@
                                 "Pass": "MSAAResolveDiffusePass",
                                 "Attachment": "Output"
                             }
+                            // TODO(DeferredPOC): Try to hook up subsurface scattering again
                             //"AttachmentRef": {
                             //    "Pass": "SubsurfaceScatteringPass",
                             //    "Attachment": "Output"