|
@@ -74,6 +74,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
#include <Atom/Feature/Common/Assets/Shaders/Materials/BasePBR/BasePBR_VertexEval.azsli>
|
|
|
|
|
|
VsOutput EvaluateVertexGeometry_StandardMultilayerPBR(
|
|
|
+ const MaterialParameters params,
|
|
|
float3 position,
|
|
|
float3 normal,
|
|
|
float4 tangent,
|
|
@@ -83,7 +84,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
uint instanceId,
|
|
|
bool useVertexBlendMask)
|
|
|
{
|
|
|
- VsOutput output = EvaluateVertexGeometry_BasePBR(position, normal, tangent, uv0, uv1, instanceId, false, float4(1.0f, 1.0f, 1.0f, 1.0f));
|
|
|
+ VsOutput output = EvaluateVertexGeometry_BasePBR(params, position, normal, tangent, uv0, uv1, instanceId, false, float4(1.0f, 1.0f, 1.0f, 1.0f));
|
|
|
|
|
|
if(useVertexBlendMask)
|
|
|
{
|
|
@@ -101,6 +102,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
// Avoids compilation errors for compute shaders, listed in a materialpipeline,
|
|
|
// that call EvaluateVertexGeometry().
|
|
|
VsOutput EvaluateVertexGeometry_StandardMultilayerPBR(
|
|
|
+ const MaterialParameters params,
|
|
|
float3 position,
|
|
|
float3 normal,
|
|
|
float4 tangent,
|
|
@@ -108,12 +110,13 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
float2 uv1_unwrapped,
|
|
|
uint instanceId)
|
|
|
{
|
|
|
- return EvaluateVertexGeometry_StandardMultilayerPBR(position, normal, tangent, uv0_tiled, uv1_unwrapped, float3(0, 0, 0), instanceId, false);
|
|
|
+ return EvaluateVertexGeometry_StandardMultilayerPBR(params, position, normal, tangent, uv0_tiled, uv1_unwrapped, float3(0, 0, 0), instanceId, false);
|
|
|
}
|
|
|
|
|
|
- VsOutput EvaluateVertexGeometry_StandardMultilayerPBR(VsInput IN, VsSystemValues SV)
|
|
|
+ VsOutput EvaluateVertexGeometry_StandardMultilayerPBR(VsInput IN, VsSystemValues SV, const MaterialParameters params)
|
|
|
{
|
|
|
return EvaluateVertexGeometry_StandardMultilayerPBR(
|
|
|
+ params,
|
|
|
IN.position,
|
|
|
IN.normal,
|
|
|
IN.tangent,
|
|
@@ -143,6 +146,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
bool ShouldHandleParallax();
|
|
|
|
|
|
PixelGeometryData EvaluatePixelGeometry_StandardMultilayerPBR(
|
|
|
+ const MaterialParameters params,
|
|
|
inout float4 positionSV,
|
|
|
float3 positionWS,
|
|
|
real3 normalWS,
|
|
@@ -153,7 +157,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
real4x4 objectToWorld,
|
|
|
real3 vertexBlendMask)
|
|
|
{
|
|
|
- PixelGeometryData geoData = EvaluatePixelGeometry_BasePBR(positionWS, normalWS, tangentWS, bitangentWS, uvs, isFrontFace);
|
|
|
+ PixelGeometryData geoData = EvaluatePixelGeometry_BasePBR(params, positionWS, normalWS, tangentWS, bitangentWS, uvs, isFrontFace);
|
|
|
|
|
|
geoData.isDisplacementClipped = false;
|
|
|
geoData.m_vertexBlendMask = vertexBlendMask;
|
|
@@ -161,14 +165,14 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
#if ENABLE_PARALLAX
|
|
|
if(ShouldHandleParallax())
|
|
|
{
|
|
|
- MultilayerSetPixelDepth(vertexBlendMask, geoData.positionWS, geoData.vertexNormal, geoData.tangents, geoData.bitangents,
|
|
|
+ MultilayerSetPixelDepth(params, vertexBlendMask, geoData.positionWS, geoData.vertexNormal, geoData.tangents, geoData.bitangents,
|
|
|
geoData.uvs, isFrontFace, objectToWorld, positionSV.z, positionSV.w, geoData.isDisplacementClipped);
|
|
|
}
|
|
|
#endif
|
|
|
return geoData;
|
|
|
}
|
|
|
|
|
|
- PixelGeometryData EvaluatePixelGeometry_StandardMultilayerPBR(inout VsOutput IN, bool isFrontFace)
|
|
|
+ PixelGeometryData EvaluatePixelGeometry_StandardMultilayerPBR(inout VsOutput IN, bool isFrontFace, const MaterialParameters params)
|
|
|
{
|
|
|
real4x4 objectToWorld = real4x4(GetObjectToWorldMatrix(IN.m_instanceId));
|
|
|
real3x3 objectToWorldIT = real3x3(GetObjectToWorldMatrixInverseTranspose(IN.m_instanceId));
|
|
@@ -177,6 +181,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
ConstructTBN(real3(IN.normal), real4(IN.tangent), objectToWorld, objectToWorldIT, normalWS, tangentWS, bitangentWS);
|
|
|
|
|
|
return EvaluatePixelGeometry_StandardMultilayerPBR(
|
|
|
+ params,
|
|
|
IN.position,
|
|
|
IN.worldPosition,
|
|
|
normalWS,
|
|
@@ -333,11 +338,11 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
result.m_baseColor = BlendBaseColor(sampledBaseColor, real3(inputs.m_baseColor.rgb), real(inputs.m_baseColorFactor), inputs.m_baseColorTextureBlendMode, inputs.m_baseColor_useTexture);
|
|
|
result.m_specularF0Factor = GetSpecularInput(inputs.m_specularF0Map, inputs.m_sampler, transformedUv[inputs.m_specularF0MapUvIndex], real(inputs.m_specularF0Factor), inputs.m_specularF0_useTexture, uvDxDy, customDerivatives);
|
|
|
result.m_metallic = GetMetallicInput(inputs.m_metallicMap, inputs.m_sampler, transformedUv[inputs.m_metallicMapUvIndex], real(inputs.m_metallicFactor), inputs.m_metallic_useTexture, uvDxDy, customDerivatives);
|
|
|
- result.m_roughness = GetRoughnessInput(inputs.m_roughnessMap, MaterialSrg::m_sampler, transformedUv[inputs.m_roughnessMapUvIndex], real(inputs.m_roughnessFactor), real(inputs.m_roughnessLowerBound), real(inputs.m_roughnessUpperBound), inputs.m_roughness_useTexture, uvDxDy, customDerivatives);
|
|
|
+ result.m_roughness = GetRoughnessInput(inputs.m_roughnessMap, GetMaterialTextureSampler(), transformedUv[inputs.m_roughnessMapUvIndex], real(inputs.m_roughnessFactor), real(inputs.m_roughnessLowerBound), real(inputs.m_roughnessUpperBound), inputs.m_roughness_useTexture, uvDxDy, customDerivatives);
|
|
|
|
|
|
result.m_emissiveLighting = GetEmissiveInput(inputs.m_emissiveMap, inputs.m_sampler, transformedUv[inputs.m_emissiveMapUvIndex], real(inputs.m_emissiveIntensity), real3(inputs.m_emissiveColor.rgb), 0.0, 1.0, inputs.m_emissiveEnabled, inputs.m_emissive_useTexture, uvDxDy, customDerivatives);
|
|
|
result.m_diffuseAmbientOcclusion = GetOcclusionInput(inputs.m_diffuseOcclusionMap, inputs.m_sampler, transformedUv[inputs.m_diffuseOcclusionMapUvIndex], real(inputs.m_diffuseOcclusionFactor), inputs.m_diffuseOcclusion_useTexture, uvDxDy, customDerivatives);
|
|
|
- result.m_specularOcclusion = GetOcclusionInput(inputs.m_specularOcclusionMap, MaterialSrg::m_sampler, transformedUv[inputs.m_specularOcclusionMapUvIndex], real(inputs.m_specularOcclusionFactor), inputs.m_specularOcclusion_useTexture, uvDxDy, customDerivatives);
|
|
|
+ result.m_specularOcclusion = GetOcclusionInput(inputs.m_specularOcclusionMap, GetMaterialTextureSampler(), transformedUv[inputs.m_specularOcclusionMapUvIndex], real(inputs.m_specularOcclusionFactor), inputs.m_specularOcclusion_useTexture, uvDxDy, customDerivatives);
|
|
|
|
|
|
#if ENABLE_CLEAR_COAT
|
|
|
result.m_clearCoat.InitializeToZero();
|
|
@@ -359,7 +364,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
|
|
|
//! Fills a StandardMaterialInputs struct with data from the MaterialSrg, shader options, and local vertex data.
|
|
|
#define FILL_STANDARD_MATERIAL_INPUTS(inputs, srgLayerPrefix, optionsLayerPrefix, blendWeight) \
|
|
|
- inputs.m_sampler = MaterialSrg::m_sampler; \
|
|
|
+ inputs.m_sampler = GetMaterialTextureSampler(); \
|
|
|
inputs.m_vertexUv = uvs; \
|
|
|
inputs.m_uvMatrix = srgLayerPrefix##m_uvMatrix; \
|
|
|
inputs.m_normal = normalWS; \
|
|
@@ -368,46 +373,46 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
inputs.m_isFrontFace = isFrontFace; \
|
|
|
\
|
|
|
inputs.m_normalMapUvIndex = srgLayerPrefix##m_normalMapUvIndex; \
|
|
|
- inputs.m_normalMap = srgLayerPrefix##m_normalMap; \
|
|
|
+ inputs.m_normalMap = GetMaterialTexture(srgLayerPrefix##m_normalMap); \
|
|
|
inputs.m_flipNormalX = srgLayerPrefix##m_flipNormalX; \
|
|
|
inputs.m_flipNormalY = srgLayerPrefix##m_flipNormalY; \
|
|
|
inputs.m_normal_useTexture = optionsLayerPrefix##o_normal_useTexture; \
|
|
|
inputs.m_normalFactor = srgLayerPrefix##m_normalFactor * blendWeight; \
|
|
|
- inputs.m_baseColorMap = srgLayerPrefix##m_baseColorMap; \
|
|
|
+ inputs.m_baseColorMap = GetMaterialTexture(srgLayerPrefix##m_baseColorMap); \
|
|
|
inputs.m_baseColorMapUvIndex = srgLayerPrefix##m_baseColorMapUvIndex; \
|
|
|
- inputs.m_baseColor = srgLayerPrefix##m_baseColor; \
|
|
|
+ inputs.m_baseColor = srgLayerPrefix##m_baseColor.rgb; \
|
|
|
inputs.m_baseColor_useTexture = optionsLayerPrefix##o_baseColor_useTexture; \
|
|
|
inputs.m_baseColorFactor = srgLayerPrefix##m_baseColorFactor; \
|
|
|
inputs.m_baseColorTextureBlendMode = optionsLayerPrefix##o_baseColorTextureBlendMode; \
|
|
|
- inputs.m_metallicMap = srgLayerPrefix##m_metallicMap; \
|
|
|
+ inputs.m_metallicMap = GetMaterialTexture(srgLayerPrefix##m_metallicMap); \
|
|
|
inputs.m_metallicMapUvIndex = srgLayerPrefix##m_metallicMapUvIndex; \
|
|
|
inputs.m_metallicFactor = srgLayerPrefix##m_metallicFactor; \
|
|
|
inputs.m_metallic_useTexture = optionsLayerPrefix##o_metallic_useTexture; \
|
|
|
- inputs.m_specularF0Map = srgLayerPrefix##m_specularF0Map; \
|
|
|
+ inputs.m_specularF0Map = GetMaterialTexture(srgLayerPrefix##m_specularF0Map); \
|
|
|
inputs.m_specularF0MapUvIndex = srgLayerPrefix##m_specularF0MapUvIndex; \
|
|
|
inputs.m_specularF0Factor = srgLayerPrefix##m_specularF0Factor; \
|
|
|
inputs.m_specularF0_useTexture = optionsLayerPrefix##o_specularF0_useTexture; \
|
|
|
- inputs.m_roughnessMap = srgLayerPrefix##m_roughnessMap; \
|
|
|
+ inputs.m_roughnessMap = GetMaterialTexture(srgLayerPrefix##m_roughnessMap); \
|
|
|
inputs.m_roughnessMapUvIndex = srgLayerPrefix##m_roughnessMapUvIndex; \
|
|
|
inputs.m_roughnessFactor = srgLayerPrefix##m_roughnessFactor; \
|
|
|
inputs.m_roughnessLowerBound = srgLayerPrefix##m_roughnessLowerBound; \
|
|
|
inputs.m_roughnessUpperBound = srgLayerPrefix##m_roughnessUpperBound; \
|
|
|
inputs.m_roughness_useTexture = optionsLayerPrefix##o_roughness_useTexture; \
|
|
|
\
|
|
|
- inputs.m_emissiveMap = srgLayerPrefix##m_emissiveMap; \
|
|
|
+ inputs.m_emissiveMap = GetMaterialTexture(srgLayerPrefix##m_emissiveMap); \
|
|
|
inputs.m_emissiveMapUvIndex = srgLayerPrefix##m_emissiveMapUvIndex; \
|
|
|
inputs.m_emissiveIntensity = srgLayerPrefix##m_emissiveIntensity; \
|
|
|
- inputs.m_emissiveColor = srgLayerPrefix##m_emissiveColor; \
|
|
|
+ inputs.m_emissiveColor = srgLayerPrefix##m_emissiveColor.rgb; \
|
|
|
inputs.m_emissiveAffectedByAlpha = srgLayerPrefix##m_emissiveAffectedByAlpha; \
|
|
|
inputs.m_emissiveEnabled = optionsLayerPrefix##o_emissiveEnabled; \
|
|
|
inputs.m_emissive_useTexture = optionsLayerPrefix##o_emissive_useTexture; \
|
|
|
\
|
|
|
- inputs.m_diffuseOcclusionMap = srgLayerPrefix##m_diffuseOcclusionMap; \
|
|
|
+ inputs.m_diffuseOcclusionMap = GetMaterialTexture(srgLayerPrefix##m_diffuseOcclusionMap); \
|
|
|
inputs.m_diffuseOcclusionMapUvIndex = srgLayerPrefix##m_diffuseOcclusionMapUvIndex; \
|
|
|
inputs.m_diffuseOcclusionFactor = srgLayerPrefix##m_diffuseOcclusionFactor; \
|
|
|
inputs.m_diffuseOcclusion_useTexture = optionsLayerPrefix##o_diffuseOcclusion_useTexture; \
|
|
|
\
|
|
|
- inputs.m_specularOcclusionMap = srgLayerPrefix##m_specularOcclusionMap; \
|
|
|
+ inputs.m_specularOcclusionMap = GetMaterialTexture(srgLayerPrefix##m_specularOcclusionMap); \
|
|
|
inputs.m_specularOcclusionMapUvIndex = srgLayerPrefix##m_specularOcclusionMapUvIndex; \
|
|
|
inputs.m_specularOcclusionFactor = srgLayerPrefix##m_specularOcclusionFactor; \
|
|
|
inputs.m_specularOcclusion_useTexture = optionsLayerPrefix##o_specularOcclusion_useTexture;
|
|
@@ -416,15 +421,15 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
#if ENABLE_CLEAR_COAT
|
|
|
#define FILL_STANDARD_MATERIAL_INPUTS_CLEAR_COAT(inputs, srgLayerPrefix, optionsLayerPrefix, blendWeight) \
|
|
|
inputs.m_clearCoatEnabled = o_clearCoat_feature_enabled && optionsLayerPrefix##o_clearCoat_enabled; \
|
|
|
- inputs.m_clearCoatInfluenceMap = srgLayerPrefix##m_clearCoatInfluenceMap; \
|
|
|
+ inputs.m_clearCoatInfluenceMap = GetMaterialTexture(srgLayerPrefix##m_clearCoatInfluenceMap); \
|
|
|
inputs.m_clearCoatInfluenceMapUvIndex = srgLayerPrefix##m_clearCoatInfluenceMapUvIndex; \
|
|
|
inputs.m_clearCoatFactor = srgLayerPrefix##m_clearCoatFactor; \
|
|
|
inputs.m_clearCoat_factor_useTexture = optionsLayerPrefix##o_clearCoat_factor_useTexture; \
|
|
|
- inputs.m_clearCoatRoughnessMap = srgLayerPrefix##m_clearCoatRoughnessMap; \
|
|
|
+ inputs.m_clearCoatRoughnessMap = GetMaterialTexture(srgLayerPrefix##m_clearCoatRoughnessMap); \
|
|
|
inputs.m_clearCoatRoughnessMapUvIndex = srgLayerPrefix##m_clearCoatRoughnessMapUvIndex; \
|
|
|
inputs.m_clearCoatRoughness = srgLayerPrefix##m_clearCoatRoughness; \
|
|
|
inputs.m_clearCoat_roughness_useTexture = optionsLayerPrefix##o_clearCoat_roughness_useTexture; \
|
|
|
- inputs.m_clearCoatNormalMap = srgLayerPrefix##m_clearCoatNormalMap; \
|
|
|
+ inputs.m_clearCoatNormalMap = GetMaterialTexture(srgLayerPrefix##m_clearCoatNormalMap); \
|
|
|
inputs.m_clearCoatNormalMapUvIndex = srgLayerPrefix##m_clearCoatNormalMapUvIndex; \
|
|
|
inputs.m_clearCoat_normal_useTexture = optionsLayerPrefix##o_clearCoat_normal_useTexture; \
|
|
|
inputs.m_clearCoatNormalStrength = srgLayerPrefix##m_clearCoatNormalStrength;
|
|
@@ -435,6 +440,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
#include <Atom/Feature/Common/Assets/Shaders/Materials/StandardPBR/StandardPBR_SurfaceData.azsli>
|
|
|
|
|
|
Surface EvaluateSurface_StandardMultilayerPBR(
|
|
|
+ const MaterialParameters params,
|
|
|
float3 positionWS,
|
|
|
float3 normalWS,
|
|
|
float3 tangents[UvSetCount],
|
|
@@ -452,15 +458,16 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
|
|
|
if(o_debugDrawMode == DebugDrawMode::BlendMask)
|
|
|
{
|
|
|
- real3 blendMaskValues = GetApplicableBlendMaskValues(blendSource, uvs[MaterialSrg::m_blendMaskUvIndex], vertexBlendMask, uvDxDy, customDerivatives);
|
|
|
+ real3 blendMaskValues = GetApplicableBlendMaskValues(params, blendSource, uvs[params.m_blendMaskUvIndex], vertexBlendMask, uvDxDy, customDerivatives);
|
|
|
return MakeDebugSurface(positionWS, normalWS, real3(blendMaskValues));
|
|
|
}
|
|
|
|
|
|
if(o_debugDrawMode == DebugDrawMode::Displacement)
|
|
|
{
|
|
|
- real startDepth = real(-MaterialSrg::m_displacementMax);
|
|
|
- real stopDepth = real(-MaterialSrg::m_displacementMin);
|
|
|
- real depth = GetNormalizedDepth(startDepth, stopDepth, uvs[MaterialSrg::m_parallaxUvIndex], real2(0,0), real2(0,0));
|
|
|
+ real startDepth = real(-params.m_displacementMax);
|
|
|
+ real stopDepth = real(-params.m_displacementMin);
|
|
|
+ // the heightmap and sampler doesn't matter here, since they will simply be passed on to the GetDepth() - function in StandardMultiLayerPBR_Common.azsli, which ignores them.
|
|
|
+ real depth = GetNormalizedDepth(GetMaterialTexture(params.m_layer1_m_heightmap), GetMaterialTextureSampler(), startDepth, stopDepth, uvs[params.m_parallaxUvIndex], real2(0,0), real2(0,0));
|
|
|
real height = 1 - saturate(depth);
|
|
|
return MakeDebugSurface(positionWS, normalWS, real3(height,height,height));
|
|
|
}
|
|
@@ -470,11 +477,11 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
real3 blendWeights;
|
|
|
if (customDerivatives)
|
|
|
{
|
|
|
- blendWeights = GetBlendWeights(blendSource, uvs[MaterialSrg::m_blendMaskUvIndex], vertexBlendMask, uvDxDy, customDerivatives);
|
|
|
+ blendWeights = GetBlendWeights(params, blendSource, uvs[params.m_blendMaskUvIndex], vertexBlendMask, uvDxDy, customDerivatives);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- blendWeights = GetBlendWeights(blendSource, uvs[MaterialSrg::m_blendMaskUvIndex], vertexBlendMask, float4(0.0f, 0.0f, 0.0f, 0.0f), false);
|
|
|
+ blendWeights = GetBlendWeights(params, blendSource, uvs[params.m_blendMaskUvIndex], vertexBlendMask, float4(0.0f, 0.0f, 0.0f, 0.0f), false);
|
|
|
}
|
|
|
return MakeDebugSurface(positionWS, normalWS, real3(blendWeights));
|
|
|
}
|
|
@@ -485,11 +492,11 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
real3 blendWeights;
|
|
|
if (customDerivatives)
|
|
|
{
|
|
|
- blendWeights = real3(GetBlendWeights(blendSource, uvs[MaterialSrg::m_blendMaskUvIndex], vertexBlendMask, uvDxDy, customDerivatives));
|
|
|
+ blendWeights = real3(GetBlendWeights(params, blendSource, uvs[params.m_blendMaskUvIndex], vertexBlendMask, uvDxDy, customDerivatives));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- blendWeights = real3(GetBlendWeights(blendSource, uvs[MaterialSrg::m_blendMaskUvIndex], vertexBlendMask, float4(0.0f, 0.0f, 0.0f, 0.0f), false));
|
|
|
+ blendWeights = real3(GetBlendWeights(params, blendSource, uvs[params.m_blendMaskUvIndex], vertexBlendMask, float4(0.0f, 0.0f, 0.0f, 0.0f), false));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -499,8 +506,8 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
if(blendWeights.r > 0)
|
|
|
{
|
|
|
StandardMaterialInputs inputs;
|
|
|
- FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer1_, o_layer1_, blendWeights.r)
|
|
|
- FILL_STANDARD_MATERIAL_INPUTS_CLEAR_COAT(inputs, MaterialSrg::m_layer1_, o_layer1_, blendWeights.r)
|
|
|
+ FILL_STANDARD_MATERIAL_INPUTS(inputs, params.m_layer1_, o_layer1_, blendWeights.r)
|
|
|
+ FILL_STANDARD_MATERIAL_INPUTS_CLEAR_COAT(inputs, params.m_layer1_, o_layer1_, blendWeights.r)
|
|
|
lightingInputLayer1 = ProcessStandardMaterialInputs(inputs, uvDxDy, customDerivatives);
|
|
|
}
|
|
|
else
|
|
@@ -515,8 +522,8 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
if(o_layer2_enabled && blendWeights.g > 0)
|
|
|
{
|
|
|
StandardMaterialInputs inputs;
|
|
|
- FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer2_, o_layer2_, blendWeights.g)
|
|
|
- FILL_STANDARD_MATERIAL_INPUTS_CLEAR_COAT(inputs, MaterialSrg::m_layer2_, o_layer2_, blendWeights.g)
|
|
|
+ FILL_STANDARD_MATERIAL_INPUTS(inputs, params.m_layer2_, o_layer2_, blendWeights.g)
|
|
|
+ FILL_STANDARD_MATERIAL_INPUTS_CLEAR_COAT(inputs, params.m_layer2_, o_layer2_, blendWeights.g)
|
|
|
lightingInputLayer2 = ProcessStandardMaterialInputs(inputs, uvDxDy, customDerivatives);
|
|
|
}
|
|
|
else
|
|
@@ -531,8 +538,8 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
if(o_layer3_enabled && blendWeights.b > 0)
|
|
|
{
|
|
|
StandardMaterialInputs inputs;
|
|
|
- FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer3_, o_layer3_, blendWeights.b)
|
|
|
- FILL_STANDARD_MATERIAL_INPUTS_CLEAR_COAT(inputs, MaterialSrg::m_layer3_, o_layer3_, blendWeights.b)
|
|
|
+ FILL_STANDARD_MATERIAL_INPUTS(inputs, params.m_layer3_, o_layer3_, blendWeights.b)
|
|
|
+ FILL_STANDARD_MATERIAL_INPUTS_CLEAR_COAT(inputs, params.m_layer3_, o_layer3_, blendWeights.b)
|
|
|
lightingInputLayer3 = ProcessStandardMaterialInputs(inputs, uvDxDy, customDerivatives);
|
|
|
}
|
|
|
else
|
|
@@ -563,7 +570,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
}
|
|
|
// [GFX TODO][ATOM-14591]: This will only work if the normal maps all use the same UV stream. We would need to add support for having them in different UV streams.
|
|
|
surface.vertexNormal = normalWS;
|
|
|
- surface.normal = normalize(TangentSpaceToWorld(normalTS, normalWS, tangents[MaterialSrg::m_parallaxUvIndex], bitangents[MaterialSrg::m_parallaxUvIndex]));
|
|
|
+ surface.normal = normalize(TangentSpaceToWorld(normalTS, normalWS, tangents[params.m_parallaxUvIndex], bitangents[params.m_parallaxUvIndex]));
|
|
|
|
|
|
// ------- Combine Albedo, roughness, specular, roughness ---------
|
|
|
|
|
@@ -609,6 +616,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
// helper function to keep compatible with the previous version
|
|
|
// because dxc compiler doesn't allow default parameters on functions with overloads
|
|
|
Surface EvaluateSurface_StandardMultilayerPBR(
|
|
|
+ const MaterialParameters params,
|
|
|
float3 positionWS,
|
|
|
real3 normalWS,
|
|
|
float3 tangents[UvSetCount],
|
|
@@ -619,6 +627,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
real3 vertexBlendMask)
|
|
|
{
|
|
|
return EvaluateSurface_StandardMultilayerPBR(
|
|
|
+ params,
|
|
|
positionWS,
|
|
|
normalWS,
|
|
|
tangents,
|
|
@@ -631,9 +640,10 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
false);
|
|
|
}
|
|
|
|
|
|
- Surface EvaluateSurface_StandardMultilayerPBR(VsOutput IN, PixelGeometryData geoData, float4 uvDxDy, bool customDerivatives)
|
|
|
+ Surface EvaluateSurface_StandardMultilayerPBR(VsOutput IN, PixelGeometryData geoData, const MaterialParameters params, float4 uvDxDy, bool customDerivatives)
|
|
|
{
|
|
|
return EvaluateSurface_StandardMultilayerPBR(
|
|
|
+ params,
|
|
|
geoData.positionWS,
|
|
|
geoData.vertexNormal,
|
|
|
geoData.tangents,
|
|
@@ -646,9 +656,10 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
customDerivatives);
|
|
|
}
|
|
|
|
|
|
- Surface EvaluateSurface_StandardMultilayerPBR(VsOutput IN, PixelGeometryData geoData)
|
|
|
+ Surface EvaluateSurface_StandardMultilayerPBR(VsOutput IN, PixelGeometryData geoData, const MaterialParameters params)
|
|
|
{
|
|
|
return EvaluateSurface_StandardMultilayerPBR(
|
|
|
+ params,
|
|
|
geoData.positionWS,
|
|
|
geoData.vertexNormal,
|
|
|
geoData.tangents,
|
|
@@ -675,7 +686,7 @@ option enum class OpacityMode {Opaque, Cutout, Blended, TintedTransparent} o_opa
|
|
|
return ShouldHandleParallax();
|
|
|
}
|
|
|
|
|
|
- void EvaluateSurface(VsOutput IN, PixelGeometryData geoData)
|
|
|
+ void EvaluateSurface(VsOutput IN, PixelGeometryData geoData, const MaterialParameters params)
|
|
|
{
|
|
|
// do nothing, this is where alpha clip can be done if it's supported
|
|
|
}
|