ATOM-15133 "Clean Up EnhancedPBR"
Updated material type files for StandardPBR, EnhancedPBR, and Skin to align with each other as much as possible. There were minor cases like some property settings were different, properties in different order, comments, and formatting. There were major cases as well, like EnhancedPBR using clunky built in functors where lua functors would be better, property visibility state wasn't right, properties were missing, etc. I also added a new HasShaderWithTag function for lua functors. This is used in StandardPBR_ShaderEnable.lua to allow this script to be used for both StandardPBR and EnhancedPBR (EnhancedPBR doesn't have the low end pipeline shaders).
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -287,6 +287,13 @@
|
||||
"id": "m_specularF0Map"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "useTexture",
|
||||
"displayName": "Use Texture",
|
||||
"description": "Whether to use the texture map, or just default to the Factor value.",
|
||||
"type": "Bool",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "textureMapUv",
|
||||
"displayName": "UV",
|
||||
@@ -299,13 +306,7 @@
|
||||
"id": "m_specularF0MapUvIndex"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "useTexture",
|
||||
"displayName": "Use Texture",
|
||||
"description": "Whether to use the texture map, or just default to the Factor value.",
|
||||
"type": "Bool",
|
||||
"defaultValue": true
|
||||
},
|
||||
// Consider moving this to the "general" group to be consistent with StandardMultilayerPBR
|
||||
{
|
||||
"id": "enableMultiScatterCompensation",
|
||||
"displayName": "Multiscattering Compensation",
|
||||
@@ -616,7 +617,7 @@
|
||||
"type": "float",
|
||||
"defaultValue": 6.0,
|
||||
"min": 0.0,
|
||||
"softMax": 20.0
|
||||
"softMax": 20.0
|
||||
},
|
||||
{
|
||||
"id": "transmissionDistortion",
|
||||
@@ -1011,18 +1012,18 @@
|
||||
"type": "HandleSubsurfaceScatteringParameters",
|
||||
"args": {
|
||||
"mode": "subsurfaceScattering.transmissionMode",
|
||||
"scale" : "subsurfaceScattering.transmissionScale",
|
||||
"power" : "subsurfaceScattering.transmissionPower",
|
||||
"distortion" : "subsurfaceScattering.transmissionDistortion",
|
||||
"attenuation" : "subsurfaceScattering.transmissionAttenuation",
|
||||
"tintColor" : "subsurfaceScattering.transmissionTint",
|
||||
"thickness" : "subsurfaceScattering.thickness",
|
||||
"scale": "subsurfaceScattering.transmissionScale",
|
||||
"power": "subsurfaceScattering.transmissionPower",
|
||||
"distortion": "subsurfaceScattering.transmissionDistortion",
|
||||
"attenuation": "subsurfaceScattering.transmissionAttenuation",
|
||||
"tintColor": "subsurfaceScattering.transmissionTint",
|
||||
"thickness": "subsurfaceScattering.thickness",
|
||||
"enabled": "subsurfaceScattering.enableSubsurfaceScattering",
|
||||
"scatterDistanceColor" : "subsurfaceScattering.scatterColor",
|
||||
"scatterDistanceIntensity" : "subsurfaceScattering.scatterDistance",
|
||||
"scatterDistanceShaderInput" : "m_scatterDistance",
|
||||
"parametersShaderInput" : "m_transmissionParams",
|
||||
"tintThickenssShaderInput" : "m_transmissionTintThickness"
|
||||
"scatterDistanceColor": "subsurfaceScattering.scatterColor",
|
||||
"scatterDistanceIntensity": "subsurfaceScattering.scatterDistance",
|
||||
"scatterDistanceShaderInput": "m_scatterDistance",
|
||||
"parametersShaderInput": "m_transmissionParams",
|
||||
"tintThickenssShaderInput": "m_transmissionTintThickness"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1038,8 +1039,8 @@
|
||||
"type": "UseTexture",
|
||||
"args": {
|
||||
"textureProperty": "specularF0.textureMap",
|
||||
"dependentProperties": ["specularF0.textureMapUv"],
|
||||
"useTextureProperty": "specularF0.useTexture",
|
||||
"dependentProperties": ["specularF0.textureMapUv"],
|
||||
"shaderOption": "o_specularF0_useTexture"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -674,7 +674,7 @@
|
||||
{
|
||||
"id": "tileU",
|
||||
"displayName": "Tile U",
|
||||
"description": "Scales texture coordinates in V.",
|
||||
"description": "Scales texture coordinates in U.",
|
||||
"type": "float",
|
||||
"defaultValue": 1.0,
|
||||
"step": 0.1
|
||||
@@ -1139,7 +1139,7 @@
|
||||
"type": "float",
|
||||
"defaultValue": 6.0,
|
||||
"min": 0.0,
|
||||
"softMax": 20.0
|
||||
"softMax": 20.0
|
||||
},
|
||||
{
|
||||
"id": "transmissionDistortion",
|
||||
@@ -1170,7 +1170,7 @@
|
||||
}
|
||||
],
|
||||
"irradiance": [
|
||||
// Note: this property group is used in the DiffuseGlobalIllumination pass, it is not read by the StandardPBR shader
|
||||
// Note: this property group is used in the DiffuseGlobalIllumination pass and not by the main forward shader
|
||||
{
|
||||
"id": "color",
|
||||
"displayName": "Color",
|
||||
@@ -1277,18 +1277,18 @@
|
||||
"type": "HandleSubsurfaceScatteringParameters",
|
||||
"args": {
|
||||
"mode": "subsurfaceScattering.transmissionMode",
|
||||
"scale" : "subsurfaceScattering.transmissionScale",
|
||||
"power" : "subsurfaceScattering.transmissionPower",
|
||||
"distortion" : "subsurfaceScattering.transmissionDistortion",
|
||||
"attenuation" : "subsurfaceScattering.transmissionAttenuation",
|
||||
"tintColor" : "subsurfaceScattering.transmissionTint",
|
||||
"thickness" : "subsurfaceScattering.thickness",
|
||||
"scale": "subsurfaceScattering.transmissionScale",
|
||||
"power": "subsurfaceScattering.transmissionPower",
|
||||
"distortion": "subsurfaceScattering.transmissionDistortion",
|
||||
"attenuation": "subsurfaceScattering.transmissionAttenuation",
|
||||
"tintColor": "subsurfaceScattering.transmissionTint",
|
||||
"thickness": "subsurfaceScattering.thickness",
|
||||
"enabled": "subsurfaceScattering.enableSubsurfaceScattering",
|
||||
"scatterDistanceColor" : "subsurfaceScattering.scatterColor",
|
||||
"scatterDistanceIntensity" : "subsurfaceScattering.scatterDistance",
|
||||
"scatterDistanceShaderInput" : "m_scatterDistance",
|
||||
"parametersShaderInput" : "m_transmissionParams",
|
||||
"tintThickenssShaderInput" : "m_transmissionTintThickness"
|
||||
"scatterDistanceColor": "subsurfaceScattering.scatterColor",
|
||||
"scatterDistanceIntensity": "subsurfaceScattering.scatterDistance",
|
||||
"scatterDistanceShaderInput": "m_scatterDistance",
|
||||
"parametersShaderInput": "m_transmissionParams",
|
||||
"tintThickenssShaderInput": "m_transmissionTintThickness"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -21,6 +21,20 @@ OpacityMode_Cutout = 1
|
||||
OpacityMode_Blended = 2
|
||||
OpacityMode_TintedTransparent = 3
|
||||
|
||||
function TryGetShaderByTag(context, shaderTag)
|
||||
if context:HasShaderWithTag(shaderTag) then
|
||||
return context:GetShaderByTag(shaderTag)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function TrySetShaderEnabled(shader, enabled)
|
||||
if shader then
|
||||
shader:SetEnabled(enabled)
|
||||
end
|
||||
end
|
||||
|
||||
function Process(context)
|
||||
local opacityMode = context:GetMaterialPropertyValue_enum("opacity.mode")
|
||||
local parallaxEnabled = context:GetMaterialPropertyValue_bool("parallax.enable")
|
||||
@@ -29,33 +43,37 @@ function Process(context)
|
||||
local depthPass = context:GetShaderByTag("DepthPass")
|
||||
local shadowMap = context:GetShaderByTag("Shadowmap")
|
||||
local forwardPassEDS = context:GetShaderByTag("ForwardPass_EDS")
|
||||
local lowEndForwardEDS = context:GetShaderByTag("LowEndForward_EDS")
|
||||
|
||||
local depthPassWithPS = context:GetShaderByTag("DepthPass_WithPS")
|
||||
local shadowMapWithPS = context:GetShaderByTag("Shadowmap_WithPS")
|
||||
local forwardPass = context:GetShaderByTag("ForwardPass")
|
||||
local lowEndForward = context:GetShaderByTag("LowEndForward")
|
||||
|
||||
-- Use TryGetShaderByTag because these shaders only exist in StandardPBR but this script is also used for EnhancedPBR
|
||||
local lowEndForwardEDS = TryGetShaderByTag(context, "LowEndForward_EDS")
|
||||
local lowEndForward = TryGetShaderByTag(context, "LowEndForward")
|
||||
|
||||
if parallaxEnabled and parallaxPdoEnabled then
|
||||
depthPass:SetEnabled(false)
|
||||
shadowMap:SetEnabled(false)
|
||||
forwardPassEDS:SetEnabled(false)
|
||||
lowEndForwardEDS:SetEnabled(false)
|
||||
|
||||
depthPassWithPS:SetEnabled(true)
|
||||
shadowMapWithPS:SetEnabled(true)
|
||||
forwardPass:SetEnabled(true)
|
||||
lowEndForward:SetEnabled(true)
|
||||
|
||||
TrySetShaderEnabled(lowEndForwardEDS, false)
|
||||
TrySetShaderEnabled(lowEndForward, true)
|
||||
else
|
||||
depthPass:SetEnabled(opacityMode == OpacityMode_Opaque)
|
||||
shadowMap:SetEnabled(opacityMode == OpacityMode_Opaque)
|
||||
forwardPassEDS:SetEnabled((opacityMode == OpacityMode_Opaque) or (opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
|
||||
lowEndForwardEDS:SetEnabled((opacityMode == OpacityMode_Opaque) or (opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
|
||||
|
||||
depthPassWithPS:SetEnabled(opacityMode == OpacityMode_Cutout)
|
||||
shadowMapWithPS:SetEnabled(opacityMode == OpacityMode_Cutout)
|
||||
forwardPass:SetEnabled(opacityMode == OpacityMode_Cutout)
|
||||
lowEndForward:SetEnabled(opacityMode == OpacityMode_Cutout)
|
||||
|
||||
TrySetShaderEnabled(lowEndForwardEDS, (opacityMode == OpacityMode_Opaque) or (opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
|
||||
TrySetShaderEnabled(lowEndForward, opacityMode == OpacityMode_Cutout)
|
||||
end
|
||||
|
||||
context:GetShaderByTag("DepthPassTransparentMin"):SetEnabled((opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent))
|
||||
|
||||
@@ -288,6 +288,7 @@ namespace AZ
|
||||
AZStd::size_t GetShaderCount() const;
|
||||
LuaMaterialFunctorShaderItem GetShader(AZStd::size_t index);
|
||||
LuaMaterialFunctorShaderItem GetShaderByTag(const char* shaderTag);
|
||||
bool HasShaderWithTag(const char* shaderTag);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -296,6 +296,7 @@ namespace AZ
|
||||
->Method("GetShaderCount", &LuaMaterialFunctorRuntimeContext::GetShaderCount)
|
||||
->Method("GetShader", &LuaMaterialFunctorRuntimeContext::GetShader)
|
||||
->Method("GetShaderByTag", &LuaMaterialFunctorRuntimeContext::GetShaderByTag)
|
||||
->Method("HasShaderWithTag", &LuaMaterialFunctorRuntimeContext::HasShaderWithTag)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -424,6 +425,11 @@ namespace AZ
|
||||
return LuaMaterialFunctorShaderItem{nullptr};
|
||||
}
|
||||
}
|
||||
|
||||
bool LuaMaterialFunctorRuntimeContext::HasShaderWithTag(const char* shaderTag)
|
||||
{
|
||||
return m_runtimeContextImpl->m_shaderCollection->HasShaderTag(AZ::Name{shaderTag});
|
||||
}
|
||||
|
||||
void LuaMaterialFunctorEditorContext::LuaMaterialFunctorEditorContext::Reflect(BehaviorContext* behaviorContext)
|
||||
{
|
||||
|
||||
-1
@@ -6,7 +6,6 @@
|
||||
"properties": {
|
||||
"subsurfaceScattering": {
|
||||
"enableSubsurfaceScattering": true,
|
||||
"enableTransmission": true,
|
||||
"scatterDistance": 64.6464614868164,
|
||||
"subsurfaceScatterFactor": 1.0,
|
||||
"thicknessMap": "TestData/Textures/checker8x8_512.png",
|
||||
|
||||
Reference in New Issue
Block a user