Removed subsurface scattering and transmission features from StandardPBR.materialtype.
ATOM-4120 Stabilize Standard PBR Regarding Subsurface and Translucency
This commit is contained in:
@@ -1636,7 +1636,7 @@
|
||||
{
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
"file": "StandardPBR_SubsurfaceState.lua"
|
||||
"file": "EnhancedPBR_SubsurfaceState.lua"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1080,7 +1080,7 @@
|
||||
{
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
"file": "StandardPBR_SubsurfaceState.lua"
|
||||
"file": "EnhancedPBR_SubsurfaceState.lua"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -38,11 +38,6 @@
|
||||
"displayName": "Emissive",
|
||||
"description": "Properties to add light emission, independent of other lights in the scene."
|
||||
},
|
||||
{
|
||||
"id": "subsurfaceScattering",
|
||||
"displayName": "Subsurface Scattering",
|
||||
"description": "Properties for configuring subsurface scattering effects."
|
||||
},
|
||||
{
|
||||
"id": "clearCoat",
|
||||
"displayName": "Clear Coat",
|
||||
@@ -981,183 +976,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"subsurfaceScattering": [
|
||||
{
|
||||
"id": "enableSubsurfaceScattering",
|
||||
"displayName": "Subsurface Scattering",
|
||||
"description": "Enable subsurface scattering feature, this will disable metallic and parallax mapping property due to incompatibility",
|
||||
"type": "Bool",
|
||||
"defaultValue": false,
|
||||
"connection": {
|
||||
"type": "ShaderOption",
|
||||
"id": "o_enableSubsurfaceScattering"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "subsurfaceScatterFactor",
|
||||
"displayName": " Factor",
|
||||
"description": "Strength factor for scaling percentage of subsurface scattering effect applied",
|
||||
"type": "float",
|
||||
"defaultValue": 1.0,
|
||||
"min": 0.0,
|
||||
"max": 1.0,
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_subsurfaceScatteringFactor"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "influenceMap",
|
||||
"displayName": " Influence Map",
|
||||
"description": "Texture for controlling the strength of subsurface scattering",
|
||||
"type": "Image",
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_subsurfaceScatteringInfluenceMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "useInfluenceMap",
|
||||
"displayName": " Use Influence Map",
|
||||
"description": "Whether to use the influence map.",
|
||||
"type": "Bool",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "influenceMapUv",
|
||||
"displayName": " UV",
|
||||
"description": "Influence map UV set",
|
||||
"type": "Enum",
|
||||
"enumIsUv": true,
|
||||
"defaultValue": "Tiled",
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_subsurfaceScatteringInfluenceMapUvIndex"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "scatterColor",
|
||||
"displayName": " Scatter color",
|
||||
"description": "Color of volume light traveled through",
|
||||
"type": "Color",
|
||||
"defaultValue": [ 1.0, 0.27, 0.13 ]
|
||||
},
|
||||
{
|
||||
"id": "scatterDistance",
|
||||
"displayName": " Scatter distance",
|
||||
"description": "How far light traveled inside the volume",
|
||||
"type": "float",
|
||||
"defaultValue": 8,
|
||||
"min": 0.0,
|
||||
"softMax": 20.0
|
||||
},
|
||||
{
|
||||
"id": "quality",
|
||||
"displayName": " Quality",
|
||||
"description": "How much percent of sample will be used for each pixel, more samples improve quality and reduce artifacts, especially when the scatter distance is relatively large, but slow down computation time, 1.0 = full set 200 samples per pixel",
|
||||
"type": "float",
|
||||
"defaultValue": 0.4,
|
||||
"min": 0.2,
|
||||
"max": 1.0,
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_subsurfaceScatteringQuality"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "transmissionMode",
|
||||
"displayName": "Transmission",
|
||||
"description": "Algorithm used for calculating transmission",
|
||||
"type": "Enum",
|
||||
"enumValues": [ "None", "ThickObject", "ThinObject" ],
|
||||
"defaultValue": "None",
|
||||
"connection": {
|
||||
"type": "ShaderOption",
|
||||
"id": "o_transmission_mode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "thickness",
|
||||
"displayName": " Thickness",
|
||||
"description": "Normalized global thickness, the maxima between this value (multiplied by thickness map if enabled) and thickness from shadow map (if applicable) will be used as final thickness of pixel",
|
||||
"type": "float",
|
||||
"defaultValue": 0.5,
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
{
|
||||
"id": "thicknessMap",
|
||||
"displayName": " Thickness Map",
|
||||
"description": "Texture for controlling per pixel thickness",
|
||||
"type": "Image",
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_transmissionThicknessMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "useThicknessMap",
|
||||
"displayName": " Use Thickness Map",
|
||||
"description": "Whether to use the thickness map",
|
||||
"type": "Bool",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "thicknessMapUv",
|
||||
"displayName": " UV",
|
||||
"description": "Thickness map UV set",
|
||||
"type": "Enum",
|
||||
"enumIsUv": true,
|
||||
"defaultValue": "Tiled",
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_transmissionThicknessMapUvIndex"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "transmissionTint",
|
||||
"displayName": " Transmission Tint",
|
||||
"description": "Color of the volume light traveling through",
|
||||
"type": "Color",
|
||||
"defaultValue": [ 1.0, 0.8, 0.6 ]
|
||||
},
|
||||
{
|
||||
"id": "transmissionPower",
|
||||
"displayName": " Power",
|
||||
"description": "How much transmitted light scatter radially ",
|
||||
"type": "float",
|
||||
"defaultValue": 6.0,
|
||||
"min": 0.0,
|
||||
"softMax": 20.0
|
||||
},
|
||||
{
|
||||
"id": "transmissionDistortion",
|
||||
"displayName": " Distortion",
|
||||
"description": "How much light direction distorted towards surface normal",
|
||||
"type": "float",
|
||||
"defaultValue": 0.1,
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
{
|
||||
"id": "transmissionAttenuation",
|
||||
"displayName": " Attenuation",
|
||||
"description": "How fast transmitted light fade with thickness",
|
||||
"type": "float",
|
||||
"defaultValue": 4.0,
|
||||
"min": 0.0,
|
||||
"softMax": 20.0
|
||||
},
|
||||
{
|
||||
"id": "transmissionScale",
|
||||
"displayName": " Scale",
|
||||
"description": "Strength of transmission",
|
||||
"type": "float",
|
||||
"defaultValue": 3.0,
|
||||
"min": 0.0,
|
||||
"softMax": 20.0
|
||||
}
|
||||
],
|
||||
"irradiance": [
|
||||
// Note: this property group is used in the DiffuseGlobalIllumination pass and not by the main forward shader
|
||||
{
|
||||
@@ -1261,25 +1079,6 @@
|
||||
"nitMinMax": [0.001, 100000.0]
|
||||
}
|
||||
},
|
||||
{
|
||||
// Preprocess & build parameter set for subsurface scattering and translucency
|
||||
"type": "HandleSubsurfaceScatteringParameters",
|
||||
"args": {
|
||||
"mode": "subsurfaceScattering.transmissionMode",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "UseTexture",
|
||||
"args": {
|
||||
@@ -1364,12 +1163,6 @@
|
||||
"file": "StandardPBR_Roughness.lua"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
"file": "StandardPBR_SubsurfaceState.lua"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
|
||||
@@ -73,25 +73,6 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
|
||||
MagFilter = Linear;
|
||||
MipFilter = Linear;
|
||||
};
|
||||
|
||||
// Parameters for subsurface scattering
|
||||
float m_subsurfaceScatteringFactor;
|
||||
float m_subsurfaceScatteringQuality;
|
||||
float3 m_scatterDistance;
|
||||
Texture2D m_subsurfaceScatteringInfluenceMap;
|
||||
uint m_subsurfaceScatteringInfluenceMapUvIndex;
|
||||
|
||||
// Parameters for transmission
|
||||
|
||||
// Elements of m_transmissionParams:
|
||||
// Thick object mode: (attenuation coefficient, power, distortion, scale)
|
||||
// Thin object mode: (float3 scatter distance, scale)
|
||||
float4 m_transmissionParams;
|
||||
|
||||
// (float3 TintColor, thickness)
|
||||
float4 m_transmissionTintThickness;
|
||||
Texture2D m_transmissionThicknessMap;
|
||||
uint m_transmissionThicknessMapUvIndex;
|
||||
}
|
||||
|
||||
// Callback function for ParallaxMapping.azsli
|
||||
|
||||
@@ -47,13 +47,6 @@ COMMON_OPTIONS_EMISSIVE()
|
||||
// Alpha
|
||||
#include "MaterialInputs/AlphaInput.azsli"
|
||||
|
||||
// Subsurface
|
||||
#include "MaterialInputs/SubsurfaceInput.azsli"
|
||||
|
||||
// Transmission
|
||||
#include "MaterialInputs/TransmissionInput.azsli"
|
||||
|
||||
|
||||
// ---------- Vertex Shader ----------
|
||||
|
||||
struct VSInput
|
||||
@@ -113,7 +106,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
float3 tangents[UvSetCount] = { IN.m_tangent.xyz, IN.m_tangent.xyz };
|
||||
float3 bitangents[UvSetCount] = { IN.m_bitangent.xyz, IN.m_bitangent.xyz };
|
||||
|
||||
if ((o_parallax_feature_enabled && !o_enableSubsurfaceScattering) || o_normal_useTexture || (o_clearCoat_enabled && o_clearCoat_normal_useTexture))
|
||||
if (ShouldHandleParallax() || o_normal_useTexture || (o_clearCoat_enabled && o_clearCoat_normal_useTexture))
|
||||
{
|
||||
PrepareGeneratedTangent(IN.m_normal, IN.m_worldPosition, isFrontFace, IN.m_uv, UvSetCount, tangents, bitangents);
|
||||
}
|
||||
@@ -124,7 +117,6 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
|
||||
bool displacementIsClipped = false;
|
||||
|
||||
// Parallax mapping's non uniform uv transformations break screen space subsurface scattering, disable it when subsurface scatteirng is enabled
|
||||
if(ShouldHandleParallax())
|
||||
{
|
||||
|
||||
@@ -174,12 +166,8 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
|
||||
// ------- Metallic -------
|
||||
|
||||
float metallic = 0;
|
||||
if(!o_enableSubsurfaceScattering) // If subsurface scattering is enabled skip texture lookup for metallic, as this quantity won't be used anyway
|
||||
{
|
||||
float2 metallicUv = IN.m_uv[MaterialSrg::m_metallicMapUvIndex];
|
||||
metallic = GetMetallicInput(MaterialSrg::m_metallicMap, MaterialSrg::m_sampler, metallicUv, MaterialSrg::m_metallicFactor, o_metallic_useTexture);
|
||||
}
|
||||
float2 metallicUv = IN.m_uv[MaterialSrg::m_metallicMapUvIndex];
|
||||
float metallic = GetMetallicInput(MaterialSrg::m_metallicMap, MaterialSrg::m_sampler, metallicUv, MaterialSrg::m_metallicFactor, o_metallic_useTexture);
|
||||
|
||||
// ------- Specular -------
|
||||
|
||||
@@ -195,11 +183,6 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
MaterialSrg::m_roughnessLowerBound, MaterialSrg::m_roughnessUpperBound, o_roughness_useTexture);
|
||||
surface.CalculateRoughnessA();
|
||||
|
||||
// ------- Subsurface -------
|
||||
|
||||
float surfaceScatteringFactor = 0.0f;
|
||||
surface.transmission.InitializeToZero();
|
||||
|
||||
// ------- Lighting Data -------
|
||||
|
||||
LightingData lightingData;
|
||||
@@ -271,7 +254,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
ApplyIBL(surface, lightingData);
|
||||
|
||||
// Finalize Lighting
|
||||
lightingData.FinalizeLighting(surface.transmission.tint);
|
||||
lightingData.FinalizeLighting();
|
||||
|
||||
|
||||
if (o_opacity_mode == OpacityMode::Blended || o_opacity_mode == OpacityMode::TintedTransparent)
|
||||
@@ -312,13 +295,6 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
lightingOutput.m_diffuseColor.rgb += lightingOutput.m_specularColor.rgb; // add specular
|
||||
lightingOutput.m_specularColor.rgb = baseColor * (1.0 - lightingOutput.m_diffuseColor.w);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pack factor and quality, drawback: because of precision limit of float16 cannot represent exact 1, maximum representable value is 0.9961
|
||||
uint factorAndQuality = dot(round(float2(saturate(surfaceScatteringFactor), MaterialSrg::m_subsurfaceScatteringQuality) * 255), float2(256, 1));
|
||||
lightingOutput.m_diffuseColor.w = factorAndQuality * (o_enableSubsurfaceScattering ? 1.0 : -1.0);
|
||||
lightingOutput.m_scatterDistance = MaterialSrg::m_scatterDistance;
|
||||
}
|
||||
|
||||
return lightingOutput;
|
||||
}
|
||||
|
||||
+7
-1
@@ -54,6 +54,7 @@ class LightingData
|
||||
|
||||
void Init(float3 positionWS, float3 normal, float roughnessLinear);
|
||||
void CalculateMultiscatterCompensation(float3 specularF0, bool enabled);
|
||||
void FinalizeLighting();
|
||||
void FinalizeLighting(float3 transmissionTint);
|
||||
};
|
||||
|
||||
@@ -80,10 +81,15 @@ void LightingData::CalculateMultiscatterCompensation(float3 specularF0, bool ena
|
||||
multiScatterCompensation = GetMultiScatterCompensation(specularF0, brdf, enabled);
|
||||
}
|
||||
|
||||
void LightingData::FinalizeLighting(float3 transmissionTint)
|
||||
void LightingData::FinalizeLighting()
|
||||
{
|
||||
specularLighting *= specularOcclusion;
|
||||
specularLighting += emissiveLighting;
|
||||
}
|
||||
|
||||
void LightingData::FinalizeLighting(float3 transmissionTint)
|
||||
{
|
||||
FinalizeLighting();
|
||||
|
||||
// Transmitted light
|
||||
if(o_transmission_mode != TransmissionMode::None)
|
||||
|
||||
-1
@@ -75,7 +75,6 @@ struct PbrLightingOutput
|
||||
float4 m_albedo;
|
||||
float4 m_specularF0;
|
||||
float4 m_normal;
|
||||
float3 m_scatterDistance;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
class Surface
|
||||
{
|
||||
ClearCoatSurfaceData clearCoat;
|
||||
TransmissionSurfaceData transmission;
|
||||
TransmissionSurfaceData transmission; // This is not actually used for Standard PBR, but must be present for common lighting code to compile
|
||||
|
||||
// ------- BasePbrSurfaceData -------
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ set(FILES
|
||||
Materials/Types/EnhancedPBR_ForwardPass_EDS.shader
|
||||
Materials/Types/EnhancedPBR_Shadowmap_WithPS.azsl
|
||||
Materials/Types/EnhancedPBR_Shadowmap_WithPS.shader
|
||||
Materials/Types/EnhancedPBR_SubsurfaceState.lua
|
||||
Materials/Types/Skin.azsl
|
||||
Materials/Types/Skin.materialtype
|
||||
Materials/Types/Skin.shader
|
||||
@@ -61,7 +62,6 @@ set(FILES
|
||||
Materials/Types/StandardPBR_ShaderEnable.lua
|
||||
Materials/Types/StandardPBR_Shadowmap_WithPS.azsl
|
||||
Materials/Types/StandardPBR_Shadowmap_WithPS.shader
|
||||
Materials/Types/StandardPBR_SubsurfaceState.lua
|
||||
Materials/Types/MaterialInputs/AlphaInput.azsli
|
||||
Materials/Types/MaterialInputs/BaseColorInput.azsli
|
||||
Materials/Types/MaterialInputs/ClearCoatInput.azsli
|
||||
|
||||
Reference in New Issue
Block a user