Merge pull request #6443 from aws-lumberyard-dev/Atom/antonmic/BasePBR
Atom/antonmic/base pbrmonroegm-disable-blank-issue-2
commit
3d2f9528f2
@ -0,0 +1,605 @@
|
|||||||
|
{
|
||||||
|
"description": "Material Type with properties used to define Base PBR, a metallic-roughness Physically-Based Rendering (PBR) material shading model.",
|
||||||
|
"version": 0,
|
||||||
|
"propertyLayout": {
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"name": "baseColor",
|
||||||
|
"displayName": "Base Color",
|
||||||
|
"description": "Properties for configuring the surface reflected color for dielectrics or reflectance values for metals."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "metallic",
|
||||||
|
"displayName": "Metallic",
|
||||||
|
"description": "Properties for configuring whether the surface is metallic or not."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "roughness",
|
||||||
|
"displayName": "Roughness",
|
||||||
|
"description": "Properties for configuring how rough the surface appears."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "specularF0",
|
||||||
|
"displayName": "Specular Reflectance f0",
|
||||||
|
"description": "The constant f0 represents the specular reflectance at normal incidence (Fresnel 0 Angle). Used to adjust reflectance of non-metal surfaces."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "normal",
|
||||||
|
"displayName": "Normal",
|
||||||
|
"description": "Properties related to configuring surface normal."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "uv",
|
||||||
|
"displayName": "UVs",
|
||||||
|
"description": "Properties for configuring UV transforms."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Note: this property group is used in the DiffuseGlobalIllumination pass, it is not read by the BasePBR shader
|
||||||
|
"name": "irradiance",
|
||||||
|
"displayName": "Irradiance",
|
||||||
|
"description": "Properties for configuring the irradiance used in global illumination."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "general",
|
||||||
|
"displayName": "General Settings",
|
||||||
|
"description": "General settings."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"general": [
|
||||||
|
{
|
||||||
|
"name": "doubleSided",
|
||||||
|
"displayName": "Double-sided",
|
||||||
|
"description": "Whether to render back-faces or just front-faces.",
|
||||||
|
"type": "Bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "applySpecularAA",
|
||||||
|
"displayName": "Apply Specular AA",
|
||||||
|
"description": "Whether to apply specular anti-aliasing in the shader.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": false,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderOption",
|
||||||
|
"name": "o_applySpecularAA"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "enableShadows",
|
||||||
|
"displayName": "Enable Shadows",
|
||||||
|
"description": "Whether to use the shadow maps.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderOption",
|
||||||
|
"name": "o_enableShadows"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "enableDirectionalLights",
|
||||||
|
"displayName": "Enable Directional Lights",
|
||||||
|
"description": "Whether to use directional lights.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderOption",
|
||||||
|
"name": "o_enableDirectionalLights"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "enablePunctualLights",
|
||||||
|
"displayName": "Enable Punctual Lights",
|
||||||
|
"description": "Whether to use punctual lights.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderOption",
|
||||||
|
"name": "o_enablePunctualLights"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "enableAreaLights",
|
||||||
|
"displayName": "Enable Area Lights",
|
||||||
|
"description": "Whether to use area lights.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderOption",
|
||||||
|
"name": "o_enableAreaLights"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "enableIBL",
|
||||||
|
"displayName": "Enable IBL",
|
||||||
|
"description": "Whether to use Image Based Lighting (IBL).",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderOption",
|
||||||
|
"name": "o_enableIBL"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "forwardPassIBLSpecular",
|
||||||
|
"displayName": "Forward Pass IBL Specular",
|
||||||
|
"description": "Whether to apply IBL specular in the forward pass.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": false,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderOption",
|
||||||
|
"name": "o_materialUseForwardPassIBLSpecular"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"baseColor": [
|
||||||
|
{
|
||||||
|
"name": "color",
|
||||||
|
"displayName": "Color",
|
||||||
|
"description": "Color is displayed as sRGB but the values are stored as linear color.",
|
||||||
|
"type": "Color",
|
||||||
|
"defaultValue": [ 1.0, 1.0, 1.0 ],
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_baseColor"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "factor",
|
||||||
|
"displayName": "Factor",
|
||||||
|
"description": "Strength factor for scaling the base color values. Zero (0.0) is black, white (1.0) is full color.",
|
||||||
|
"type": "Float",
|
||||||
|
"defaultValue": 1.0,
|
||||||
|
"min": 0.0,
|
||||||
|
"max": 1.0,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_baseColorFactor"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "textureMap",
|
||||||
|
"displayName": "Texture",
|
||||||
|
"description": "Base color texture map",
|
||||||
|
"type": "Image",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_baseColorMap"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "useTexture",
|
||||||
|
"displayName": "Use Texture",
|
||||||
|
"description": "Whether to use the texture.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "textureMapUv",
|
||||||
|
"displayName": "UV",
|
||||||
|
"description": "Base color map UV set",
|
||||||
|
"type": "Enum",
|
||||||
|
"enumIsUv": true,
|
||||||
|
"defaultValue": "Tiled",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_baseColorMapUvIndex"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "textureBlendMode",
|
||||||
|
"displayName": "Texture Blend Mode",
|
||||||
|
"description": "Selects the equation to use when combining Color, Factor, and Texture.",
|
||||||
|
"type": "Enum",
|
||||||
|
"enumValues": [ "Multiply", "LinearLight", "Lerp", "Overlay" ],
|
||||||
|
"defaultValue": "Multiply",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderOption",
|
||||||
|
"name": "o_baseColorTextureBlendMode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metallic": [
|
||||||
|
{
|
||||||
|
"name": "factor",
|
||||||
|
"displayName": "Factor",
|
||||||
|
"description": "This value is linear, black is non-metal and white means raw metal.",
|
||||||
|
"type": "Float",
|
||||||
|
"defaultValue": 0.0,
|
||||||
|
"min": 0.0,
|
||||||
|
"max": 1.0,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_metallicFactor"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "textureMap",
|
||||||
|
"displayName": "Texture",
|
||||||
|
"description": "",
|
||||||
|
"type": "Image",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_metallicMap"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "useTexture",
|
||||||
|
"displayName": "Use Texture",
|
||||||
|
"description": "Whether to use the texture, or just default to the Factor value.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "textureMapUv",
|
||||||
|
"displayName": "UV",
|
||||||
|
"description": "Metallic map UV set",
|
||||||
|
"type": "Enum",
|
||||||
|
"enumIsUv": true,
|
||||||
|
"defaultValue": "Tiled",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_metallicMapUvIndex"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"roughness": [
|
||||||
|
{
|
||||||
|
"name": "textureMap",
|
||||||
|
"displayName": "Texture",
|
||||||
|
"description": "Texture for defining surface roughness.",
|
||||||
|
"type": "Image",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_roughnessMap"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "useTexture",
|
||||||
|
"displayName": "Use Texture",
|
||||||
|
"description": "Whether to use the texture, or just default to the Factor value.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "textureMapUv",
|
||||||
|
"displayName": "UV",
|
||||||
|
"description": "Roughness map UV set",
|
||||||
|
"type": "Enum",
|
||||||
|
"enumIsUv": true,
|
||||||
|
"defaultValue": "Tiled",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_roughnessMapUvIndex"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Note that "factor" is mutually exclusive with "lowerBound"/"upperBound". These are swapped by a lua functor.
|
||||||
|
"name": "lowerBound",
|
||||||
|
"displayName": "Lower Bound",
|
||||||
|
"description": "The roughness value that corresponds to black in the texture.",
|
||||||
|
"type": "Float",
|
||||||
|
"defaultValue": 0.0,
|
||||||
|
"min": 0.0,
|
||||||
|
"max": 1.0,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_roughnessLowerBound"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Note that "factor" is mutually exclusive with "lowerBound"/"upperBound". These are swapped by a lua functor.
|
||||||
|
"name": "upperBound",
|
||||||
|
"displayName": "Upper Bound",
|
||||||
|
"description": "The roughness value that corresponds to white in the texture.",
|
||||||
|
"type": "Float",
|
||||||
|
"defaultValue": 1.0,
|
||||||
|
"min": 0.0,
|
||||||
|
"max": 1.0,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_roughnessUpperBound"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Note that "factor" is mutually exclusive with "lowerBound"/"upperBound". These are swapped by a lua functor.
|
||||||
|
"name": "factor",
|
||||||
|
"displayName": "Factor",
|
||||||
|
"description": "Controls the roughness value",
|
||||||
|
"type": "Float",
|
||||||
|
"defaultValue": 1.0,
|
||||||
|
"min": 0.0,
|
||||||
|
"max": 1.0,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_roughnessFactor"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"specularF0": [
|
||||||
|
{
|
||||||
|
"name": "factor",
|
||||||
|
"displayName": "Factor",
|
||||||
|
"description": "The default IOR is 1.5, which gives you 0.04 (4% of light reflected at 0 degree angle for dielectric materials). F0 values lie in the range 0-0.08, so that is why the default F0 slider is set on 0.5.",
|
||||||
|
"type": "Float",
|
||||||
|
"defaultValue": 0.5,
|
||||||
|
"min": 0.0,
|
||||||
|
"max": 1.0,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_specularF0Factor"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "textureMap",
|
||||||
|
"displayName": "Texture",
|
||||||
|
"description": "Texture for defining surface reflectance.",
|
||||||
|
"type": "Image",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_specularF0Map"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "useTexture",
|
||||||
|
"displayName": "Use Texture",
|
||||||
|
"description": "Whether to use the texture, or just default to the Factor value.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "textureMapUv",
|
||||||
|
"displayName": "UV",
|
||||||
|
"description": "Specular reflection map UV set",
|
||||||
|
"type": "Enum",
|
||||||
|
"enumIsUv": true,
|
||||||
|
"defaultValue": "Tiled",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_specularF0MapUvIndex"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Consider moving this to the "general" group to be consistent with StandardMultilayerPBR
|
||||||
|
{
|
||||||
|
"name": "enableMultiScatterCompensation",
|
||||||
|
"displayName": "Multiscattering Compensation",
|
||||||
|
"description": "Whether to enable multiple scattering compensation.",
|
||||||
|
"type": "Bool",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderOption",
|
||||||
|
"name": "o_specularF0_enableMultiScatterCompensation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"normal": [
|
||||||
|
{
|
||||||
|
"name": "textureMap",
|
||||||
|
"displayName": "Texture",
|
||||||
|
"description": "Texture for defining surface normal direction.",
|
||||||
|
"type": "Image",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_normalMap"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "useTexture",
|
||||||
|
"displayName": "Use Texture",
|
||||||
|
"description": "Whether to use the texture, or just rely on vertex normals.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "textureMapUv",
|
||||||
|
"displayName": "UV",
|
||||||
|
"description": "Normal map UV set",
|
||||||
|
"type": "Enum",
|
||||||
|
"enumIsUv": true,
|
||||||
|
"defaultValue": "Tiled",
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_normalMapUvIndex"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "flipX",
|
||||||
|
"displayName": "Flip X Channel",
|
||||||
|
"description": "Flip tangent direction for this normal map.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": false,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_flipNormalX"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "flipY",
|
||||||
|
"displayName": "Flip Y Channel",
|
||||||
|
"description": "Flip bitangent direction for this normal map.",
|
||||||
|
"type": "Bool",
|
||||||
|
"defaultValue": false,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_flipNormalY"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "factor",
|
||||||
|
"displayName": "Factor",
|
||||||
|
"description": "Strength factor for scaling the values",
|
||||||
|
"type": "Float",
|
||||||
|
"defaultValue": 1.0,
|
||||||
|
"min": 0.0,
|
||||||
|
"softMax": 2.0,
|
||||||
|
"connection": {
|
||||||
|
"type": "ShaderInput",
|
||||||
|
"name": "m_normalFactor"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uv": [
|
||||||
|
{
|
||||||
|
"name": "center",
|
||||||
|
"displayName": "Center",
|
||||||
|
"description": "Center point for scaling and rotation transformations.",
|
||||||
|
"type": "vector2",
|
||||||
|
"vectorLabels": [ "U", "V" ],
|
||||||
|
"defaultValue": [ 0.5, 0.5 ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tileU",
|
||||||
|
"displayName": "Tile U",
|
||||||
|
"description": "Scales texture coordinates in U.",
|
||||||
|
"type": "float",
|
||||||
|
"defaultValue": 1.0,
|
||||||
|
"step": 0.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tileV",
|
||||||
|
"displayName": "Tile V",
|
||||||
|
"description": "Scales texture coordinates in V.",
|
||||||
|
"type": "float",
|
||||||
|
"defaultValue": 1.0,
|
||||||
|
"step": 0.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "offsetU",
|
||||||
|
"displayName": "Offset U",
|
||||||
|
"description": "Offsets texture coordinates in the U direction.",
|
||||||
|
"type": "float",
|
||||||
|
"defaultValue": 0.0,
|
||||||
|
"min": -1.0,
|
||||||
|
"max": 1.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "offsetV",
|
||||||
|
"displayName": "Offset V",
|
||||||
|
"description": "Offsets texture coordinates in the V direction.",
|
||||||
|
"type": "float",
|
||||||
|
"defaultValue": 0.0,
|
||||||
|
"min": -1.0,
|
||||||
|
"max": 1.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rotateDegrees",
|
||||||
|
"displayName": "Rotate",
|
||||||
|
"description": "Rotates the texture coordinates (degrees).",
|
||||||
|
"type": "float",
|
||||||
|
"defaultValue": 0.0,
|
||||||
|
"min": -180.0,
|
||||||
|
"max": 180.0,
|
||||||
|
"step": 1.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "scale",
|
||||||
|
"displayName": "Scale",
|
||||||
|
"description": "Scales texture coordinates in both U and V.",
|
||||||
|
"type": "float",
|
||||||
|
"defaultValue": 1.0,
|
||||||
|
"step": 0.1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"irradiance": [
|
||||||
|
// Note: this property group is used in the DiffuseGlobalIllumination pass and not by the main forward shader
|
||||||
|
{
|
||||||
|
"name": "color",
|
||||||
|
"displayName": "Color",
|
||||||
|
"description": "Color is displayed as sRGB but the values are stored as linear color.",
|
||||||
|
"type": "Color",
|
||||||
|
"defaultValue": [ 1.0, 1.0, 1.0 ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "factor",
|
||||||
|
"displayName": "Factor",
|
||||||
|
"description": "Strength factor for scaling the irradiance color values. Zero (0.0) is black, white (1.0) is full color.",
|
||||||
|
"type": "Float",
|
||||||
|
"defaultValue": 1.0,
|
||||||
|
"min": 0.0,
|
||||||
|
"max": 1.0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"shaders": [
|
||||||
|
{
|
||||||
|
"file": "./BasePBR_ForwardPass.shader",
|
||||||
|
"tag": "ForwardPass_EDS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "./BasePBR_LowEndForward.shader",
|
||||||
|
"tag": "LowEndForward_EDS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Shaders/Shadow/Shadowmap.shader",
|
||||||
|
"tag": "Shadowmap"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Shaders/Depth/DepthPass.shader",
|
||||||
|
"tag": "DepthPass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "Shaders/MotionVector/MeshMotionVector.shader",
|
||||||
|
"tag": "MeshMotionVector"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"functors": [
|
||||||
|
{
|
||||||
|
// Maps 2D scale, offset, and rotate properties into a float3x3 transform matrix.
|
||||||
|
"type": "Transform2D",
|
||||||
|
"args": {
|
||||||
|
"transformOrder": [ "Rotate", "Translate", "Scale" ],
|
||||||
|
"centerProperty": "uv.center",
|
||||||
|
"scaleProperty": "uv.scale",
|
||||||
|
"scaleXProperty": "uv.tileU",
|
||||||
|
"scaleYProperty": "uv.tileV",
|
||||||
|
"translateXProperty": "uv.offsetU",
|
||||||
|
"translateYProperty": "uv.offsetV",
|
||||||
|
"rotateDegreesProperty": "uv.rotateDegrees",
|
||||||
|
"float3x3ShaderInput": "m_uvMatrix",
|
||||||
|
"float3x3InverseShaderInput": "m_uvMatrixInverse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "UseTexture",
|
||||||
|
"args": {
|
||||||
|
"textureProperty": "baseColor.textureMap",
|
||||||
|
"useTextureProperty": "baseColor.useTexture",
|
||||||
|
"dependentProperties": ["baseColor.textureMapUv", "baseColor.textureBlendMode"],
|
||||||
|
"shaderOption": "o_baseColor_useTexture"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "UseTexture",
|
||||||
|
"args": {
|
||||||
|
"textureProperty": "specularF0.textureMap",
|
||||||
|
"useTextureProperty": "specularF0.useTexture",
|
||||||
|
"dependentProperties": ["specularF0.textureMapUv"],
|
||||||
|
"shaderOption": "o_specularF0_useTexture"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "UseTexture",
|
||||||
|
"args": {
|
||||||
|
"textureProperty": "normal.textureMap",
|
||||||
|
"useTextureProperty": "normal.useTexture",
|
||||||
|
"dependentProperties": ["normal.textureMapUv", "normal.factor", "normal.flipX", "normal.flipY"],
|
||||||
|
"shaderOption": "o_normal_useTexture"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Lua",
|
||||||
|
"args": {
|
||||||
|
"file": "StandardPBR_Roughness.lua"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Lua",
|
||||||
|
"args": {
|
||||||
|
"file": "StandardPBR_Metallic.lua"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"uvNameMap": {
|
||||||
|
"UV0": "Tiled",
|
||||||
|
"UV1": "Unwrapped"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
#include <Atom/Features/SrgSemantics.azsli>
|
||||||
|
#include <viewsrg.srgi>
|
||||||
|
#include <Atom/RPI/ShaderResourceGroups/DefaultDrawSrg.azsli>
|
||||||
|
#include <Atom/Features/PBR/LightingOptions.azsli>
|
||||||
|
#include <Atom/Features/PBR/AlphaUtils.azsli>
|
||||||
|
|
||||||
|
#include "MaterialInputs/BaseColorInput.azsli"
|
||||||
|
#include "MaterialInputs/RoughnessInput.azsli"
|
||||||
|
#include "MaterialInputs/MetallicInput.azsli"
|
||||||
|
#include "MaterialInputs/SpecularInput.azsli"
|
||||||
|
#include "MaterialInputs/NormalInput.azsli"
|
||||||
|
#include "MaterialInputs/UvSetCount.azsli"
|
||||||
|
|
||||||
|
ShaderResourceGroup MaterialSrg : SRG_PerMaterial
|
||||||
|
{
|
||||||
|
// Auto-generate material SRG fields for common inputs
|
||||||
|
COMMON_SRG_INPUTS_BASE_COLOR()
|
||||||
|
COMMON_SRG_INPUTS_ROUGHNESS()
|
||||||
|
COMMON_SRG_INPUTS_METALLIC()
|
||||||
|
COMMON_SRG_INPUTS_SPECULAR_F0()
|
||||||
|
COMMON_SRG_INPUTS_NORMAL()
|
||||||
|
|
||||||
|
|
||||||
|
float3x3 m_uvMatrix;
|
||||||
|
float4 m_pad1; // [GFX TODO][ATOM-14595] This is a workaround for a data stomping bug. Remove once it's fixed.
|
||||||
|
float3x3 m_uvMatrixInverse;
|
||||||
|
float4 m_pad2; // [GFX TODO][ATOM-14595] This is a workaround for a data stomping bug. Remove once it's fixed.
|
||||||
|
|
||||||
|
Sampler m_sampler
|
||||||
|
{
|
||||||
|
AddressU = Wrap;
|
||||||
|
AddressV = Wrap;
|
||||||
|
MinFilter = Linear;
|
||||||
|
MagFilter = Linear;
|
||||||
|
MipFilter = Linear;
|
||||||
|
MaxAnisotropy = 16;
|
||||||
|
};
|
||||||
|
|
||||||
|
Texture2D m_brdfMap;
|
||||||
|
|
||||||
|
Sampler m_samplerBrdf
|
||||||
|
{
|
||||||
|
AddressU = Clamp;
|
||||||
|
AddressV = Clamp;
|
||||||
|
MinFilter = Linear;
|
||||||
|
MagFilter = Linear;
|
||||||
|
MipFilter = Linear;
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,199 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Atom/Features/ShaderQualityOptions.azsli"
|
||||||
|
|
||||||
|
#include "BasePBR_Common.azsli"
|
||||||
|
|
||||||
|
// SRGs
|
||||||
|
#include <Atom/Features/PBR/DefaultObjectSrg.azsli>
|
||||||
|
#include <Atom/Features/PBR/ForwardPassSrg.azsli>
|
||||||
|
|
||||||
|
// Pass Output
|
||||||
|
#include <Atom/Features/PBR/ForwardPassOutput.azsli>
|
||||||
|
|
||||||
|
// Utility
|
||||||
|
#include <Atom/Features/ColorManagement/TransformColor.azsli>
|
||||||
|
|
||||||
|
// Custom Surface & Lighting
|
||||||
|
#include <Atom/Features/PBR/Lighting/BaseLighting.azsli>
|
||||||
|
|
||||||
|
// Decals
|
||||||
|
#include <Atom/Features/PBR/Decals.azsli>
|
||||||
|
|
||||||
|
|
||||||
|
// ---------- Material Parameters ----------
|
||||||
|
|
||||||
|
COMMON_OPTIONS_BASE_COLOR()
|
||||||
|
COMMON_OPTIONS_ROUGHNESS()
|
||||||
|
COMMON_OPTIONS_METALLIC()
|
||||||
|
COMMON_OPTIONS_SPECULAR_F0()
|
||||||
|
COMMON_OPTIONS_NORMAL()
|
||||||
|
|
||||||
|
// ---------- Vertex Shader ----------
|
||||||
|
|
||||||
|
struct VSInput
|
||||||
|
{
|
||||||
|
// Base fields (required by the template azsli file)...
|
||||||
|
float3 m_position : POSITION;
|
||||||
|
float3 m_normal : NORMAL;
|
||||||
|
float4 m_tangent : TANGENT;
|
||||||
|
float3 m_bitangent : BITANGENT;
|
||||||
|
|
||||||
|
// Extended fields (only referenced in this azsl file)...
|
||||||
|
float2 m_uv0 : UV0;
|
||||||
|
float2 m_uv1 : UV1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VSOutput
|
||||||
|
{
|
||||||
|
// Base fields (required by the template azsli file)...
|
||||||
|
// "centroid" is needed for SV_Depth to compile
|
||||||
|
linear centroid float4 m_position : SV_Position;
|
||||||
|
float3 m_normal: NORMAL;
|
||||||
|
float3 m_tangent : TANGENT;
|
||||||
|
float3 m_bitangent : BITANGENT;
|
||||||
|
float3 m_worldPosition : UV0;
|
||||||
|
float3 m_shadowCoords[ViewSrg::MaxCascadeCount] : UV3;
|
||||||
|
|
||||||
|
// Extended fields (only referenced in this azsl file)...
|
||||||
|
float2 m_uv[UvSetCount] : UV1;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include <Atom/Features/Vertex/VertexHelper.azsli>
|
||||||
|
|
||||||
|
VSOutput BasePbr_ForwardPassVS(VSInput IN)
|
||||||
|
{
|
||||||
|
VSOutput OUT;
|
||||||
|
|
||||||
|
float3 worldPosition = mul(ObjectSrg::GetWorldMatrix(), float4(IN.m_position, 1.0)).xyz;
|
||||||
|
|
||||||
|
// By design, only UV0 is allowed to apply transforms.
|
||||||
|
OUT.m_uv[0] = mul(MaterialSrg::m_uvMatrix, float3(IN.m_uv0, 1.0)).xy;
|
||||||
|
OUT.m_uv[1] = IN.m_uv1;
|
||||||
|
|
||||||
|
// No parallax in BaseBPR, so do shadow coordinate calculations in vertex shader
|
||||||
|
bool skipShadowCoords = false;
|
||||||
|
|
||||||
|
VertexHelper(IN, OUT, worldPosition, skipShadowCoords);
|
||||||
|
|
||||||
|
return OUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ---------- Pixel Shader ----------
|
||||||
|
|
||||||
|
PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace)
|
||||||
|
{
|
||||||
|
const float3 vertexNormal = normalize(IN.m_normal);
|
||||||
|
|
||||||
|
// ------- Tangents & Bitangets -------
|
||||||
|
float3 tangents[UvSetCount] = { IN.m_tangent.xyz, IN.m_tangent.xyz };
|
||||||
|
float3 bitangents[UvSetCount] = { IN.m_bitangent.xyz, IN.m_bitangent.xyz };
|
||||||
|
|
||||||
|
if (o_normal_useTexture)
|
||||||
|
{
|
||||||
|
PrepareGeneratedTangent(IN.m_normal, IN.m_worldPosition, isFrontFace, IN.m_uv, UvSetCount, tangents, bitangents);
|
||||||
|
}
|
||||||
|
|
||||||
|
Surface surface;
|
||||||
|
surface.position = IN.m_worldPosition.xyz;
|
||||||
|
|
||||||
|
// ------- Normal -------
|
||||||
|
|
||||||
|
float2 normalUv = IN.m_uv[MaterialSrg::m_normalMapUvIndex];
|
||||||
|
float3x3 uvMatrix = MaterialSrg::m_normalMapUvIndex == 0 ? MaterialSrg::m_uvMatrix : CreateIdentity3x3(); // By design, only UV0 is allowed to apply transforms.
|
||||||
|
surface.vertexNormal = vertexNormal;
|
||||||
|
surface.normal = GetNormalInputWS(MaterialSrg::m_normalMap, MaterialSrg::m_sampler, normalUv, MaterialSrg::m_flipNormalX, MaterialSrg::m_flipNormalY, isFrontFace, IN.m_normal,
|
||||||
|
tangents[MaterialSrg::m_normalMapUvIndex], bitangents[MaterialSrg::m_normalMapUvIndex], uvMatrix, o_normal_useTexture, MaterialSrg::m_normalFactor);
|
||||||
|
|
||||||
|
// ------- Base Color -------
|
||||||
|
|
||||||
|
float2 baseColorUv = IN.m_uv[MaterialSrg::m_baseColorMapUvIndex];
|
||||||
|
float3 sampledColor = GetBaseColorInput(MaterialSrg::m_baseColorMap, MaterialSrg::m_sampler, baseColorUv, MaterialSrg::m_baseColor.rgb, o_baseColor_useTexture);
|
||||||
|
float3 baseColor = BlendBaseColor(sampledColor, MaterialSrg::m_baseColor.rgb, MaterialSrg::m_baseColorFactor, o_baseColorTextureBlendMode, o_baseColor_useTexture);
|
||||||
|
|
||||||
|
// ------- Metallic -------
|
||||||
|
|
||||||
|
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 -------
|
||||||
|
|
||||||
|
float2 specularUv = IN.m_uv[MaterialSrg::m_specularF0MapUvIndex];
|
||||||
|
float specularF0Factor = GetSpecularInput(MaterialSrg::m_specularF0Map, MaterialSrg::m_sampler, specularUv, MaterialSrg::m_specularF0Factor, o_specularF0_useTexture);
|
||||||
|
|
||||||
|
surface.SetAlbedoAndSpecularF0(baseColor, specularF0Factor, metallic);
|
||||||
|
|
||||||
|
// ------- Roughness -------
|
||||||
|
|
||||||
|
float2 roughnessUv = IN.m_uv[MaterialSrg::m_roughnessMapUvIndex];
|
||||||
|
surface.roughnessLinear = GetRoughnessInput(MaterialSrg::m_roughnessMap, MaterialSrg::m_sampler, roughnessUv, MaterialSrg::m_roughnessFactor,
|
||||||
|
MaterialSrg::m_roughnessLowerBound, MaterialSrg::m_roughnessUpperBound, o_roughness_useTexture);
|
||||||
|
surface.CalculateRoughnessA();
|
||||||
|
|
||||||
|
// ------- Lighting Data -------
|
||||||
|
|
||||||
|
LightingData lightingData;
|
||||||
|
|
||||||
|
// Light iterator
|
||||||
|
lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
|
||||||
|
lightingData.Init(surface.position, surface.normal, surface.roughnessLinear);
|
||||||
|
|
||||||
|
// Directional light shadow coordinates
|
||||||
|
lightingData.shadowCoords = IN.m_shadowCoords;
|
||||||
|
|
||||||
|
// Diffuse and Specular response (used in IBL calculations)
|
||||||
|
lightingData.specularResponse = FresnelSchlickWithRoughness(lightingData.NdotV, surface.specularF0, surface.roughnessLinear);
|
||||||
|
lightingData.diffuseResponse = float3(1.0, 1.0, 1.0) - lightingData.specularResponse;
|
||||||
|
|
||||||
|
// ------- Multiscatter -------
|
||||||
|
|
||||||
|
lightingData.CalculateMultiscatterCompensation(surface.specularF0, o_specularF0_enableMultiScatterCompensation);
|
||||||
|
|
||||||
|
// ------- Lighting Calculation -------
|
||||||
|
|
||||||
|
// Apply Decals
|
||||||
|
ApplyDecals(lightingData.tileIterator, surface);
|
||||||
|
|
||||||
|
// Apply Direct Lighting
|
||||||
|
ApplyDirectLighting(surface, lightingData);
|
||||||
|
|
||||||
|
// Apply Image Based Lighting (IBL)
|
||||||
|
ApplyIBL(surface, lightingData);
|
||||||
|
|
||||||
|
// Finalize Lighting
|
||||||
|
lightingData.FinalizeLighting();
|
||||||
|
|
||||||
|
float alpha = 1.0f;
|
||||||
|
PbrLightingOutput lightingOutput = GetPbrLightingOutput(surface, lightingData, alpha);
|
||||||
|
|
||||||
|
// Disable subsurface scattering
|
||||||
|
lightingOutput.m_diffuseColor.w = -1;
|
||||||
|
|
||||||
|
return lightingOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ForwardPassOutput BasePbr_ForwardPassPS_EDS(VSOutput IN, bool isFrontFace : SV_IsFrontFace)
|
||||||
|
{
|
||||||
|
ForwardPassOutput OUT;
|
||||||
|
PbrLightingOutput lightingOutput = ForwardPassPS_Common(IN, isFrontFace);
|
||||||
|
|
||||||
|
#ifdef UNIFIED_FORWARD_OUTPUT
|
||||||
|
OUT.m_color.rgb = lightingOutput.m_diffuseColor.rgb + lightingOutput.m_specularColor.rgb;
|
||||||
|
OUT.m_color.a = lightingOutput.m_diffuseColor.a;
|
||||||
|
#else
|
||||||
|
OUT.m_diffuseColor = lightingOutput.m_diffuseColor;
|
||||||
|
OUT.m_specularColor = lightingOutput.m_specularColor;
|
||||||
|
OUT.m_specularF0 = lightingOutput.m_specularF0;
|
||||||
|
OUT.m_albedo = lightingOutput.m_albedo;
|
||||||
|
OUT.m_normal = lightingOutput.m_normal;
|
||||||
|
#endif
|
||||||
|
return OUT;
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"Source" : "./BasePBR_ForwardPass.azsl",
|
||||||
|
|
||||||
|
"DepthStencilState" :
|
||||||
|
{
|
||||||
|
"Depth" :
|
||||||
|
{
|
||||||
|
"Enable" : true,
|
||||||
|
"CompareFunc" : "GreaterEqual"
|
||||||
|
},
|
||||||
|
"Stencil" :
|
||||||
|
{
|
||||||
|
"Enable" : true,
|
||||||
|
"ReadMask" : "0x00",
|
||||||
|
"WriteMask" : "0xFF",
|
||||||
|
"FrontFace" :
|
||||||
|
{
|
||||||
|
"Func" : "Always",
|
||||||
|
"DepthFailOp" : "Keep",
|
||||||
|
"FailOp" : "Keep",
|
||||||
|
"PassOp" : "Replace"
|
||||||
|
},
|
||||||
|
"BackFace" :
|
||||||
|
{
|
||||||
|
"Func" : "Always",
|
||||||
|
"DepthFailOp" : "Keep",
|
||||||
|
"FailOp" : "Keep",
|
||||||
|
"PassOp" : "Replace"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"CompilerHints" : {
|
||||||
|
"DisableOptimizations" : false
|
||||||
|
},
|
||||||
|
|
||||||
|
"ProgramSettings":
|
||||||
|
{
|
||||||
|
"EntryPoints":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "BasePbr_ForwardPassVS",
|
||||||
|
"type": "Vertex"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BasePbr_ForwardPassPS_EDS",
|
||||||
|
"type": "Fragment"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"DrawList" : "forward"
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"Shader" : "BasePBR_ForwardPass.shader",
|
||||||
|
"Variants": [
|
||||||
|
{
|
||||||
|
"StableId": 1,
|
||||||
|
"Options": {
|
||||||
|
"o_directional_shadow_filtering_method": "ShadowFilterMethod::None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"StableId": 2,
|
||||||
|
"Options": {
|
||||||
|
"o_directional_shadow_filtering_method": "ShadowFilterMethod::Pcf"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"StableId": 3,
|
||||||
|
"Options": {
|
||||||
|
"o_directional_shadow_filtering_method": "ShadowFilterMethod::Esm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"StableId": 4,
|
||||||
|
"Options": {
|
||||||
|
"o_directional_shadow_filtering_method": "ShadowFilterMethod::EsmPcf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// NOTE: This file is a temporary workaround until .shader files can #define macros for their .azsl files
|
||||||
|
|
||||||
|
#define QUALITY_LOW_END 1
|
||||||
|
|
||||||
|
#include "BasePBR_ForwardPass.azsl"
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
// Note: "LowEnd" shaders are for supporting the low end pipeline
|
||||||
|
// These shaders can be safely added to materials without incurring additional runtime draw
|
||||||
|
// items as draw items for shaders are only created if the scene has a pass with a matching
|
||||||
|
// DrawListTag. If your pipeline doesn't have a "lowEndForward" DrawListTag, no draw items
|
||||||
|
// for this shader will be created.
|
||||||
|
|
||||||
|
"Source" : "./BasePBR_LowEndForward.azsl",
|
||||||
|
|
||||||
|
"DepthStencilState" :
|
||||||
|
{
|
||||||
|
"Depth" :
|
||||||
|
{
|
||||||
|
"Enable" : true,
|
||||||
|
"CompareFunc" : "GreaterEqual"
|
||||||
|
},
|
||||||
|
"Stencil" :
|
||||||
|
{
|
||||||
|
"Enable" : true,
|
||||||
|
"ReadMask" : "0x00",
|
||||||
|
"WriteMask" : "0xFF",
|
||||||
|
"FrontFace" :
|
||||||
|
{
|
||||||
|
"Func" : "Always",
|
||||||
|
"DepthFailOp" : "Keep",
|
||||||
|
"FailOp" : "Keep",
|
||||||
|
"PassOp" : "Replace"
|
||||||
|
},
|
||||||
|
"BackFace" :
|
||||||
|
{
|
||||||
|
"Func" : "Always",
|
||||||
|
"DepthFailOp" : "Keep",
|
||||||
|
"FailOp" : "Keep",
|
||||||
|
"PassOp" : "Replace"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"CompilerHints" : {
|
||||||
|
"DisableOptimizations" : false
|
||||||
|
},
|
||||||
|
|
||||||
|
"ProgramSettings":
|
||||||
|
{
|
||||||
|
"EntryPoints":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "BasePbr_ForwardPassVS",
|
||||||
|
"type": "Vertex"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BasePbr_ForwardPassPS_EDS",
|
||||||
|
"type": "Fragment"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"DrawList" : "lowEndForward"
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
#define ENABLE_CLEAR_COAT 0
|
||||||
|
#define ENABLE_TRANSMISSION 0
|
||||||
|
#define ENABLE_AREA_LIGHT_VALIDATION 0
|
||||||
|
|
||||||
|
// Include options first
|
||||||
|
#include <Atom/Features/PBR/LightingOptions.azsli>
|
||||||
|
|
||||||
|
// Then include custom surface and lighting data types
|
||||||
|
#include <Atom/Features/PBR/Lighting/LightingData.azsli>
|
||||||
|
#include <Atom/Features/PBR/Surfaces/StandardSurface.azsli>
|
||||||
|
|
||||||
|
#include <Atom/Features/PBR/LightingUtils.azsli>
|
||||||
|
#include <Atom/Features/PBR/Microfacet/Brdf.azsli>
|
||||||
|
|
||||||
|
// Then define the Diffuse and Specular lighting functions
|
||||||
|
float3 GetDiffuseLighting(Surface surface, LightingData lightingData, float3 lightIntensity, float3 dirToLight)
|
||||||
|
{
|
||||||
|
float3 diffuse = DiffuseLambertian(surface.albedo, surface.normal, dirToLight, lightingData.diffuseResponse);
|
||||||
|
diffuse *= lightIntensity;
|
||||||
|
return diffuse;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 GetSpecularLighting(Surface surface, LightingData lightingData, const float3 lightIntensity, const float3 dirToLight)
|
||||||
|
{
|
||||||
|
float3 specular = SpecularGGX(lightingData.dirToCamera, dirToLight, surface.normal, surface.specularF0, lightingData.NdotV, surface.roughnessA2, lightingData.multiScatterCompensation);
|
||||||
|
specular *= lightIntensity;
|
||||||
|
return specular;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Then include everything else
|
||||||
|
#include <Atom/Features/PBR/Lights/Lights.azsli>
|
||||||
|
#include <Atom/Features/PBR/Lights/Ibl.azsli>
|
||||||
|
|
||||||
|
|
||||||
|
struct PbrLightingOutput
|
||||||
|
{
|
||||||
|
float4 m_diffuseColor;
|
||||||
|
float4 m_specularColor;
|
||||||
|
float4 m_albedo;
|
||||||
|
float4 m_specularF0;
|
||||||
|
float4 m_normal;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
PbrLightingOutput GetPbrLightingOutput(Surface surface, LightingData lightingData, float alpha)
|
||||||
|
{
|
||||||
|
PbrLightingOutput lightingOutput;
|
||||||
|
|
||||||
|
lightingOutput.m_diffuseColor = float4(lightingData.diffuseLighting, alpha);
|
||||||
|
lightingOutput.m_specularColor = float4(lightingData.specularLighting, 1.0);
|
||||||
|
|
||||||
|
// albedo, specularF0, roughness, and normals for later passes (specular IBL, Diffuse GI, SSR, AO, etc)
|
||||||
|
lightingOutput.m_specularF0 = float4(surface.specularF0, surface.roughnessLinear);
|
||||||
|
lightingOutput.m_albedo.rgb = surface.albedo * lightingData.diffuseResponse * lightingData.diffuseAmbientOcclusion;
|
||||||
|
lightingOutput.m_albedo.a = lightingData.specularOcclusion;
|
||||||
|
lightingOutput.m_normal.rgb = EncodeNormalSignedOctahedron(surface.normal);
|
||||||
|
lightingOutput.m_normal.a = o_specularF0_enableMultiScatterCompensation ? 1.0f : 0.0f;
|
||||||
|
|
||||||
|
return lightingOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
PbrLightingOutput DebugOutput(float3 color)
|
||||||
|
{
|
||||||
|
PbrLightingOutput output = (PbrLightingOutput)0;
|
||||||
|
|
||||||
|
float3 defaultNormal = float3(0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
output.m_diffuseColor = float4(color.rgb, 1.0f);
|
||||||
|
output.m_normal.rgb = EncodeNormalSignedOctahedron(defaultNormal);
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue