Hair - Adding the Hair Gem to the automated testing (#4498)
* Hair - Adding the Hair Gem to the automated testing Signed-off-by: Adi-Amazon <barlev@amazon.com> * Hair - added FP protection when not initialized Signed-off-by: Adi-Amazon <barlev@amazon.com> * Hair - renaming shader options for longtitude / azimuth contribution separation Signed-off-by: Adi-Amazon <barlev@amazon.com>
This commit is contained in:
@@ -3,9 +3,15 @@
|
||||
"Version": 1,
|
||||
"ClassName": "GlobalBuildOptions",
|
||||
"ClassData": {
|
||||
"ShaderCompilerArguments" : {
|
||||
"DefaultMatrixOrder" : "Row",
|
||||
"AzslcAdditionalFreeArguments" : "--strip-unused-srgs"
|
||||
"ShaderCompilerArguments": {
|
||||
"DefaultMatrixOrder": "Row",
|
||||
"AzslcAdditionalFreeArguments": "--strip-unused-srgs"
|
||||
},
|
||||
"PreprocessorOptions": {
|
||||
"predefinedMacros": [ "AZSL=17" ],
|
||||
"projectIncludePaths": [
|
||||
"Gems/AtomTressFX/Assets/Shaders"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ set(ENABLED_GEMS
|
||||
|
||||
Camera
|
||||
EMotionFX
|
||||
AtomTressFX
|
||||
PhysX
|
||||
CameraFramework
|
||||
StartingPointMovement
|
||||
@@ -52,9 +53,6 @@ set(ENABLED_GEMS
|
||||
AWSCore
|
||||
AWSClientAuth
|
||||
AWSMetrics
|
||||
|
||||
|
||||
|
||||
|
||||
AudioSystem
|
||||
)
|
||||
|
||||
@@ -51,6 +51,14 @@
|
||||
[
|
||||
"Gems/UiBasics"
|
||||
]
|
||||
},
|
||||
"Hair":
|
||||
{
|
||||
"SourcePaths":
|
||||
[
|
||||
"Gems/AtomTressFX/Assets",
|
||||
"Gems/AtomTressFX/Assets/Passes"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,8 @@ option bool o_enableMarschner_R = true;
|
||||
option bool o_enableMarschner_TRT = true;
|
||||
option bool o_enableMarschner_TT = true;
|
||||
|
||||
option bool o_enableDiffuseLobe = true;
|
||||
option bool o_enableSpecularLobe = true;
|
||||
option bool o_enableTransmittanceLobe = true;
|
||||
option bool o_enableLongtitudeCoeff = true;
|
||||
option bool o_enableAzimuthCoeff = true;
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Longitudinal functions (M_R, M_TT, M_RTR)
|
||||
@@ -196,8 +195,8 @@ float3 HairMarschnerBSDF(Surface surface, LightingData lightingData, const float
|
||||
// R Path - single reflection from the hair towards the eye.
|
||||
if (o_enableMarschner_R)
|
||||
{
|
||||
float lighting_R = o_enableDiffuseLobe ? M_R(surface, Lh, sinLiPlusSinLr) : 1.0f;
|
||||
if (o_enableSpecularLobe)
|
||||
float lighting_R = o_enableLongtitudeCoeff ? M_R(surface, Lh, sinLiPlusSinLr) : 1.0f;
|
||||
if (o_enableAzimuthCoeff)
|
||||
lighting_R *= N_R(surface, cos_O2, Wi, Wr, f0);
|
||||
|
||||
// The following lines are a cheap method to get occluded reflection by accoounting
|
||||
@@ -221,8 +220,8 @@ float3 HairMarschnerBSDF(Surface surface, LightingData lightingData, const float
|
||||
// on the average thickness.
|
||||
if (o_enableMarschner_TT)
|
||||
{
|
||||
float3 lighting_TT = o_enableDiffuseLobe ? M_TT(surface, Lh, sinLiPlusSinLr) : float3(1.0f, 1.0f, 1.0f);
|
||||
if (o_enableSpecularLobe)
|
||||
float3 lighting_TT = o_enableLongtitudeCoeff ? M_TT(surface, Lh, sinLiPlusSinLr) : float3(1.0f, 1.0f, 1.0f);
|
||||
if (o_enableAzimuthCoeff)
|
||||
lighting_TT *= N_TT(surface, n2, cos_O, cos_O2, cos_Ld, f0);
|
||||
|
||||
// Reduce back transmittance based on the thickness of the hair
|
||||
@@ -234,8 +233,8 @@ float3 HairMarschnerBSDF(Surface surface, LightingData lightingData, const float
|
||||
// the hair towards the eye.
|
||||
if (o_enableMarschner_TRT)
|
||||
{
|
||||
float3 lighting_TRT = o_enableDiffuseLobe ? M_TRT(surface, Lh, sinLiPlusSinLr) : float3(1.0f, 1.0f, 1.0f);
|
||||
if (o_enableSpecularLobe)
|
||||
float3 lighting_TRT = o_enableLongtitudeCoeff ? M_TRT(surface, Lh, sinLiPlusSinLr) : float3(1.0f, 1.0f, 1.0f);
|
||||
if (o_enableAzimuthCoeff)
|
||||
lighting_TRT *= N_TRT(surface, cos_O, cos_Ld, f0);
|
||||
lighting += lighting_TRT;
|
||||
}
|
||||
|
||||
@@ -47,9 +47,8 @@ namespace AZ
|
||||
shaderOption.SetValue(AZ::Name("o_enableMarschner_R"), AZ::RPI::ShaderOptionValue{ m_hairGlobalSettings.m_enableMarschner_R });
|
||||
shaderOption.SetValue(AZ::Name("o_enableMarschner_TRT"), AZ::RPI::ShaderOptionValue{ m_hairGlobalSettings.m_enableMarschner_TRT });
|
||||
shaderOption.SetValue(AZ::Name("o_enableMarschner_TT"), AZ::RPI::ShaderOptionValue{ m_hairGlobalSettings.m_enableMarschner_TT });
|
||||
shaderOption.SetValue(AZ::Name("o_enableDiffuseLobe"), AZ::RPI::ShaderOptionValue{ m_hairGlobalSettings.m_enableDiffuseLobe });
|
||||
shaderOption.SetValue(AZ::Name("o_enableSpecularLobe"), AZ::RPI::ShaderOptionValue{ m_hairGlobalSettings.m_enableSpecularLobe });
|
||||
shaderOption.SetValue(AZ::Name("o_enableTransmittanceLobe"), AZ::RPI::ShaderOptionValue{ m_hairGlobalSettings.m_enableTransmittanceLobe });
|
||||
shaderOption.SetValue(AZ::Name("o_enableLongtitudeCoeff"), AZ::RPI::ShaderOptionValue{ m_hairGlobalSettings.m_enableLongtitudeCoeff });
|
||||
shaderOption.SetValue(AZ::Name("o_enableAzimuthCoeff"), AZ::RPI::ShaderOptionValue{ m_hairGlobalSettings.m_enableAzimuthCoeff });
|
||||
|
||||
m_shaderOptions = shaderOption.GetShaderVariantKeyFallbackValue();
|
||||
}
|
||||
|
||||
@@ -135,6 +135,11 @@ namespace AZ
|
||||
|
||||
void HairFeatureProcessor::EnablePasses(bool enable)
|
||||
{
|
||||
if (!m_initialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& [passName, pass] : m_computePasses)
|
||||
{
|
||||
pass->SetEnabled(enable);
|
||||
@@ -339,14 +344,14 @@ namespace AZ
|
||||
resultSuccess &= InitPPLLFillPass();
|
||||
resultSuccess &= InitPPLLResolvePass();
|
||||
|
||||
m_initialized = resultSuccess;
|
||||
|
||||
// Don't enable passes if no hair object was added yet (depending on activation order)
|
||||
if (m_hairRenderObjects.empty())
|
||||
if (m_initialized && m_hairRenderObjects.empty())
|
||||
{
|
||||
EnablePasses(false);
|
||||
}
|
||||
|
||||
m_initialized = resultSuccess;
|
||||
|
||||
// this might not be an error - if the pass system is still empty / minimal
|
||||
// and these passes are not part of the minimal pipeline, they will not
|
||||
// be created.
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace AZ
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<HairGlobalSettings>()
|
||||
->Version(2)
|
||||
->Version(3)
|
||||
->Field("EnableShadows", &HairGlobalSettings::m_enableShadows)
|
||||
->Field("EnableDirectionalLights", &HairGlobalSettings::m_enableDirectionalLights)
|
||||
->Field("EnablePunctualLights", &HairGlobalSettings::m_enablePunctualLights)
|
||||
@@ -31,9 +31,8 @@ namespace AZ
|
||||
->Field("EnableMarschner_R", &HairGlobalSettings::m_enableMarschner_R)
|
||||
->Field("EnableMarschner_TRT", &HairGlobalSettings::m_enableMarschner_TRT)
|
||||
->Field("EnableMarschner_TT", &HairGlobalSettings::m_enableMarschner_TT)
|
||||
->Field("EnableDiffuseLobe", &HairGlobalSettings::m_enableDiffuseLobe)
|
||||
->Field("EnableSpecularLobe", &HairGlobalSettings::m_enableSpecularLobe)
|
||||
->Field("EnableTransmittanceLobe", &HairGlobalSettings::m_enableTransmittanceLobe)
|
||||
->Field("EnableLongtitudeCoeff", &HairGlobalSettings::m_enableLongtitudeCoeff)
|
||||
->Field("EnableAzimuthCoeff", &HairGlobalSettings::m_enableAzimuthCoeff)
|
||||
;
|
||||
|
||||
if (auto editContext = serializeContext->GetEditContext())
|
||||
@@ -51,9 +50,8 @@ namespace AZ
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &HairGlobalSettings::m_enableMarschner_R, "Enable Marschner R", "Enable Marschner R.")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &HairGlobalSettings::m_enableMarschner_TRT, "Enable Marschner TRT", "Enable Marschner TRT.")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &HairGlobalSettings::m_enableMarschner_TT, "Enable Marschner TT", "Enable Marschner TT.")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &HairGlobalSettings::m_enableDiffuseLobe, "Enable Diffuse Lobe", "Enable Diffuse Lobe.")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &HairGlobalSettings::m_enableSpecularLobe, "Enable Specular Lobe", "Enable Specular Lobe.")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &HairGlobalSettings::m_enableTransmittanceLobe, "Enable Transmittance Lobe", "Enable Transmittance Lobe.")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &HairGlobalSettings::m_enableLongtitudeCoeff, "Enable Longtitude", "Enable Longtitude Contribution")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &HairGlobalSettings::m_enableAzimuthCoeff, "Enable Azimuth", "Enable Azimuth Contribution")
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,8 @@ namespace AZ
|
||||
bool m_enableMarschner_R = true;
|
||||
bool m_enableMarschner_TRT = true;
|
||||
bool m_enableMarschner_TT = true;
|
||||
bool m_enableDiffuseLobe = true;
|
||||
bool m_enableSpecularLobe = true;
|
||||
bool m_enableTransmittanceLobe = true;
|
||||
bool m_enableLongtitudeCoeff = true;
|
||||
bool m_enableAzimuthCoeff = true;
|
||||
};
|
||||
} // namespace Hair
|
||||
} // namespace Render
|
||||
|
||||
Reference in New Issue
Block a user