StandardMultilayerPBR_PixelGeometryEval.azsli 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #ifndef EvaluatePixelGeometry
  10. #define EvaluatePixelGeometry EvaluatePixelGeometry_StandardMultilayerPBR
  11. #endif
  12. #include <Atom/Feature/Common/Assets/Shaders/Materials/BasePBR/BasePBR_PixelGeometryEval.azsli>
  13. PixelGeometryData EvaluatePixelGeometry_StandardMultilayerPBR(
  14. VsSystemValues SV,
  15. const MaterialParameters params,
  16. inout float4 positionSV,
  17. float3 positionWS,
  18. real3 normalWS,
  19. real3 tangentWS,
  20. real3 bitangentWS,
  21. float2 uvs[UvSetCount],
  22. bool isFrontFace,
  23. real4x4 objectToWorld,
  24. real3 vertexBlendMask)
  25. {
  26. PixelGeometryData geoData = EvaluatePixelGeometry_BasePBR(SV, params, positionWS, normalWS, tangentWS, bitangentWS, uvs, isFrontFace);
  27. geoData.isDisplacementClipped = false;
  28. geoData.m_vertexBlendMask = vertexBlendMask;
  29. #if ENABLE_PARALLAX
  30. if(ShouldHandleParallax())
  31. {
  32. MultilayerSetPixelDepth(params, vertexBlendMask, geoData.positionWS, geoData.vertexNormal, geoData.tangents, geoData.bitangents,
  33. geoData.uvs, isFrontFace, objectToWorld, positionSV.z, positionSV.w, geoData.isDisplacementClipped);
  34. }
  35. #endif
  36. return geoData;
  37. }
  38. PixelGeometryData EvaluatePixelGeometry_StandardMultilayerPBR(inout VsOutput IN, VsSystemValues SV, bool isFrontFace, const MaterialParameters params)
  39. {
  40. real4x4 objectToWorld = real4x4(GetObjectToWorldMatrix(SV));
  41. real3x3 objectToWorldIT = real3x3(GetObjectToWorldMatrixInverseTranspose(SV));
  42. real3 normalWS, tangentWS, bitangentWS;
  43. ConstructTBN(real3(IN.normal), real4(IN.tangent), objectToWorld, objectToWorldIT, normalWS, tangentWS, bitangentWS);
  44. return EvaluatePixelGeometry_StandardMultilayerPBR(
  45. SV,
  46. params,
  47. IN.position,
  48. IN.worldPosition,
  49. normalWS,
  50. tangentWS,
  51. bitangentWS,
  52. IN.uvs,
  53. isFrontFace,
  54. objectToWorld,
  55. real3(IN.blendFactors.xyz));
  56. }