|
@@ -1,144 +0,0 @@
|
|
-/*
|
|
|
|
- * Copyright (c) Contributors to the Open 3D Engine Project.
|
|
|
|
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
|
|
- *
|
|
|
|
- * SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-#include <viewsrg.srgi>
|
|
|
|
-#include <Atom/Features/PBR/DefaultObjectSrg.azsli>
|
|
|
|
-#include <Atom/Features/PBR/ForwardPassSrg.azsli>
|
|
|
|
-#include <Atom/Features/PBR/ForwardPassOutput.azsli>
|
|
|
|
-#include <Atom/Features/PBR/AlphaUtils.azsli>
|
|
|
|
-#include <Atom/Features/SrgSemantics.azsli>
|
|
|
|
-#include <Atom/Features/ColorManagement/TransformColor.azsli>
|
|
|
|
-#include <Atom/Features/PBR/Lighting/StandardLighting.azsli>
|
|
|
|
-#include <Atom/Features/PBR/Decals.azsli>
|
|
|
|
-
|
|
|
|
-// Everything inside of the generated blocks will eventually be replaced in the generated files as the material graph is compiled.
|
|
|
|
-
|
|
|
|
-// O3DE_GENERATED_INCLUDES_BEGIN
|
|
|
|
-// O3DE_GENERATED_INCLUDES_END
|
|
|
|
-
|
|
|
|
-struct VSInput
|
|
|
|
-{
|
|
|
|
- float3 m_position : POSITION;
|
|
|
|
- float3 m_normal : NORMAL;
|
|
|
|
- float4 m_tangent : TANGENT;
|
|
|
|
- float3 m_bitangent : BITANGENT;
|
|
|
|
-
|
|
|
|
- // O3DE_GENERATED_VSINPUT_BEGIN
|
|
|
|
- // O3DE_GENERATED_VSINPUT_END
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-struct VSOutput
|
|
|
|
-{
|
|
|
|
- precise linear centroid float4 m_position : SV_Position;
|
|
|
|
- float3 m_normal: NORMAL;
|
|
|
|
- float3 m_tangent : TANGENT;
|
|
|
|
- float3 m_bitangent : BITANGENT;
|
|
|
|
- float3 m_worldPosition : UV0;
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-#include <Atom/Features/Vertex/VertexHelper.azsli>
|
|
|
|
-
|
|
|
|
-ShaderResourceGroup MaterialSrg : SRG_PerMaterial
|
|
|
|
-{
|
|
|
|
- // O3DE_GENERATED_MATERIAL_SRG_BEGIN
|
|
|
|
- // O3DE_GENERATED_MATERIAL_SRG_END
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// O3DE_GENERATED_CLASSES_BEGIN
|
|
|
|
-// O3DE_GENERATED_CLASSES_END
|
|
|
|
-
|
|
|
|
-// O3DE_GENERATED_FUNCTIONS_BEGIN
|
|
|
|
-// O3DE_GENERATED_FUNCTIONS_END
|
|
|
|
-
|
|
|
|
-VSOutput default_MainPassVS(VSInput IN)
|
|
|
|
-{
|
|
|
|
- VSOutput OUT;
|
|
|
|
-
|
|
|
|
- float3 worldPosition = mul(ObjectSrg::GetWorldMatrix(), float4(IN.m_position, 1.0)).xyz;
|
|
|
|
-
|
|
|
|
- // O3DE_GENERATED_INSTRUCTIONS_BEGIN: inPositionOffset
|
|
|
|
- float4 inPositionOffset = float4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
- // O3DE_GENERATED_INSTRUCTIONS_END
|
|
|
|
-
|
|
|
|
- VertexHelper(IN, OUT, worldPosition + inPositionOffset.xyz);
|
|
|
|
-
|
|
|
|
- return OUT;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-ForwardPassOutput default_MainPassPS(VSOutput IN)
|
|
|
|
-{
|
|
|
|
- // O3DE_GENERATED_INSTRUCTIONS_BEGIN: inBaseColor, inEmissive, inMetallic, inRoughness, inSpecularF0Factor
|
|
|
|
-float node7_inValue = 0;
|
|
|
|
-float node7_outValue = node7_inValue;
|
|
|
|
-float node5_outTime = SceneSrg::m_time;
|
|
|
|
-float4 node6_inValue1 = node5_outTime;
|
|
|
|
-float4 node6_inValue2 = node7_outValue;
|
|
|
|
-float4 node6_outValue = node6_inValue1 + node6_inValue2;
|
|
|
|
-float4 node4_inValue = node6_outValue;
|
|
|
|
-float4 node4_outValue = sin(node4_inValue);
|
|
|
|
-float2 node3_inUV = float2(0, 0);
|
|
|
|
-float4 node3_outColor = 1.0;
|
|
|
|
-float4 node18_inValue1 = node4_outValue;
|
|
|
|
-float4 node18_inValue2 = node3_outColor;
|
|
|
|
-float4 node18_outValue = mul(node18_inValue1, node18_inValue2);
|
|
|
|
-float4 inBaseColor = node18_outValue;
|
|
|
|
-float inMetallic = 0;
|
|
|
|
-float inSpecularF0Factor = 0;
|
|
|
|
-float inRoughness = node3_outColor;
|
|
|
|
-float4 inEmissive = float4(0, 0, 0, 1);
|
|
|
|
- // O3DE_GENERATED_INSTRUCTIONS_END
|
|
|
|
-
|
|
|
|
- // ------- Surface -------
|
|
|
|
-
|
|
|
|
- Surface surface;
|
|
|
|
- surface.position = IN.m_worldPosition.xyz;
|
|
|
|
- surface.normal = normalize(IN.m_normal);
|
|
|
|
- surface.vertexNormal = normalize(IN.m_normal);
|
|
|
|
- surface.roughnessLinear = inRoughness;
|
|
|
|
- surface.CalculateRoughnessA();
|
|
|
|
- surface.SetAlbedoAndSpecularF0(inBaseColor.rgb, inSpecularF0Factor, inMetallic);
|
|
|
|
- surface.clearCoat.InitializeToZero();
|
|
|
|
-
|
|
|
|
- // ------- LightingData -------
|
|
|
|
-
|
|
|
|
- LightingData lightingData;
|
|
|
|
- lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
|
|
|
|
- lightingData.Init(surface.position, surface.normal, surface.roughnessLinear);
|
|
|
|
- lightingData.specularResponse = FresnelSchlickWithRoughness(lightingData.NdotV, surface.specularF0, surface.roughnessLinear);
|
|
|
|
- lightingData.diffuseResponse = 1.0f - lightingData.specularResponse;
|
|
|
|
- lightingData.emissiveLighting = inEmissive;
|
|
|
|
-
|
|
|
|
- // ------- Lighting Calculation -------
|
|
|
|
-
|
|
|
|
- // Apply Decals
|
|
|
|
- ApplyDecals(lightingData.tileIterator, surface);
|
|
|
|
-
|
|
|
|
- // Apply Direct Lighting
|
|
|
|
- ApplyDirectLighting(surface, lightingData, IN.m_position);
|
|
|
|
-
|
|
|
|
- // Apply Image Based Lighting (IBL)
|
|
|
|
- ApplyIBL(surface, lightingData);
|
|
|
|
-
|
|
|
|
- // Finalize Lighting
|
|
|
|
- lightingData.FinalizeLighting();
|
|
|
|
-
|
|
|
|
- PbrLightingOutput lightingOutput = GetPbrLightingOutput(surface, lightingData, inBaseColor.a);
|
|
|
|
-
|
|
|
|
- // ------- Output -------
|
|
|
|
-
|
|
|
|
- ForwardPassOutput OUT;
|
|
|
|
-
|
|
|
|
- OUT.m_diffuseColor = lightingOutput.m_diffuseColor;
|
|
|
|
- OUT.m_diffuseColor.w = -1; // Subsurface scattering is disabled
|
|
|
|
- OUT.m_specularColor = lightingOutput.m_specularColor;
|
|
|
|
- OUT.m_specularF0 = lightingOutput.m_specularF0;
|
|
|
|
- OUT.m_albedo = lightingOutput.m_albedo;
|
|
|
|
- OUT.m_normal = lightingOutput.m_normal;
|
|
|
|
-
|
|
|
|
- return OUT;
|
|
|
|
-}
|
|
|