Merge pull request #725 from aws-lumberyard-dev/Atom/antonmic/lowEnd
Implemented Atom Low End Render Pipeline
This commit is contained in:
@@ -1199,6 +1199,14 @@
|
||||
"file": "./StandardPBR_ForwardPass_EDS.shader",
|
||||
"tag": "ForwardPass_EDS"
|
||||
},
|
||||
{
|
||||
"file": "./StandardPBR_LowEndForward.shader",
|
||||
"tag": "LowEndForward"
|
||||
},
|
||||
{
|
||||
"file": "./StandardPBR_LowEndForward_EDS.shader",
|
||||
"tag": "LowEndForward_EDS"
|
||||
},
|
||||
{
|
||||
"file": "Shaders/Shadow/Shadowmap.shader",
|
||||
"tag": "Shadowmap"
|
||||
@@ -1289,10 +1297,6 @@
|
||||
"textureProperty": "baseColor.textureMap",
|
||||
"useTextureProperty": "baseColor.useTexture",
|
||||
"dependentProperties": ["baseColor.textureMapUv", "baseColor.textureBlendMode"],
|
||||
"shaderTags": [
|
||||
"ForwardPass",
|
||||
"ForwardPass_EDS"
|
||||
],
|
||||
"shaderOption": "o_baseColor_useTexture"
|
||||
}
|
||||
},
|
||||
@@ -1302,10 +1306,6 @@
|
||||
"textureProperty": "metallic.textureMap",
|
||||
"useTextureProperty": "metallic.useTexture",
|
||||
"dependentProperties": ["metallic.textureMapUv"],
|
||||
"shaderTags": [
|
||||
"ForwardPass",
|
||||
"ForwardPass_EDS"
|
||||
],
|
||||
"shaderOption": "o_metallic_useTexture"
|
||||
}
|
||||
},
|
||||
@@ -1315,10 +1315,6 @@
|
||||
"textureProperty": "specularF0.textureMap",
|
||||
"useTextureProperty": "specularF0.useTexture",
|
||||
"dependentProperties": ["specularF0.textureMapUv"],
|
||||
"shaderTags": [
|
||||
"ForwardPass",
|
||||
"ForwardPass_EDS"
|
||||
],
|
||||
"shaderOption": "o_specularF0_useTexture"
|
||||
}
|
||||
},
|
||||
@@ -1328,10 +1324,6 @@
|
||||
"textureProperty": "normal.textureMap",
|
||||
"useTextureProperty": "normal.useTexture",
|
||||
"dependentProperties": ["normal.textureMapUv", "normal.factor", "normal.flipX", "normal.flipY"],
|
||||
"shaderTags": [
|
||||
"ForwardPass",
|
||||
"ForwardPass_EDS"
|
||||
],
|
||||
"shaderOption": "o_normal_useTexture"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Atom/Features/ShaderQualityOptions.azsli"
|
||||
|
||||
#include "StandardPBR_Common.azsli"
|
||||
|
||||
// SRGs
|
||||
@@ -317,13 +319,18 @@ ForwardPassOutputWithDepth StandardPbr_ForwardPassPS(VSOutput IN, bool isFrontFa
|
||||
|
||||
PbrLightingOutput lightingOutput = ForwardPassPS_Common(IN, isFrontFace, depth);
|
||||
|
||||
#ifdef UNIFIED_FORWARD_OUTPUT
|
||||
OUT.m_color.rgb = lightingOutput.m_diffuseColor.rgb + lightingOutput.m_specularColor.rgb;
|
||||
OUT.m_color.a = lightingOutput.m_diffuseColor.a;
|
||||
OUT.m_depth = depth;
|
||||
#else
|
||||
OUT.m_diffuseColor = lightingOutput.m_diffuseColor;
|
||||
OUT.m_specularColor = lightingOutput.m_specularColor;
|
||||
OUT.m_specularF0 = lightingOutput.m_specularF0;
|
||||
OUT.m_albedo = lightingOutput.m_albedo;
|
||||
OUT.m_normal = lightingOutput.m_normal;
|
||||
OUT.m_depth = depth;
|
||||
|
||||
#endif
|
||||
return OUT;
|
||||
}
|
||||
|
||||
@@ -335,12 +342,16 @@ ForwardPassOutput StandardPbr_ForwardPassPS_EDS(VSOutput IN, bool isFrontFace :
|
||||
|
||||
PbrLightingOutput lightingOutput = ForwardPassPS_Common(IN, isFrontFace, depth);
|
||||
|
||||
#ifdef UNIFIED_FORWARD_OUTPUT
|
||||
OUT.m_color.rgb = lightingOutput.m_diffuseColor.rgb + lightingOutput.m_specularColor.rgb;
|
||||
OUT.m_color.a = lightingOutput.m_diffuseColor.a;
|
||||
#else
|
||||
OUT.m_diffuseColor = lightingOutput.m_diffuseColor;
|
||||
OUT.m_specularColor = lightingOutput.m_specularColor;
|
||||
OUT.m_specularF0 = lightingOutput.m_specularF0;
|
||||
OUT.m_albedo = lightingOutput.m_albedo;
|
||||
OUT.m_normal = lightingOutput.m_normal;
|
||||
|
||||
#endif
|
||||
return OUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
// NOTE: This file is a temporary workaround until .shader files can #define macros for their .azsl files
|
||||
|
||||
#define QUALITY_LOW_END 1
|
||||
|
||||
#include "StandardPBR_ForwardPass.azsl"
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
// Note: "LowEnd" shaders are for supporting the low end pipeline
|
||||
// These shaders can be safely added to materials without incurring additional runtime draw
|
||||
// items as draw items for shaders are only created if the scene has a pass with a matching
|
||||
// DrawListTag. If your pipeline doesn't have a "lowEndForward" DrawListTag, no draw items
|
||||
// for this shader will be created.
|
||||
|
||||
"Source" : "./StandardPBR_LowEndForward.azsl",
|
||||
|
||||
"DepthStencilState" :
|
||||
{
|
||||
"Depth" :
|
||||
{
|
||||
"Enable" : true,
|
||||
"CompareFunc" : "GreaterEqual"
|
||||
},
|
||||
"Stencil" :
|
||||
{
|
||||
"Enable" : true,
|
||||
"ReadMask" : "0x00",
|
||||
"WriteMask" : "0xFF",
|
||||
"FrontFace" :
|
||||
{
|
||||
"Func" : "Always",
|
||||
"DepthFailOp" : "Keep",
|
||||
"FailOp" : "Keep",
|
||||
"PassOp" : "Replace"
|
||||
},
|
||||
"BackFace" :
|
||||
{
|
||||
"Func" : "Always",
|
||||
"DepthFailOp" : "Keep",
|
||||
"FailOp" : "Keep",
|
||||
"PassOp" : "Replace"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"CompilerHints" : {
|
||||
"DisableOptimizations" : false
|
||||
},
|
||||
|
||||
"ProgramSettings":
|
||||
{
|
||||
"EntryPoints":
|
||||
[
|
||||
{
|
||||
"name": "StandardPbr_ForwardPassVS",
|
||||
"type": "Vertex"
|
||||
},
|
||||
{
|
||||
"name": "StandardPbr_ForwardPassPS",
|
||||
"type": "Fragment"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"DrawList" : "lowEndForward"
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
// Note: "LowEnd" shaders are for supporting the low end pipeline
|
||||
// These shaders can be safely added to materials without incurring additional runtime draw
|
||||
// items as draw items for shaders are only created if the scene has a pass with a matching
|
||||
// DrawListTag. If your pipeline doesn't have a "lowEndForward" DrawListTag, no draw items
|
||||
// for this shader will be created.
|
||||
|
||||
"Source" : "./StandardPBR_LowEndForward.azsl",
|
||||
|
||||
"DepthStencilState" :
|
||||
{
|
||||
"Depth" :
|
||||
{
|
||||
"Enable" : true,
|
||||
"CompareFunc" : "GreaterEqual"
|
||||
},
|
||||
"Stencil" :
|
||||
{
|
||||
"Enable" : true,
|
||||
"ReadMask" : "0x00",
|
||||
"WriteMask" : "0xFF",
|
||||
"FrontFace" :
|
||||
{
|
||||
"Func" : "Always",
|
||||
"DepthFailOp" : "Keep",
|
||||
"FailOp" : "Keep",
|
||||
"PassOp" : "Replace"
|
||||
},
|
||||
"BackFace" :
|
||||
{
|
||||
"Func" : "Always",
|
||||
"DepthFailOp" : "Keep",
|
||||
"FailOp" : "Keep",
|
||||
"PassOp" : "Replace"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"CompilerHints" : {
|
||||
"DisableOptimizations" : false
|
||||
},
|
||||
|
||||
"ProgramSettings":
|
||||
{
|
||||
"EntryPoints":
|
||||
[
|
||||
{
|
||||
"name": "StandardPbr_ForwardPassVS",
|
||||
"type": "Vertex"
|
||||
},
|
||||
{
|
||||
"name": "StandardPbr_ForwardPassPS_EDS",
|
||||
"type": "Fragment"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"DrawList" : "lowEndForward"
|
||||
}
|
||||
@@ -29,26 +29,33 @@ function Process(context)
|
||||
local depthPass = context:GetShaderByTag("DepthPass")
|
||||
local shadowMap = context:GetShaderByTag("Shadowmap")
|
||||
local forwardPassEDS = context:GetShaderByTag("ForwardPass_EDS")
|
||||
local lowEndForwardEDS = context:GetShaderByTag("LowEndForward_EDS")
|
||||
|
||||
local depthPassWithPS = context:GetShaderByTag("DepthPass_WithPS")
|
||||
local shadowMapWitPS = context:GetShaderByTag("Shadowmap_WithPS")
|
||||
local forwardPass = context:GetShaderByTag("ForwardPass")
|
||||
local lowEndForward = context:GetShaderByTag("LowEndForward")
|
||||
|
||||
if parallaxEnabled and parallaxPdoEnabled then
|
||||
depthPass:SetEnabled(false)
|
||||
shadowMap:SetEnabled(false)
|
||||
forwardPassEDS:SetEnabled(false)
|
||||
lowEndForwardEDS:SetEnabled(false)
|
||||
|
||||
depthPassWithPS:SetEnabled(true)
|
||||
shadowMapWitPS:SetEnabled(true)
|
||||
forwardPass:SetEnabled(true)
|
||||
lowEndForward:SetEnabled(true)
|
||||
else
|
||||
depthPass:SetEnabled(opacityMode == OpacityMode_Opaque)
|
||||
shadowMap:SetEnabled(opacityMode == OpacityMode_Opaque)
|
||||
forwardPassEDS:SetEnabled((opacityMode == OpacityMode_Opaque) or (opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
|
||||
lowEndForwardEDS:SetEnabled((opacityMode == OpacityMode_Opaque) or (opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
|
||||
|
||||
depthPassWithPS:SetEnabled(opacityMode == OpacityMode_Cutout)
|
||||
shadowMapWitPS:SetEnabled(opacityMode == OpacityMode_Cutout)
|
||||
forwardPass:SetEnabled(opacityMode == OpacityMode_Cutout)
|
||||
lowEndForward:SetEnabled(opacityMode == OpacityMode_Cutout)
|
||||
end
|
||||
|
||||
context:GetShaderByTag("DepthPassTransparentMin"):SetEnabled((opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
|
||||
|
||||
@@ -148,22 +148,6 @@
|
||||
},
|
||||
"LoadAction": "Clear"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "ScatterDistanceOutput",
|
||||
"SlotType": "Output",
|
||||
"ScopeAttachmentUsage": "RenderTarget",
|
||||
"LoadStoreAction": {
|
||||
"ClearValue": {
|
||||
"Value": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"LoadAction": "Clear"
|
||||
}
|
||||
}
|
||||
],
|
||||
"ImageAttachments": [
|
||||
@@ -238,19 +222,6 @@
|
||||
"AssetRef": {
|
||||
"FilePath": "Textures/BRDFTexture.attimage"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "ScatterDistanceImage",
|
||||
"SizeSource": {
|
||||
"Source": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
},
|
||||
"ImageDescriptor": {
|
||||
"Format": "R11G11B10_FLOAT",
|
||||
"SharedQueueMask": "Graphics"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Connections": [
|
||||
@@ -295,13 +266,6 @@
|
||||
"Pass": "This",
|
||||
"Attachment": "BRDFTexture"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "ScatterDistanceOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "This",
|
||||
"Attachment": "ScatterDistanceImage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
{
|
||||
"Type": "JsonSerialization",
|
||||
"Version": 1,
|
||||
"ClassName": "PassAsset",
|
||||
"ClassData": {
|
||||
"PassTemplate": {
|
||||
"Name": "LightAdaptationParentTemplate",
|
||||
"PassClass": "ParentPass",
|
||||
"Slots": [
|
||||
// Inputs...
|
||||
{
|
||||
"Name": "LightingInput",
|
||||
"SlotType": "Input"
|
||||
},
|
||||
// SwapChain here is only used to reference the frame height and format
|
||||
{
|
||||
"Name": "SwapChainOutput",
|
||||
"SlotType": "InputOutput"
|
||||
},
|
||||
// Outputs...
|
||||
{
|
||||
"Name": "Output",
|
||||
"SlotType": "Output"
|
||||
},
|
||||
// Debug Outputs...
|
||||
{
|
||||
"Name": "LuminanceMipChainOutput",
|
||||
"SlotType": "Output"
|
||||
}
|
||||
],
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Output",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DisplayMapperPass",
|
||||
"Attachment": "Output"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "LuminanceMipChainOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DownsampleLuminanceMipChain",
|
||||
"Attachment": "MipChainInputOutput"
|
||||
}
|
||||
}
|
||||
],
|
||||
"PassRequests": [
|
||||
{
|
||||
"Name": "DownsampleLuminanceMinAvgMax",
|
||||
"TemplateName": "DownsampleLuminanceMinAvgMaxCS",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Input",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "LightingInput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "DownsampleLuminanceMipChain",
|
||||
"TemplateName": "DownsampleMipChainTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "MipChainInputOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DownsampleLuminanceMinAvgMax",
|
||||
"Attachment": "Output"
|
||||
}
|
||||
}
|
||||
],
|
||||
"PassData": {
|
||||
"$type": "DownsampleMipChainPassData",
|
||||
"ShaderAsset": {
|
||||
"FilePath": "Shaders/PostProcessing/DownsampleMinAvgMaxCS.shader"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "EyeAdaptationPass",
|
||||
"TemplateName": "EyeAdaptationTemplate",
|
||||
"Enabled": false,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "SceneLuminanceInput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DownsampleLuminanceMipChain",
|
||||
"Attachment": "MipChainInputOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "LookModificationTransformPass",
|
||||
"TemplateName": "LookModificationTransformTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Input",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "LightingInput"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "EyeAdaptationDataInput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "EyeAdaptationPass",
|
||||
"Attachment": "EyeAdaptationDataInputOutput"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "SwapChainOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "DisplayMapperPass",
|
||||
"TemplateName": "DisplayMapperTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Input",
|
||||
"AttachmentRef": {
|
||||
"Pass": "LookModificationTransformPass",
|
||||
"Attachment": "Output"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "SwapChainOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"Type": "JsonSerialization",
|
||||
"Version": 1,
|
||||
"ClassName": "PassAsset",
|
||||
"ClassData": {
|
||||
"PassTemplate": {
|
||||
"Name": "LowEndForwardPassTemplate",
|
||||
"PassClass": "RasterPass",
|
||||
"Slots": [
|
||||
// Inputs...
|
||||
{
|
||||
"Name": "BRDFTextureInput",
|
||||
"ShaderInputName": "m_brdfMap",
|
||||
"SlotType": "Input",
|
||||
"ScopeAttachmentUsage": "Shader"
|
||||
},
|
||||
{
|
||||
"Name": "DirectionalLightShadowmap",
|
||||
"ShaderInputName": "m_directionalLightShadowmap",
|
||||
"SlotType": "Input",
|
||||
"ScopeAttachmentUsage": "Shader",
|
||||
"ImageViewDesc": {
|
||||
"IsArray": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "ExponentialShadowmapDirectional",
|
||||
"ShaderInputName": "m_directionalLightExponentialShadowmap",
|
||||
"SlotType": "Input",
|
||||
"ScopeAttachmentUsage": "Shader",
|
||||
"ImageViewDesc": {
|
||||
"IsArray": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "ProjectedShadowmap",
|
||||
"ShaderInputName": "m_projectedShadowmaps",
|
||||
"SlotType": "Input",
|
||||
"ScopeAttachmentUsage": "Shader",
|
||||
"ImageViewDesc": {
|
||||
"IsArray": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "ExponentialShadowmapProjected",
|
||||
"ShaderInputName": "m_projectedExponentialShadowmap",
|
||||
"SlotType": "Input",
|
||||
"ScopeAttachmentUsage": "Shader",
|
||||
"ImageViewDesc": {
|
||||
"IsArray": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "TileLightData",
|
||||
"SlotType": "Input",
|
||||
"ShaderInputName": "m_tileLightData",
|
||||
"ScopeAttachmentUsage": "Shader"
|
||||
},
|
||||
{
|
||||
"Name": "LightListRemapped",
|
||||
"SlotType": "Input",
|
||||
"ShaderInputName": "m_lightListRemapped",
|
||||
"ScopeAttachmentUsage": "Shader"
|
||||
},
|
||||
// Input/Outputs...
|
||||
{
|
||||
"Name": "DepthStencilInputOutput",
|
||||
"SlotType": "InputOutput",
|
||||
"ScopeAttachmentUsage": "DepthStencil"
|
||||
},
|
||||
// Outputs...
|
||||
{
|
||||
"Name": "LightingOutput",
|
||||
"SlotType": "Output",
|
||||
"ScopeAttachmentUsage": "RenderTarget",
|
||||
"LoadStoreAction": {
|
||||
"ClearValue": {
|
||||
"Value": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"LoadAction": "Clear"
|
||||
}
|
||||
}
|
||||
],
|
||||
"ImageAttachments": [
|
||||
{
|
||||
"Name": "LightingAttachment",
|
||||
"SizeSource": {
|
||||
"Source": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
},
|
||||
"MultisampleSource": {
|
||||
"Pass": "This",
|
||||
"Attachment": "DepthStencilInputOutput"
|
||||
},
|
||||
"ImageDescriptor": {
|
||||
"Format": "R16G16B16A16_FLOAT",
|
||||
"SharedQueueMask": "Graphics"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "BRDFTexture",
|
||||
"Lifetime": "Imported",
|
||||
"AssetRef": {
|
||||
"FilePath": "Textures/BRDFTexture.attimage"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "LightingOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "This",
|
||||
"Attachment": "LightingAttachment"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "BRDFTextureInput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "This",
|
||||
"Attachment": "BRDFTexture"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
{
|
||||
"Type": "JsonSerialization",
|
||||
"Version": 1,
|
||||
"ClassName": "PassAsset",
|
||||
"ClassData": {
|
||||
"PassTemplate": {
|
||||
"Name": "LowEndPipelineTemplate",
|
||||
"PassClass": "ParentPass",
|
||||
"Slots": [
|
||||
{
|
||||
"Name": "SwapChainOutput",
|
||||
"SlotType": "InputOutput",
|
||||
"ScopeAttachmentUsage": "RenderTarget"
|
||||
}
|
||||
],
|
||||
"PassRequests": [
|
||||
{
|
||||
"Name": "MorphTargetPass",
|
||||
"TemplateName": "MorphTargetPassTemplate"
|
||||
},
|
||||
{
|
||||
"Name": "SkinningPass",
|
||||
"TemplateName": "SkinningPassTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "SkinnedMeshOutputStream",
|
||||
"AttachmentRef": {
|
||||
"Pass": "MorphTargetPass",
|
||||
"Attachment": "MorphTargetDeltaOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "DepthPrePass",
|
||||
"TemplateName": "DepthMSAAParentTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "SkinnedMeshes",
|
||||
"AttachmentRef": {
|
||||
"Pass": "SkinningPass",
|
||||
"Attachment": "SkinnedMeshOutputStream"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "SwapChainOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "LightCullingPass",
|
||||
"TemplateName": "LightCullingParentTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "SkinnedMeshes",
|
||||
"AttachmentRef": {
|
||||
"Pass": "SkinningPass",
|
||||
"Attachment": "SkinnedMeshOutputStream"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "DepthMSAA",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DepthPrePass",
|
||||
"Attachment": "DepthMSAA"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "SwapChainOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "ShadowPass",
|
||||
"TemplateName": "ShadowParentTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "SkinnedMeshes",
|
||||
"AttachmentRef": {
|
||||
"Pass": "SkinningPass",
|
||||
"Attachment": "SkinnedMeshOutputStream"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "SwapChainOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "ForwardPass",
|
||||
"TemplateName": "LowEndForwardPassTemplate",
|
||||
"Connections": [
|
||||
// Inputs...
|
||||
{
|
||||
"LocalSlot": "DirectionalLightShadowmap",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ShadowPass",
|
||||
"Attachment": "DirectionalShadowmap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "ExponentialShadowmapDirectional",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ShadowPass",
|
||||
"Attachment": "DirectionalESM"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "ProjectedShadowmap",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ShadowPass",
|
||||
"Attachment": "ProjectedShadowmap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "ExponentialShadowmapProjected",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ShadowPass",
|
||||
"Attachment": "ProjectedESM"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "TileLightData",
|
||||
"AttachmentRef": {
|
||||
"Pass": "LightCullingPass",
|
||||
"Attachment": "TileLightData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "LightListRemapped",
|
||||
"AttachmentRef": {
|
||||
"Pass": "LightCullingPass",
|
||||
"Attachment": "LightListRemapped"
|
||||
}
|
||||
},
|
||||
// Input/Outputs...
|
||||
{
|
||||
"LocalSlot": "DepthStencilInputOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DepthPrePass",
|
||||
"Attachment": "DepthMSAA"
|
||||
}
|
||||
}
|
||||
],
|
||||
"PassData": {
|
||||
"$type": "RasterPassData",
|
||||
"DrawListTag": "lowEndForward",
|
||||
"PipelineViewTag": "MainCamera",
|
||||
"PassSrgAsset": {
|
||||
"FilePath": "shaderlib/atom/features/pbr/forwardpasssrg.azsli:PassSrg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SkyBoxPass",
|
||||
"TemplateName": "SkyBoxTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "SpecularInputOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ForwardPass",
|
||||
"Attachment": "LightingOutput"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "SkyBoxDepth",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ForwardPass",
|
||||
"Attachment": "DepthStencilInputOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "MSAAResolvePass",
|
||||
"TemplateName": "MSAAResolveColorTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Input",
|
||||
"AttachmentRef": {
|
||||
"Pass": "SkyBoxPass",
|
||||
"Attachment": "SpecularInputOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "TransparentPass",
|
||||
"TemplateName": "TransparentParentTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "DirectionalShadowmap",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ShadowPass",
|
||||
"Attachment": "DirectionalShadowmap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "DirectionalESM",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ShadowPass",
|
||||
"Attachment": "DirectionalESM"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "ProjectedShadowmap",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ShadowPass",
|
||||
"Attachment": "ProjectedShadowmap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "ProjectedESM",
|
||||
"AttachmentRef": {
|
||||
"Pass": "ShadowPass",
|
||||
"Attachment": "ProjectedESM"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "TileLightData",
|
||||
"AttachmentRef": {
|
||||
"Pass": "LightCullingPass",
|
||||
"Attachment": "TileLightData"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "LightListRemapped",
|
||||
"AttachmentRef": {
|
||||
"Pass": "LightCullingPass",
|
||||
"Attachment": "LightListRemapped"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "DepthStencil",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DepthPrePass",
|
||||
"Attachment": "Depth"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "InputOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "MSAAResolvePass",
|
||||
"Attachment": "Output"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "LightAdaptation",
|
||||
"TemplateName": "LightAdaptationParentTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "LightingInput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "TransparentPass",
|
||||
"Attachment": "InputOutput"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "SwapChainOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "AuxGeomPass",
|
||||
"TemplateName": "AuxGeomPassTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "ColorInputOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "LightAdaptation",
|
||||
"Attachment": "Output"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "DepthInputOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DepthPrePass",
|
||||
"Attachment": "Depth"
|
||||
}
|
||||
}
|
||||
],
|
||||
"PassData": {
|
||||
"$type": "RasterPassData",
|
||||
"DrawListTag": "auxgeom",
|
||||
"PipelineViewTag": "MainCamera"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "UIPass",
|
||||
"TemplateName": "UIParentTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "InputOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "AuxGeomPass",
|
||||
"Attachment": "ColorInputOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "CopyToSwapChain",
|
||||
"TemplateName": "FullscreenCopyTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Input",
|
||||
"AttachmentRef": {
|
||||
"Pass": "UIPass",
|
||||
"Attachment": "InputOutput"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "Output",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@
|
||||
},
|
||||
{
|
||||
"Name": "SkyBoxPass",
|
||||
"TemplateName": "SkyBoxTemplate",
|
||||
"TemplateName": "SkyBoxTwoOutputsTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
|
||||
@@ -92,6 +92,10 @@
|
||||
"Name": "SkyBoxTemplate",
|
||||
"Path": "Passes/SkyBox.pass"
|
||||
},
|
||||
{
|
||||
"Name": "SkyBoxTwoOutputsTemplate",
|
||||
"Path": "Passes/SkyBox_TwoOutputs.pass"
|
||||
},
|
||||
{
|
||||
"Name": "UIPassTemplate",
|
||||
"Path": "Passes/UI.pass"
|
||||
@@ -483,6 +487,18 @@
|
||||
{
|
||||
"Name": "UIParentTemplate",
|
||||
"Path": "Passes/UIParent.pass"
|
||||
},
|
||||
{
|
||||
"Name": "LightAdaptationParentTemplate",
|
||||
"Path": "Passes/LightAdaptationParent.pass"
|
||||
},
|
||||
{
|
||||
"Name": "LowEndForwardPassTemplate",
|
||||
"Path": "Passes/LowEndForward.pass"
|
||||
},
|
||||
{
|
||||
"Name": "LowEndPipelineTemplate",
|
||||
"Path": "Passes/LowEndPipeline.pass"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
{
|
||||
"LocalSlot": "Output",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DisplayMapperPass",
|
||||
"Pass": "LightAdaptation",
|
||||
"Attachment": "Output"
|
||||
}
|
||||
},
|
||||
@@ -54,8 +54,8 @@
|
||||
{
|
||||
"LocalSlot": "LuminanceMipChainOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DownsampleLuminanceMipChain",
|
||||
"Attachment": "MipChainInputOutput"
|
||||
"Pass": "LightAdaptation",
|
||||
"Attachment": "LuminanceMipChainOutput"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -115,94 +115,16 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
// Everything before this point deals in raw lighting values
|
||||
// ---------------------------------------------------------
|
||||
// Everything after starts to map to values we see on screen
|
||||
{
|
||||
"Name": "DownsampleLuminanceMinAvgMax",
|
||||
"TemplateName": "DownsampleLuminanceMinAvgMaxCS",
|
||||
"Name": "LightAdaptation",
|
||||
"TemplateName": "LightAdaptationParentTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Input",
|
||||
"LocalSlot": "LightingInput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "BloomPass",
|
||||
"Attachment": "InputOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "DownsampleLuminanceMipChain",
|
||||
"TemplateName": "DownsampleMipChainTemplate",
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "MipChainInputOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DownsampleLuminanceMinAvgMax",
|
||||
"Attachment": "Output"
|
||||
}
|
||||
}
|
||||
],
|
||||
"PassData": {
|
||||
"$type": "DownsampleMipChainPassData",
|
||||
"ShaderAsset": {
|
||||
"FilePath": "Shaders/PostProcessing/DownsampleMinAvgMaxCS.shader"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "EyeAdaptationPass",
|
||||
"TemplateName": "EyeAdaptationTemplate",
|
||||
"Enabled": false,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "SceneLuminanceInput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "DownsampleLuminanceMipChain",
|
||||
"Attachment": "MipChainInputOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "LookModificationTransformPass",
|
||||
"TemplateName": "LookModificationTransformTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Input",
|
||||
"AttachmentRef": {
|
||||
"Pass": "BloomPass",
|
||||
"Attachment": "InputOutput"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "EyeAdaptationDataInput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "EyeAdaptationPass",
|
||||
"Attachment": "EyeAdaptationDataInputOutput"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "SwapChainOutput",
|
||||
"AttachmentRef": {
|
||||
"Pass": "Parent",
|
||||
"Attachment": "SwapChainOutput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "DisplayMapperPass",
|
||||
"TemplateName": "DisplayMapperTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Input",
|
||||
"AttachmentRef": {
|
||||
"Pass": "LookModificationTransformPass",
|
||||
"Attachment": "Output"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "SwapChainOutput",
|
||||
|
||||
@@ -12,11 +12,6 @@
|
||||
"SlotType": "InputOutput",
|
||||
"ScopeAttachmentUsage": "RenderTarget"
|
||||
},
|
||||
{
|
||||
"Name": "ReflectionInputOutput",
|
||||
"SlotType": "InputOutput",
|
||||
"ScopeAttachmentUsage": "RenderTarget"
|
||||
},
|
||||
{
|
||||
"Name": "SkyBoxDepth",
|
||||
"SlotType": "InputOutput",
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"Type": "JsonSerialization",
|
||||
"Version": 1,
|
||||
"ClassName": "PassAsset",
|
||||
"ClassData": {
|
||||
"PassTemplate": {
|
||||
"Name": "SkyBoxTwoOutputsTemplate",
|
||||
"PassClass": "FullScreenTriangle",
|
||||
"Slots": [
|
||||
{
|
||||
"Name": "SpecularInputOutput",
|
||||
"SlotType": "InputOutput",
|
||||
"ScopeAttachmentUsage": "RenderTarget"
|
||||
},
|
||||
{
|
||||
"Name": "ReflectionInputOutput",
|
||||
"SlotType": "InputOutput",
|
||||
"ScopeAttachmentUsage": "RenderTarget"
|
||||
},
|
||||
{
|
||||
"Name": "SkyBoxDepth",
|
||||
"SlotType": "InputOutput",
|
||||
"ScopeAttachmentUsage": "DepthStencil"
|
||||
}
|
||||
],
|
||||
"PassData": {
|
||||
"$type": "FullscreenTrianglePassData",
|
||||
"ShaderAsset": {
|
||||
"FilePath": "shaders/skybox/skybox_twooutputs.shader"
|
||||
},
|
||||
"PipelineViewTag": "MainCamera",
|
||||
"ShaderDataMappings": {
|
||||
"FloatMappings": [
|
||||
{
|
||||
"Name": "m_sunIntensityMultiplier",
|
||||
"Value": 1.0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,21 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef UNIFIED_FORWARD_OUTPUT
|
||||
|
||||
struct ForwardPassOutput
|
||||
{
|
||||
float4 m_color : SV_Target0;
|
||||
};
|
||||
|
||||
struct ForwardPassOutputWithDepth
|
||||
{
|
||||
float4 m_color : SV_Target0;
|
||||
float m_depth : SV_Depth;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
struct ForwardPassOutput
|
||||
{
|
||||
float4 m_diffuseColor : SV_Target0; //!< RGB = Diffuse Lighting, A = Blend Alpha (for blended surfaces) OR A = special encoding of surfaceScatteringFactor, m_subsurfaceScatteringQuality, o_enableSubsurfaceScattering
|
||||
@@ -30,3 +45,5 @@ struct ForwardPassOutputWithDepth
|
||||
float4 m_normal : SV_Target4;
|
||||
float m_depth : SV_Depth;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,38 +12,39 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// --- Static Options Available ---
|
||||
// FORCE_IBL_IN_FORWARD_PASS - forces IBL lighting to be run in the forward pass, used in pipelines that don't have a reflection pass
|
||||
|
||||
#include <Atom/Features/PBR/LightingOptions.azsli>
|
||||
|
||||
#include <Atom/RPI/Math.azsli>
|
||||
#include <Atom/Features/PBR/Lights/LightTypesCommon.azsli>
|
||||
#include <Atom/Features/PBR/LightingUtils.azsli>
|
||||
|
||||
void ApplyIblDiffuse(
|
||||
float3 GetIblDiffuse(
|
||||
float3 normal,
|
||||
float3 albedo,
|
||||
float3 diffuseResponse,
|
||||
out float3 outDiffuse)
|
||||
float3 diffuseResponse)
|
||||
{
|
||||
float3 irradianceDir = MultiplyVectorQuaternion(normal, SceneSrg::m_iblOrientation);
|
||||
float3 diffuseSample = SceneSrg::m_diffuseEnvMap.Sample(SceneSrg::m_samplerEnv, GetCubemapCoords(irradianceDir)).rgb;
|
||||
|
||||
outDiffuse = diffuseResponse * albedo * diffuseSample;
|
||||
return diffuseResponse * albedo * diffuseSample;
|
||||
}
|
||||
|
||||
void ApplyIblSpecular(
|
||||
float3 GetIblSpecular(
|
||||
float3 position,
|
||||
float3 normal,
|
||||
float3 specularF0,
|
||||
float roughnessLinear,
|
||||
float3 dirToCamera,
|
||||
float2 brdf,
|
||||
out float3 outSpecular)
|
||||
float2 brdf)
|
||||
{
|
||||
float3 reflectDir = reflect(-dirToCamera, normal);
|
||||
reflectDir = MultiplyVectorQuaternion(reflectDir, SceneSrg::m_iblOrientation);
|
||||
|
||||
// global
|
||||
outSpecular = SceneSrg::m_specularEnvMap.SampleLevel(SceneSrg::m_samplerEnv, GetCubemapCoords(reflectDir), GetRoughnessMip(roughnessLinear)).rgb;
|
||||
float3 outSpecular = SceneSrg::m_specularEnvMap.SampleLevel(SceneSrg::m_samplerEnv, GetCubemapCoords(reflectDir), GetRoughnessMip(roughnessLinear)).rgb;
|
||||
outSpecular *= (specularF0 * brdf.x + brdf.y);
|
||||
|
||||
// reflection probe
|
||||
@@ -72,86 +73,55 @@ void ApplyIblSpecular(
|
||||
|
||||
outSpecular = lerp(outSpecular, probeSpecular, blendAmount);
|
||||
}
|
||||
return outSpecular;
|
||||
}
|
||||
|
||||
void ApplyIBL(Surface surface, inout LightingData lightingData)
|
||||
{
|
||||
if (o_opacity_mode == OpacityMode::Blended || o_opacity_mode == OpacityMode::TintedTransparent)
|
||||
#ifdef FORCE_IBL_IN_FORWARD_PASS
|
||||
bool useDiffuseIbl = true;
|
||||
bool useSpecularIbl = true;
|
||||
bool useIbl = o_enableIBL;
|
||||
#else
|
||||
bool isTransparent = (o_opacity_mode == OpacityMode::Blended || o_opacity_mode == OpacityMode::TintedTransparent);
|
||||
bool useDiffuseIbl = isTransparent;
|
||||
bool useSpecularIbl = (isTransparent || o_meshUseForwardPassIBLSpecular || o_materialUseForwardPassIBLSpecular);
|
||||
bool useIbl = o_enableIBL && (useDiffuseIbl || useSpecularIbl);
|
||||
#endif
|
||||
|
||||
if(useIbl)
|
||||
{
|
||||
// transparencies currently require IBL in the forward pass
|
||||
if (o_enableIBL)
|
||||
float iblExposureFactor = pow(2.0, SceneSrg::m_iblExposure);
|
||||
|
||||
if(useDiffuseIbl)
|
||||
{
|
||||
float3 iblDiffuse = 0.0f;
|
||||
ApplyIblDiffuse(
|
||||
surface.normal,
|
||||
surface.albedo,
|
||||
lightingData.diffuseResponse,
|
||||
iblDiffuse);
|
||||
|
||||
float3 iblSpecular = 0.0f;
|
||||
ApplyIblSpecular(
|
||||
surface.position,
|
||||
surface.normal,
|
||||
surface.specularF0,
|
||||
surface.roughnessLinear,
|
||||
lightingData.dirToCamera,
|
||||
lightingData.brdf,
|
||||
iblSpecular);
|
||||
|
||||
// Adjust IBL lighting by exposure.
|
||||
float iblExposureFactor = pow(2.0, SceneSrg::m_iblExposure);
|
||||
float3 iblDiffuse = GetIblDiffuse(surface.normal, surface.albedo, lightingData.diffuseResponse);
|
||||
lightingData.diffuseLighting += (iblDiffuse * iblExposureFactor * lightingData.diffuseAmbientOcclusion);
|
||||
lightingData.specularLighting += (iblSpecular * iblExposureFactor);
|
||||
}
|
||||
}
|
||||
else if (o_meshUseForwardPassIBLSpecular || o_materialUseForwardPassIBLSpecular)
|
||||
{
|
||||
if (o_enableIBL)
|
||||
{
|
||||
float3 iblSpecular = 0.0f;
|
||||
ApplyIblSpecular(
|
||||
surface.position,
|
||||
surface.normal,
|
||||
surface.specularF0,
|
||||
surface.roughnessLinear,
|
||||
lightingData.dirToCamera,
|
||||
lightingData.brdf,
|
||||
iblSpecular);
|
||||
|
||||
if(useSpecularIbl)
|
||||
{
|
||||
float3 iblSpecular = GetIblSpecular(surface.position, surface.normal, surface.specularF0, surface.roughnessLinear, lightingData.dirToCamera, lightingData.brdf);
|
||||
iblSpecular *= lightingData.multiScatterCompensation;
|
||||
|
||||
if (o_clearCoat_feature_enabled)
|
||||
if (o_clearCoat_feature_enabled && surface.clearCoat.factor > 0.0f)
|
||||
{
|
||||
if (surface.clearCoat.factor > 0.0f)
|
||||
{
|
||||
float clearCoatNdotV = saturate(dot(surface.clearCoat.normal, lightingData.dirToCamera));
|
||||
clearCoatNdotV = max(clearCoatNdotV, 0.01f); // [GFX TODO][ATOM-4466] This is a current band-aid for specular noise at grazing angles.
|
||||
float2 clearCoatBrdf = PassSrg::m_brdfMap.Sample(PassSrg::LinearSampler, GetBRDFTexCoords(surface.clearCoat.roughness, clearCoatNdotV)).rg;
|
||||
float clearCoatNdotV = saturate(dot(surface.clearCoat.normal, lightingData.dirToCamera));
|
||||
clearCoatNdotV = max(clearCoatNdotV, 0.01f); // [GFX TODO][ATOM-4466] This is a current band-aid for specular noise at grazing angles.
|
||||
float2 clearCoatBrdf = PassSrg::m_brdfMap.Sample(PassSrg::LinearSampler, GetBRDFTexCoords(surface.clearCoat.roughness, clearCoatNdotV)).rg;
|
||||
|
||||
// clear coat uses fixed IOR = 1.5 represents polyurethane which is the most common material for gloss clear coat
|
||||
// coat layer assumed to be dielectric thus don't need multiple scattering compensation
|
||||
float3 clearCoatSpecularF0 = float3(0.04f, 0.04f, 0.04f);
|
||||
float3 clearCoatIblSpecular = 0.0f;
|
||||
// clear coat uses fixed IOR = 1.5 represents polyurethane which is the most common material for gloss clear coat
|
||||
// coat layer assumed to be dielectric thus don't need multiple scattering compensation
|
||||
float3 clearCoatSpecularF0 = float3(0.04f, 0.04f, 0.04f);
|
||||
float3 clearCoatIblSpecular = GetIblSpecular(surface.position, surface.clearCoat.normal, clearCoatSpecularF0, surface.clearCoat.roughness, lightingData.dirToCamera, clearCoatBrdf);
|
||||
|
||||
ApplyIblSpecular(
|
||||
surface.position,
|
||||
surface.clearCoat.normal,
|
||||
clearCoatSpecularF0,
|
||||
surface.clearCoat.roughness,
|
||||
lightingData.dirToCamera,
|
||||
clearCoatBrdf,
|
||||
clearCoatIblSpecular);
|
||||
|
||||
clearCoatIblSpecular *= surface.clearCoat.factor;
|
||||
clearCoatIblSpecular *= surface.clearCoat.factor;
|
||||
|
||||
// attenuate base layer energy
|
||||
float3 clearCoatResponse = FresnelSchlickWithRoughness(clearCoatNdotV, clearCoatSpecularF0, surface.clearCoat.roughness) * surface.clearCoat.factor;
|
||||
iblSpecular = iblSpecular * (1.0 - clearCoatResponse) * (1.0 - clearCoatResponse) + clearCoatIblSpecular;
|
||||
}
|
||||
// attenuate base layer energy
|
||||
float3 clearCoatResponse = FresnelSchlickWithRoughness(clearCoatNdotV, clearCoatSpecularF0, surface.clearCoat.roughness) * surface.clearCoat.factor;
|
||||
iblSpecular = iblSpecular * (1.0 - clearCoatResponse) * (1.0 - clearCoatResponse) + clearCoatIblSpecular;
|
||||
}
|
||||
|
||||
|
||||
float iblExposureFactor = pow(2.0f, SceneSrg::m_iblExposure);
|
||||
lightingData.specularLighting += (iblSpecular * iblExposureFactor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// This file translates quality option macros like QUALITY_LOW_END to their relevant settings
|
||||
|
||||
#ifdef QUALITY_LOW_END
|
||||
|
||||
// Unifies the forward output into a single lighting buffer instead of splitting it into a GBuffer
|
||||
#define UNIFIED_FORWARD_OUTPUT 1
|
||||
|
||||
// Forces IBL lighting to be executed in the forward pass instead of subsequent refleciton passes
|
||||
#define FORCE_IBL_IN_FORWARD_PASS 1
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// --- Static Options Available ---
|
||||
// SKYBOX_TWO_OUTPUTS - Skybox renders to two rendertargets instead of one (SkyBox_TwoOutputs.pass writes to specular and reflection targets)
|
||||
|
||||
#include <Atom/Features/ColorManagement/TransformColor.azsli>
|
||||
#include <Atom/Features/PostProcessing/FullscreenVertexUtil.azsli>
|
||||
#include <Atom/Features/MatrixUtility.azsli>
|
||||
@@ -102,7 +105,9 @@ float3 GetCubemapCoords(float3 original)
|
||||
struct PSOutput
|
||||
{
|
||||
float4 m_specular : SV_Target0;
|
||||
#ifdef SKYBOX_TWO_OUTPUTS
|
||||
float4 m_reflection : SV_Target1;
|
||||
#endif
|
||||
};
|
||||
|
||||
PSOutput MainPS(VSOutput input)
|
||||
@@ -163,6 +168,8 @@ PSOutput MainPS(VSOutput input)
|
||||
|
||||
PSOutput OUT;
|
||||
OUT.m_specular = float4(color, 1.0);
|
||||
#ifdef SKYBOX_TWO_OUTPUTS
|
||||
OUT.m_reflection = float4(color, 1.0);
|
||||
#endif
|
||||
return OUT;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
// NOTE: This file is a temporary workaround until .shader files can #define macros for their .azsl files
|
||||
|
||||
#define SKYBOX_TWO_OUTPUTS
|
||||
|
||||
#include "SkyBox.azsl"
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"Source" : "SkyBox_TwoOutputs",
|
||||
|
||||
"DepthStencilState" : {
|
||||
"Depth" : { "Enable" : true, "CompareFunc" : "GreaterEqual" }
|
||||
},
|
||||
|
||||
"ProgramSettings":
|
||||
{
|
||||
"EntryPoints":
|
||||
[
|
||||
{
|
||||
"name": "MainVS",
|
||||
"type": "Vertex"
|
||||
},
|
||||
{
|
||||
"name": "MainPS",
|
||||
"type": "Fragment"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ set(FILES
|
||||
Materials/Types/StandardMultilayerPBR_ForwardPass_EDS.shader
|
||||
Materials/Types/StandardMultilayerPBR_Parallax.lua
|
||||
Materials/Types/StandardMultilayerPBR_ParallaxPerLayer.lua
|
||||
Materials/Types/StandardMultilayerPBR_ShaderEnable.lua
|
||||
Materials/Types/StandardMultilayerPBR_Shadowmap_WithPS.azsl
|
||||
Materials/Types/StandardMultilayerPBR_Shadowmap_WithPS.shader
|
||||
Materials/Types/StandardPBR.materialtype
|
||||
@@ -52,6 +53,9 @@ set(FILES
|
||||
Materials/Types/StandardPBR_ForwardPass_EDS.shader
|
||||
Materials/Types/StandardPBR_HandleOpacityDoubleSided.lua
|
||||
Materials/Types/StandardPBR_HandleOpacityMode.lua
|
||||
Materials/Types/StandardPBR_LowEndForward.azsl
|
||||
Materials/Types/StandardPBR_LowEndForward.shader
|
||||
Materials/Types/StandardPBR_LowEndForward_EDS.shader
|
||||
Materials/Types/StandardPBR_ParallaxState.lua
|
||||
Materials/Types/StandardPBR_Roughness.lua
|
||||
Materials/Types/StandardPBR_ShaderEnable.lua
|
||||
@@ -116,6 +120,7 @@ set(FILES
|
||||
Passes/DiffuseProbeGridBlendDistance.pass
|
||||
Passes/DiffuseProbeGridBlendIrradiance.pass
|
||||
Passes/DiffuseProbeGridBorderUpdate.pass
|
||||
Passes/DiffuseProbeGridClassification.pass
|
||||
Passes/DiffuseProbeGridDownsample.pass
|
||||
Passes/DiffuseProbeGridRayTracing.pass
|
||||
Passes/DiffuseProbeGridRelocation.pass
|
||||
@@ -144,6 +149,7 @@ set(FILES
|
||||
Passes/FullscreenCopy.pass
|
||||
Passes/FullscreenOutputOnly.pass
|
||||
Passes/ImGui.pass
|
||||
Passes/LightAdaptationParent.pass
|
||||
Passes/LightCulling.pass
|
||||
Passes/LightCullingHeatmap.pass
|
||||
Passes/LightCullingParent.pass
|
||||
@@ -152,6 +158,8 @@ set(FILES
|
||||
Passes/LightCullingTilePrepareMSAA.pass
|
||||
Passes/LookModificationComposite.pass
|
||||
Passes/LookModificationTransform.pass
|
||||
Passes/LowEndForward.pass
|
||||
Passes/LowEndPipeline.pass
|
||||
Passes/LuminanceHeatmap.pass
|
||||
Passes/LuminanceHistogramGenerator.pass
|
||||
Passes/MainPipeline.pass
|
||||
@@ -179,13 +187,16 @@ set(FILES
|
||||
Passes/ReflectionScreenSpace.pass
|
||||
Passes/ReflectionScreenSpaceBlur.pass
|
||||
Passes/ReflectionScreenSpaceBlurHorizontal.pass
|
||||
Passes/ReflectionScreenSpaceBlurMobile.pass
|
||||
Passes/ReflectionScreenSpaceBlurVertical.pass
|
||||
Passes/ReflectionScreenSpaceComposite.pass
|
||||
Passes/ReflectionScreenSpaceMobile.pass
|
||||
Passes/ReflectionScreenSpaceTrace.pass
|
||||
Passes/Reflections_nomsaa.pass
|
||||
Passes/ShadowParent.pass
|
||||
Passes/Skinning.pass
|
||||
Passes/SkyBox.pass
|
||||
Passes/SkyBox_TwoOutputs.pass
|
||||
Passes/SMAA1xApplyLinearHDRColor.pass
|
||||
Passes/SMAA1xApplyPerceptualColor.pass
|
||||
Passes/SMAABlendingWeightCalculation.pass
|
||||
@@ -205,6 +216,7 @@ set(FILES
|
||||
ShaderLib/Atom/Features/IndirectRendering.azsli
|
||||
ShaderLib/Atom/Features/MatrixUtility.azsli
|
||||
ShaderLib/Atom/Features/ParallaxMapping.azsli
|
||||
ShaderLib/Atom/Features/ShaderQualityOptions.azsli
|
||||
ShaderLib/Atom/Features/SphericalHarmonicsUtility.azsli
|
||||
ShaderLib/Atom/Features/SrgSemantics.azsli
|
||||
ShaderLib/Atom/Features/ColorManagement/TransformColor.azsli
|
||||
@@ -272,6 +284,7 @@ set(FILES
|
||||
ShaderLib/Atom/Features/PostProcessing/GlyphData.azsli
|
||||
ShaderLib/Atom/Features/PostProcessing/GlyphRender.azsli
|
||||
ShaderLib/Atom/Features/PostProcessing/PostProcessUtil.azsli
|
||||
ShaderLib/Atom/Features/RayTracing/RayTracingSceneSrg.azsli
|
||||
ShaderLib/Atom/Features/ScreenSpace/ScreenSpaceUtil.azsli
|
||||
ShaderLib/Atom/Features/Shadow/BicubicPcfFilters.azsli
|
||||
ShaderLib/Atom/Features/Shadow/DirectionalLightShadow.azsli
|
||||
@@ -471,4 +484,6 @@ set(FILES
|
||||
Shaders/SkinnedMesh/LinearSkinningPassSRG.azsli
|
||||
Shaders/SkyBox/SkyBox.azsl
|
||||
Shaders/SkyBox/SkyBox.shader
|
||||
Shaders/SkyBox/SkyBox_TwoOutputs.azsl
|
||||
Shaders/SkyBox/SkyBox_TwoOutputs.shader
|
||||
)
|
||||
|
||||
@@ -381,6 +381,7 @@ namespace AZ
|
||||
uint64_t m_createdByPassRequest : 1;
|
||||
uint64_t m_initialized : 1;
|
||||
uint64_t m_enabled : 1;
|
||||
uint64_t m_parentEnabled : 1;
|
||||
uint64_t m_alreadyCreated : 1;
|
||||
uint64_t m_alreadyReset : 1;
|
||||
uint64_t m_alreadyPrepared : 1;
|
||||
|
||||
@@ -93,11 +93,12 @@ namespace AZ
|
||||
void Pass::SetEnabled(bool enabled)
|
||||
{
|
||||
m_flags.m_enabled = enabled;
|
||||
OnHierarchyChange();
|
||||
}
|
||||
|
||||
bool Pass::IsEnabled() const
|
||||
{
|
||||
return m_flags.m_enabled;
|
||||
return m_flags.m_enabled && (m_flags.m_parentEnabled || m_parent == nullptr);
|
||||
}
|
||||
|
||||
// --- Error Logging ---
|
||||
@@ -140,6 +141,7 @@ namespace AZ
|
||||
}
|
||||
|
||||
// Set new tree depth and path
|
||||
m_flags.m_parentEnabled = m_parent->m_flags.m_enabled && (m_parent->m_flags.m_parentEnabled || m_parent->m_parent == nullptr);
|
||||
m_treeDepth = m_parent->m_treeDepth + 1;
|
||||
m_path = ConcatPassName(m_parent->m_path, m_name);
|
||||
m_flags.m_partOfHierarchy = m_parent->m_flags.m_partOfHierarchy;
|
||||
|
||||
Reference in New Issue
Block a user