1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- /*
- * 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
- *
- */
- #pragma once
- #include <Atom/Features/Pipeline/Forward/ForwardPassOutput.azsli>
- // --- Vertex Shader ---
- VsOutput VertexShader(VsInput IN, uint instanceId : SV_InstanceID)
- {
- VsSystemValues SV;
- SV.m_instanceId = instanceId;
- VsOutput OUT = EvaluateVertexGeometry(IN, SV, GetMaterialParameters());
- return OUT;
- }
- // --- Pixel Shader ---
- // TODO(MaterialPipeline): Probably replace this with FORCE_EARLY_DEPTH_STENCIL like how it's done in MultiViewForwardPassVertexAndPixel.azsli
- #if !OUTPUT_DEPTH
- [earlydepthstencil]
- #endif
- ForwardPassOutput PixelShader(VsOutput IN, bool isFrontFace : SV_IsFrontFace)
- {
- float3 views[MAX_SHADING_VIEWS];
- views[0] = ViewSrg::m_worldPosition.xyz; // Assume one view for forward pass for now
-
- // ------- Geometry -> Surface -> Lighting -------
- PixelGeometryData geoData = EvaluatePixelGeometry(IN, isFrontFace, GetMaterialParameters());
- Surface surface = EvaluateSurface(IN, geoData, GetMaterialParameters());
- LightingData lightingData = EvaluateLighting(surface, IN.position, views);
- // ------- Output -------
- ForwardPassOutput OUT;
- OUT.m_color.rgb = lightingData.diffuseLighting.rgb + lightingData.specularLighting[0].rgb + lightingData.emissiveLighting.rgb;
- OUT.m_color.a = 1.0;
- #if OUTPUT_DEPTH
- // Can be modified in Parallax calculations in EvaluatePixelGeometry
- OUT.m_depth = IN.position.z;
- #endif
- return OUT;
- }
|