1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /*
- * 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
- // This #define magic lets you use the EvaluatePixelGeometry function in this file without making it the final EvaluatePixelGeometry
- // used in your shader. Simply #define EvaluatePixelGeometry to your custom definition before including this file
- //
- #ifndef EvaluatePixelGeometry
- #define EvaluatePixelGeometry EvaluatePixelGeometry_Skin
- #endif
- #include "../BasePBR/BasePBR_PixelGeometryEval.azsli"
- PixelGeometryData EvaluatePixelGeometry_Skin(
- VsSystemValues SV,
- const MaterialParameters params,
- float3 positionWS,
- real3 normalWS,
- real3 tangentWS,
- real3 bitangentWS,
- float2 uvs[UvSetCount],
- float2 detailUvs[UvSetCount],
- real4 wrinkleBlendFactors,
- bool isFrontFace)
- {
- // Base PBR Geo Data
- PixelGeometryData geoData = EvaluatePixelGeometry_BasePBR(SV, params, positionWS, normalWS, tangentWS, bitangentWS, uvs, isFrontFace);
- // Skin specifics
- // skin only has one detail UV channel
- geoData.detailUv = detailUvs[0];
- geoData.wrinkleBlendFactors = wrinkleBlendFactors;
- return geoData;
- }
- PixelGeometryData EvaluatePixelGeometry_Skin(VsOutput IN, VsSystemValues SV, bool isFrontFace, const MaterialParameters params)
- {
- real4x4 objectToWorld = real4x4(GetObjectToWorldMatrix(SV));
- real3x3 objectToWorldIT = real3x3(GetObjectToWorldMatrixInverseTranspose(SV));
- real3 normalWS, tangentWS, bitangentWS;
- ConstructTBN(real3(IN.normal), real4(IN.tangent), objectToWorld, objectToWorldIT, normalWS, tangentWS, bitangentWS);
- return EvaluatePixelGeometry_Skin(
- SV,
- params,
- IN.worldPosition,
- normalWS,
- tangentWS,
- bitangentWS,
- IN.uvs,
- IN.detailUvs,
- real4(IN.blendFactors),
- isFrontFace);
- }
|