Merge branch 'Atom/santorac/DepthBasedLayerBlending' into Atom/santorac/MaterialTypeCleanup
This commit is contained in:
+126
-108
@@ -3,11 +3,6 @@
|
||||
"propertyLayout": {
|
||||
"version": 3,
|
||||
"groups": [
|
||||
{
|
||||
"id": "general",
|
||||
"displayName": "General",
|
||||
"description": "General settings."
|
||||
},
|
||||
{
|
||||
"id": "blend",
|
||||
"displayName": "Blend Settings",
|
||||
@@ -29,6 +24,11 @@
|
||||
"displayName": "Irradiance",
|
||||
"description": "Properties for configuring the irradiance used in global illumination."
|
||||
},
|
||||
{
|
||||
"id": "general",
|
||||
"displayName": "General",
|
||||
"description": "General settings."
|
||||
},
|
||||
//##############################################################################################
|
||||
// Layer 1 Groups
|
||||
//##############################################################################################
|
||||
@@ -74,8 +74,8 @@
|
||||
},
|
||||
{
|
||||
"id": "layer1_parallax",
|
||||
"displayName": "Layer 1: Parallax Mapping",
|
||||
"description": "Properties for parallax effect produced by depthmap."
|
||||
"displayName": "Layer 1: Displacement",
|
||||
"description": "Properties for surface displacement, which can be used for displacement-based blending and/or a parallax effect."
|
||||
},
|
||||
{
|
||||
"id": "layer1_uv",
|
||||
@@ -127,8 +127,8 @@
|
||||
},
|
||||
{
|
||||
"id": "layer2_parallax",
|
||||
"displayName": "Layer 2: Parallax Mapping",
|
||||
"description": "Properties for parallax effect produced by depthmap."
|
||||
"displayName": "Layer 2: Displacement",
|
||||
"description": "Properties for surface displacement, which can be used for displacement-based blending and/or a parallax effect."
|
||||
},
|
||||
{
|
||||
"id": "layer2_uv",
|
||||
@@ -180,8 +180,8 @@
|
||||
},
|
||||
{
|
||||
"id": "layer3_parallax",
|
||||
"displayName": "Layer 3: Parallax Mapping",
|
||||
"description": "Properties for parallax effect produced by depthmap."
|
||||
"displayName": "Layer 3: Displacement",
|
||||
"description": "Properties for surface displacement, which can be used for displacement-based blending and/or a parallax effect."
|
||||
},
|
||||
{
|
||||
"id": "layer3_uv",
|
||||
@@ -194,18 +194,6 @@
|
||||
// General Properties
|
||||
//##############################################################################################
|
||||
"general": [
|
||||
{
|
||||
"id": "debugDrawMode",
|
||||
"displayName": "Debug Draw Mode",
|
||||
"description": "Enables various debug view features.",
|
||||
"type": "Enum",
|
||||
"enumValues": [ "None", "BlendSource", "DepthMaps" ],
|
||||
"defaultValue": "None",
|
||||
"connection": {
|
||||
"type": "ShaderOption",
|
||||
"id": "o_debugDrawMode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "applySpecularAA",
|
||||
"displayName": "Apply Specular AA",
|
||||
@@ -322,16 +310,16 @@
|
||||
"displayName": "Blend Source",
|
||||
"description": "The source to use for defining the blend mask. Note VertexColors mode will still use the texture as a fallback if the mesh does not have a COLOR0 stream.",
|
||||
"type": "Enum",
|
||||
"enumValues": ["TextureMap", "VertexColors"],
|
||||
"defaultValue": "TextureMap",
|
||||
"enumValues": ["BlendMaskTexture", "BlendMaskVertexColors", "Displacement", "Displacement_With_BlendMaskTexture", "Displacement_With_BlendMaskVertexColors"],
|
||||
"defaultValue": "BlendMaskTexture",
|
||||
"connection": {
|
||||
"type": "ShaderOption",
|
||||
"id": "o_blendSource"
|
||||
"id": "o_layerBlendSource"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "textureMap",
|
||||
"displayName": "Blend Mask",
|
||||
"displayName": "Blend Mask Texture",
|
||||
"description": "RGB image where each channel is the blend mask for one of the three available layers.",
|
||||
"type": "Image",
|
||||
"defaultValue": "Textures/DefaultBlendMask_layers.png",
|
||||
@@ -351,6 +339,32 @@
|
||||
"type": "ShaderInput",
|
||||
"id": "m_blendMaskUvIndex"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "displacementBlendDistance",
|
||||
"displayName": "Blend Distance",
|
||||
"description": "Adjusts how smoothly to transition between layers when displacement blending is enabled.",
|
||||
"type": "Float",
|
||||
"defaultValue": 0.0,
|
||||
"min": 0.0,
|
||||
"softMax": 0.1,
|
||||
"step": 0.001,
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_displacementBlendDistance"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "debugDrawMode",
|
||||
"displayName": "Debug Draw Mode",
|
||||
"description": "Enables various debug view features.",
|
||||
"type": "Enum",
|
||||
"enumValues": [ "None", "BlendMask", "Displacement", "FinalBlendWeights" ],
|
||||
"defaultValue": "None",
|
||||
"connection": {
|
||||
"type": "ShaderOption",
|
||||
"id": "o_debugDrawMode"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parallax": [
|
||||
@@ -359,7 +373,11 @@
|
||||
"displayName": "Enable",
|
||||
"description": "Whether to enable the parallax feature for this material.",
|
||||
"type": "Bool",
|
||||
"defaultValue": false
|
||||
"defaultValue": false,
|
||||
"connection": {
|
||||
"type": "ShaderOption",
|
||||
"id": "o_parallax_feature_enabled"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "parallaxUv",
|
||||
@@ -1090,27 +1108,38 @@
|
||||
}
|
||||
],
|
||||
"layer1_parallax": [
|
||||
{
|
||||
"id": "enable",
|
||||
"displayName": "Enable",
|
||||
"description": "Whether to enable the parallax feature.",
|
||||
"type": "Bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "textureMap",
|
||||
"displayName": "Texture Map",
|
||||
"description": "Depthmap to create parallax effect.",
|
||||
"description": "Displacement texture map, which can be used for layer blending and/or a parallax effect.",
|
||||
"type": "Image",
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer1_m_depthMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "useTexture",
|
||||
"displayName": "Use Texture",
|
||||
"description": "Whether to use the texture map.",
|
||||
"type": "Bool",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "invert",
|
||||
"displayName": "Invert",
|
||||
"description": "Invert the displacement map",
|
||||
"type": "Bool",
|
||||
"defaultValue": true,
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer1_m_depthInverted"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "factor",
|
||||
"displayName": "Heightmap Scale",
|
||||
"description": "The total height of the heightmap in local model units.",
|
||||
"displayName": "Scale",
|
||||
"description": "The total height of the displacement texture map in local model units.",
|
||||
"type": "Float",
|
||||
"defaultValue": 0.0,
|
||||
"min": 0.0,
|
||||
@@ -1132,17 +1161,6 @@
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer1_m_depthOffset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "invert",
|
||||
"displayName": "Invert",
|
||||
"description": "Invert to depthmap if the texture is heightmap",
|
||||
"type": "Bool",
|
||||
"defaultValue": true,
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer1_m_depthInverted"
|
||||
}
|
||||
}
|
||||
],
|
||||
"layer1_uv": [
|
||||
@@ -1796,27 +1814,38 @@
|
||||
}
|
||||
],
|
||||
"layer2_parallax": [
|
||||
{
|
||||
"id": "enable",
|
||||
"displayName": "Enable",
|
||||
"description": "Whether to enable the parallax feature.",
|
||||
"type": "Bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "textureMap",
|
||||
"displayName": "Texture Map",
|
||||
"description": "Depthmap to create parallax effect.",
|
||||
"description": "Displacement texture map, which can be used for layer blending and/or a parallax effect.",
|
||||
"type": "Image",
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer2_m_depthMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "useTexture",
|
||||
"displayName": "Use Texture",
|
||||
"description": "Whether to use the texture map.",
|
||||
"type": "Bool",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "invert",
|
||||
"displayName": "Invert",
|
||||
"description": "Invert the displacement map",
|
||||
"type": "Bool",
|
||||
"defaultValue": true,
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer2_m_depthInverted"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "factor",
|
||||
"displayName": "Heightmap Scale",
|
||||
"description": "The total height of the heightmap in local model units.",
|
||||
"displayName": "Scale",
|
||||
"description": "The total height of the displacement texture map in local model units.",
|
||||
"type": "Float",
|
||||
"defaultValue": 0.0,
|
||||
"min": 0.0,
|
||||
@@ -1838,17 +1867,6 @@
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer2_m_depthOffset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "invert",
|
||||
"displayName": "Invert",
|
||||
"description": "Invert to depthmap if the texture is heightmap",
|
||||
"type": "Bool",
|
||||
"defaultValue": true,
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer2_m_depthInverted"
|
||||
}
|
||||
}
|
||||
],
|
||||
"layer2_uv": [
|
||||
@@ -2502,27 +2520,38 @@
|
||||
}
|
||||
],
|
||||
"layer3_parallax": [
|
||||
{
|
||||
"id": "enable",
|
||||
"displayName": "Enable",
|
||||
"description": "Whether to enable the parallax feature.",
|
||||
"type": "Bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "textureMap",
|
||||
"displayName": "Texture Map",
|
||||
"description": "Depthmap to create parallax effect.",
|
||||
"description": "Displacement texture map, which can be used for layer blending and/or a parallax effect.",
|
||||
"type": "Image",
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer3_m_depthMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "useTexture",
|
||||
"displayName": "Use Texture",
|
||||
"description": "Whether to use the texture map.",
|
||||
"type": "Bool",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "invert",
|
||||
"displayName": "Invert",
|
||||
"description": "Invert the displacement map",
|
||||
"type": "Bool",
|
||||
"defaultValue": true,
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer3_m_depthInverted"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "factor",
|
||||
"displayName": "Heightmap Scale",
|
||||
"description": "The total height of the heightmap in local model units.",
|
||||
"displayName": "Scale",
|
||||
"description": "The total height of the displacement texture map in local model units.",
|
||||
"type": "Float",
|
||||
"defaultValue": 0.0,
|
||||
"min": 0.0,
|
||||
@@ -2544,17 +2573,6 @@
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer3_m_depthOffset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "invert",
|
||||
"displayName": "Invert",
|
||||
"description": "Invert to depthmap if the texture is heightmap",
|
||||
"type": "Bool",
|
||||
"defaultValue": true,
|
||||
"connection": {
|
||||
"type": "ShaderInput",
|
||||
"id": "m_layer3_m_depthInverted"
|
||||
}
|
||||
}
|
||||
],
|
||||
"layer3_uv": [
|
||||
@@ -2699,7 +2717,7 @@
|
||||
{
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
"file": "StandardMultilayerPBR_Parallax.lua"
|
||||
"file": "StandardMultilayerPBR_Displacement.lua"
|
||||
}
|
||||
},
|
||||
//##############################################################################################
|
||||
@@ -2816,12 +2834,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Lua",
|
||||
"type": "UseTexture",
|
||||
"args": {
|
||||
"file": "StandardMultilayerPBR_ParallaxPerLayer.lua",
|
||||
"propertyNamePrefix": "layer1_",
|
||||
"srgNamePrefix": "m_layer1_",
|
||||
"optionsNamePrefix": "o_layer1_"
|
||||
"textureProperty": "layer1_parallax.textureMap",
|
||||
"useTextureProperty": "layer1_parallax.useTexture",
|
||||
"dependentProperties": ["layer1_parallax.factor", "layer1_parallax.invert"],
|
||||
"shaderOption": "o_layer1_o_useDepthMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2953,12 +2971,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Lua",
|
||||
"type": "UseTexture",
|
||||
"args": {
|
||||
"file": "StandardMultilayerPBR_ParallaxPerLayer.lua",
|
||||
"propertyNamePrefix": "layer2_",
|
||||
"srgNamePrefix": "m_layer2_",
|
||||
"optionsNamePrefix": "o_layer2_"
|
||||
"textureProperty": "layer2_parallax.textureMap",
|
||||
"useTextureProperty": "layer2_parallax.useTexture",
|
||||
"dependentProperties": ["layer2_parallax.factor", "layer2_parallax.invert"],
|
||||
"shaderOption": "o_layer2_o_useDepthMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3090,14 +3108,14 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Lua",
|
||||
"type": "UseTexture",
|
||||
"args": {
|
||||
"file": "StandardMultilayerPBR_ParallaxPerLayer.lua",
|
||||
"propertyNamePrefix": "layer3_",
|
||||
"srgNamePrefix": "m_layer3_",
|
||||
"optionsNamePrefix": "o_layer3_"
|
||||
"textureProperty": "layer3_parallax.textureMap",
|
||||
"useTextureProperty": "layer3_parallax.useTexture",
|
||||
"dependentProperties": ["layer3_parallax.factor", "layer3_parallax.invert"],
|
||||
"shaderOption": "o_layer3_o_useDepthMap"
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
// Maps 2D scale, offset, and rotate properties into a float3x3 transform matrix.
|
||||
"type": "Transform2D",
|
||||
|
||||
+272
-64
@@ -15,6 +15,7 @@
|
||||
#include <Atom/Features/SrgSemantics.azsli>
|
||||
#include <Atom/RPI/ShaderResourceGroups/DefaultDrawSrg.azsli>
|
||||
#include <Atom/Features/PBR/LightingOptions.azsli>
|
||||
#include <Atom/RPI/Math.azsli>
|
||||
|
||||
#include "MaterialInputs/BaseColorInput.azsli"
|
||||
#include "MaterialInputs/RoughnessInput.azsli"
|
||||
@@ -42,9 +43,19 @@ COMMON_SRG_INPUTS_PARALLAX(prefix)
|
||||
|
||||
ShaderResourceGroup MaterialSrg : SRG_PerMaterial
|
||||
{
|
||||
Texture2D m_blendMaskTexture;
|
||||
Texture2D m_blendMaskTexture;
|
||||
uint m_blendMaskUvIndex;
|
||||
|
||||
// When parallax mapping is used, these limit the heightmap intersection search range to the narrowest band possible, to give the best quality result.
|
||||
// These are also support other calculations related to displacement-based blending, even when parallax is not used.
|
||||
float m_displacementMin; // The lowest displacement value possible from all layers combined (negative values are below the surface)
|
||||
float m_displacementMax; // The highest displacement value possible from all layers combined (negative values are below the surface)
|
||||
|
||||
// When displacement-based blending is used, this is the height range where the surface properties of different layers will be blended together.
|
||||
// We use an absolute value rather than a relative factor because disconnecting this property from the influence of other properties makes per-layer
|
||||
// displacement adjustments feel more natural if they don't impact the blend distance.
|
||||
float m_displacementBlendDistance;
|
||||
|
||||
// Auto-generate material SRG fields for common inputs for each layer
|
||||
DEFINE_LAYER_SRG_INPUTS(m_layer1_)
|
||||
DEFINE_LAYER_SRG_INPUTS(m_layer2_)
|
||||
@@ -61,10 +72,6 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
|
||||
|
||||
uint m_parallaxUvIndex;
|
||||
|
||||
// These are used to limit the heightmap intersection search range to the narrowest band possible, to give the best quality result.
|
||||
float m_displacementMin; // The lowest displacement value possible from all layers combined
|
||||
float m_displacementMax; // The highest displacement value possible from all layers combined
|
||||
|
||||
float3x3 m_uvMatrix;
|
||||
float4 m_pad4; // [GFX TODO][ATOM-14595] This is a workaround for a data stomping bug. Remove once it's fixed.
|
||||
float3x3 m_uvMatrixInverse;
|
||||
@@ -98,11 +105,11 @@ ShaderResourceGroup MaterialSrg : SRG_PerMaterial
|
||||
option bool o_layer2_enabled;
|
||||
option bool o_layer3_enabled;
|
||||
|
||||
enum class DebugDrawMode { None, BlendSource, DepthMaps };
|
||||
enum class DebugDrawMode { None, BlendMask, Displacement, FinalBlendWeights };
|
||||
option DebugDrawMode o_debugDrawMode;
|
||||
|
||||
enum class BlendMaskSource { TextureMap, VertexColors, Fallback };
|
||||
option BlendMaskSource o_blendSource;
|
||||
enum class LayerBlendSource { BlendMaskTexture, BlendMaskVertexColors, Displacement, Displacement_With_BlendMaskTexture, Displacement_With_BlendMaskVertexColors, Fallback };
|
||||
option LayerBlendSource o_layerBlendSource;
|
||||
|
||||
// Indicates whether the vertex input struct's "m_optional_blendMask" is bound. If false, it is not safe to read from m_optional_blendMask.
|
||||
// This option gets set automatically by the system at runtime; there is a soft naming convention that associates it with m_optional_blendMask.
|
||||
@@ -111,53 +118,83 @@ option BlendMaskSource o_blendSource;
|
||||
option bool o_blendMask_isBound;
|
||||
|
||||
// ------ Blend Utilities ----------------------------------------
|
||||
|
||||
// This is mainly used to pass extra data to the GetDepth callback function during the parallax depth search.
|
||||
// But since we have it, we use it in some other functions as well rather than passing it around.
|
||||
static float3 s_blendMaskFromVertexStream;
|
||||
|
||||
//! Returns the BlendMaskSource that will actually be used when rendering (not necessarily the same BlendMaskSource specified by the user)
|
||||
BlendMaskSource GetFinalBlendMaskSource()
|
||||
// TODO: Consider storing the result of GetFinalLayerBlendSource() in a static similar to s_blendMaskFromVertexStream. That might give better performance when variants aren't used.
|
||||
|
||||
//! Returns the LayerBlendSource that will actually be used when rendering (not necessarily the same LayerBlendSource specified by the user)
|
||||
LayerBlendSource GetFinalLayerBlendSource()
|
||||
{
|
||||
if(o_blendSource == BlendMaskSource::TextureMap)
|
||||
if(o_layerBlendSource == LayerBlendSource::BlendMaskTexture)
|
||||
{
|
||||
return BlendMaskSource::TextureMap;
|
||||
return o_layerBlendSource;
|
||||
}
|
||||
else if(o_blendSource == BlendMaskSource::VertexColors)
|
||||
else if(o_layerBlendSource == LayerBlendSource::BlendMaskVertexColors)
|
||||
{
|
||||
if(o_blendMask_isBound)
|
||||
{
|
||||
return BlendMaskSource::VertexColors;
|
||||
return o_layerBlendSource;
|
||||
}
|
||||
else
|
||||
{
|
||||
return BlendMaskSource::TextureMap;
|
||||
return LayerBlendSource::Fallback;
|
||||
}
|
||||
}
|
||||
else if(o_layerBlendSource == LayerBlendSource::Displacement)
|
||||
{
|
||||
return o_layerBlendSource;
|
||||
}
|
||||
else if(o_layerBlendSource == LayerBlendSource::Displacement_With_BlendMaskTexture)
|
||||
{
|
||||
return o_layerBlendSource;
|
||||
}
|
||||
else if(o_layerBlendSource == LayerBlendSource::Displacement_With_BlendMaskVertexColors)
|
||||
{
|
||||
if(o_blendMask_isBound)
|
||||
{
|
||||
return o_layerBlendSource;
|
||||
}
|
||||
else
|
||||
{
|
||||
return LayerBlendSource::Displacement;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return BlendMaskSource::Fallback;
|
||||
return LayerBlendSource::Fallback;
|
||||
}
|
||||
}
|
||||
|
||||
//! Return the raw blend source values directly from the blend mask or vertex colors, depending on the available data and configuration.
|
||||
//! Return the applicable blend mask values from the blend mask texture or vertex colors, and filters out any that don't apply.
|
||||
//! layer1 is an implicit base layer
|
||||
//! layer2 is weighted by r
|
||||
//! layer3 is weighted by g
|
||||
//! layer2 mask is in the r channel
|
||||
//! layer3 mask is in the g channel
|
||||
//! b is reserved for perhaps a dedicated puddle layer
|
||||
float3 GetBlendSourceValues(float2 uv)
|
||||
//! @param blendSource indicates where to get the blend mask from
|
||||
//! @param blendMaskUv for sampling a blend mask texture, if that's the blend source
|
||||
//! @param blendMaskVertexColors the vertex color values to use for the blend mask, if that's the blend source
|
||||
//! @return the blend mask values, or 0 if there is no blend mask
|
||||
float3 GetApplicableBlendMaskValues(LayerBlendSource blendSource, float2 blendMaskUv, float3 blendMaskVertexColors)
|
||||
{
|
||||
float3 blendSourceValues = float3(0,0,0);
|
||||
|
||||
if(o_layer2_enabled || o_layer3_enabled)
|
||||
{
|
||||
switch(GetFinalBlendMaskSource())
|
||||
switch(blendSource)
|
||||
{
|
||||
case BlendMaskSource::TextureMap:
|
||||
blendSourceValues = MaterialSrg::m_blendMaskTexture.Sample(MaterialSrg::m_sampler, uv).rgb;
|
||||
case LayerBlendSource::Displacement:
|
||||
// In this case the blend mask has no effect, returning (1,1,1) disables any impact of the mask.
|
||||
blendSourceValues = float3(1,1,1);
|
||||
break;
|
||||
case BlendMaskSource::VertexColors:
|
||||
blendSourceValues = s_blendMaskFromVertexStream;
|
||||
case LayerBlendSource::BlendMaskTexture:
|
||||
case LayerBlendSource::Displacement_With_BlendMaskTexture:
|
||||
blendSourceValues = MaterialSrg::m_blendMaskTexture.Sample(MaterialSrg::m_sampler, blendMaskUv).rgb;
|
||||
break;
|
||||
case LayerBlendSource::BlendMaskVertexColors:
|
||||
case LayerBlendSource::Displacement_With_BlendMaskVertexColors:
|
||||
blendSourceValues = blendMaskVertexColors;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -175,29 +212,96 @@ float3 GetBlendSourceValues(float2 uv)
|
||||
return blendSourceValues;
|
||||
}
|
||||
|
||||
//! Return the final blend mask values to be used for rendering, based on the available data and configuration.
|
||||
//! When dealing with masks for displacement-based blending, we sometimes need to push the value below the min displacement to make it disappear.
|
||||
float GetSubMinDisplacement()
|
||||
{
|
||||
return MaterialSrg::m_displacementMin - 0.001;
|
||||
//return MaterialSrg::m_displacementMin - max(MaterialSrg::m_displacementBlendDistance, 0.001);
|
||||
}
|
||||
|
||||
float3 ApplyBlendMaskToDepthValues(float3 blendMaskValues, float3 layerDepthValues, float zeroMaskDisplacement);
|
||||
|
||||
//! Return the final blend weights to be used for rendering, based on the available data and configuration.
|
||||
//! @param blendSource - indicates where to get the blend mask from
|
||||
//! @param blendMaskValues - blend mask values as returned by GetApplicableBlendMaskValues()
|
||||
//! @param layerDepthValues - the depth values for each layer, used if the blend source includes displacement. See GetLayerDepthValues().
|
||||
//! Note the blendMaskValues will not be applied here, those should have already been applied to layerDepthValues.
|
||||
//! @param layerDepthBlendDistance - controls how smoothly to blend layers 2 and 3 with the base layer, when the blend source includes displacement.
|
||||
//! When layers are close together their weights will be blended together, otherwise the highest layer will have the full weight.
|
||||
//! @return The blend weights for each layer.
|
||||
//! Even though layer1 not explicitly specified in the blend source data, it is explicitly included with the returned values.
|
||||
//! Even though layer1 not explicitly specified in the blend mask data, it is explicitly included with the returned values.
|
||||
//! layer1 = r
|
||||
//! layer2 = g
|
||||
//! layer3 = b
|
||||
float3 GetBlendWeights(float2 uv)
|
||||
float3 GetBlendWeights(LayerBlendSource blendSource, float3 blendMaskValues, float3 layerDepthValues, float layerDepthBlendDistance)
|
||||
{
|
||||
float3 blendWeights;
|
||||
|
||||
if(o_layer2_enabled || o_layer3_enabled)
|
||||
{
|
||||
float3 blendSourceValues = GetBlendSourceValues(uv);
|
||||
if(LayerBlendSource::Displacement == blendSource ||
|
||||
LayerBlendSource::Displacement_With_BlendMaskTexture == blendSource ||
|
||||
LayerBlendSource::Displacement_With_BlendMaskVertexColors == blendSource)
|
||||
{
|
||||
// Calculate the blend weights based on displacement values...
|
||||
|
||||
// Calculate blend weights such that multiplying and adding them with layer data is equivalent
|
||||
// to lerping between each layer.
|
||||
// final = lerp(final, layer1, blendWeights.r)
|
||||
// final = lerp(final, layer2, blendWeights.g)
|
||||
// final = lerp(final, layer3, blendWeights.b)
|
||||
// The inputs are depth values, but we change them to height values to make the code a bit more intuitive.
|
||||
float3 layerHeightValues = -layerDepthValues;
|
||||
|
||||
float highestPoint = layerHeightValues.x;
|
||||
if(o_layer2_enabled)
|
||||
{
|
||||
highestPoint = max(highestPoint, layerHeightValues.y);
|
||||
}
|
||||
if(o_layer3_enabled)
|
||||
{
|
||||
highestPoint = max(highestPoint, layerHeightValues.z);
|
||||
}
|
||||
|
||||
if(layerDepthBlendDistance > 0.0001)
|
||||
{
|
||||
float lowestVisiblePoint = highestPoint - layerDepthBlendDistance;
|
||||
blendWeights = smoothstep(lowestVisiblePoint, highestPoint, layerHeightValues);
|
||||
|
||||
if(!o_layer2_enabled)
|
||||
{
|
||||
blendWeights.y = 0.0;
|
||||
}
|
||||
|
||||
if(!o_layer3_enabled)
|
||||
{
|
||||
blendWeights.z = 0.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blendWeights = float3(layerHeightValues.x >= highestPoint ? 1.0 : 0.0,
|
||||
layerHeightValues.y >= highestPoint && o_layer2_enabled ? 1.0 : 0.0,
|
||||
layerHeightValues.z >= highestPoint && o_layer3_enabled ? 1.0 : 0.0);
|
||||
}
|
||||
|
||||
// Calculate blend weights such that multiplying and adding them with layer data is equivalent
|
||||
// to lerping between each layer.
|
||||
// final = lerp(final, layer1, blendWeights.r)
|
||||
// final = lerp(final, layer2, blendWeights.g)
|
||||
// final = lerp(final, layer3, blendWeights.b)
|
||||
|
||||
blendWeights.y = (1 - blendWeights.z) * blendWeights.y;
|
||||
blendWeights.x = 1 - blendWeights.y - blendWeights.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculate blend weights such that multiplying and adding them with layer data is equivalent
|
||||
// to lerping between each layer.
|
||||
// final = lerp(final, layer1, blendWeights.r)
|
||||
// final = lerp(final, layer2, blendWeights.g)
|
||||
// final = lerp(final, layer3, blendWeights.b)
|
||||
|
||||
blendWeights.b = blendMaskValues.g;
|
||||
blendWeights.g = (1.0 - blendMaskValues.g) * blendMaskValues.r;
|
||||
blendWeights.r = (1.0 - blendMaskValues.g) * (1.0 - blendMaskValues.r);
|
||||
}
|
||||
|
||||
blendWeights.b = blendSourceValues.g;
|
||||
blendWeights.g = (1.0 - blendSourceValues.g) * blendSourceValues.r;
|
||||
blendWeights.r = (1.0 - blendSourceValues.g) * (1.0 - blendSourceValues.r);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,6 +311,38 @@ float3 GetBlendWeights(float2 uv)
|
||||
return blendWeights;
|
||||
}
|
||||
|
||||
float3 GetLayerDepthValues(float2 uv, float2 uv_ddx, float2 uv_ddy);
|
||||
|
||||
//! Return the final blend weights to be used for rendering, based on the available data and configuration.
|
||||
//! Note this will sample the displacement maps in the case of LayerBlendSource::Displacement. If you have already
|
||||
//! the layer depth values, use the GetBlendWeights() overload that takes layerDepthValues instead.
|
||||
float3 GetBlendWeights(LayerBlendSource blendSource, float2 uv, float3 blendMaskVertexColors)
|
||||
{
|
||||
float3 layerDepthValues = float3(0,0,0);
|
||||
|
||||
float3 blendMaskValues = GetApplicableBlendMaskValues(blendSource, uv, blendMaskVertexColors);
|
||||
|
||||
if(blendSource == LayerBlendSource::Displacement ||
|
||||
blendSource == LayerBlendSource::Displacement_With_BlendMaskTexture ||
|
||||
blendSource == LayerBlendSource::Displacement_With_BlendMaskVertexColors)
|
||||
{
|
||||
bool useBlendMask =
|
||||
LayerBlendSource::Displacement_With_BlendMaskTexture == blendSource ||
|
||||
LayerBlendSource::Displacement_With_BlendMaskVertexColors == blendSource;
|
||||
|
||||
layerDepthValues = GetLayerDepthValues(uv, ddx_fine(uv), ddy_fine(uv));
|
||||
|
||||
if(useBlendMask)
|
||||
{
|
||||
// Unlike the GetDepth() callback used for parallax, we don't just shift the values toward GetSubMinDisplacement(),
|
||||
// we shift extra to ensure that completely masked-out layers are not blended onto upper layers.
|
||||
layerDepthValues = ApplyBlendMaskToDepthValues(blendMaskValues, layerDepthValues, GetSubMinDisplacement() - MaterialSrg::m_displacementBlendDistance);
|
||||
}
|
||||
}
|
||||
|
||||
return GetBlendWeights(blendSource, blendMaskValues, layerDepthValues, MaterialSrg::m_displacementBlendDistance);
|
||||
}
|
||||
|
||||
float BlendLayers(float layer1, float layer2, float layer3, float3 blendWeights)
|
||||
{
|
||||
return dot(float3(layer1, layer2, layer3), blendWeights);
|
||||
@@ -236,55 +372,127 @@ bool ShouldHandleParallaxInDepthShaders()
|
||||
return ShouldHandleParallax() && o_parallax_enablePixelDepthOffset;
|
||||
}
|
||||
|
||||
// Callback function for ParallaxMapping.azsli
|
||||
DepthResult GetDepth(float2 uv, float2 uv_ddx, float2 uv_ddy)
|
||||
//! Returns the depth values for each layer.
|
||||
float3 GetLayerDepthValues(float2 uv, float2 uv_ddx, float2 uv_ddy)
|
||||
{
|
||||
float3 layerDepthValues = float3(0,0,0);
|
||||
|
||||
if(o_layer1_o_useDepthMap)
|
||||
|
||||
// layer1
|
||||
{
|
||||
float2 layerUv = uv;
|
||||
if(MaterialSrg::m_parallaxUvIndex == 0)
|
||||
if(o_layer1_o_useDepthMap)
|
||||
{
|
||||
layerUv = mul(MaterialSrg::m_layer1_m_uvMatrix, float3(uv, 1.0)).xy;
|
||||
float2 layerUv = uv;
|
||||
if(MaterialSrg::m_parallaxUvIndex == 0)
|
||||
{
|
||||
layerUv = mul(MaterialSrg::m_layer1_m_uvMatrix, float3(uv, 1.0)).xy;
|
||||
}
|
||||
|
||||
layerDepthValues.r = SampleDepthOrHeightMap(MaterialSrg::m_layer1_m_depthInverted, MaterialSrg::m_layer1_m_depthMap, MaterialSrg::m_sampler, layerUv, uv_ddx, uv_ddy).m_depth;
|
||||
layerDepthValues.r *= MaterialSrg::m_layer1_m_depthFactor;
|
||||
}
|
||||
|
||||
layerDepthValues.r = SampleDepthOrHeightMap(MaterialSrg::m_layer1_m_depthInverted, MaterialSrg::m_layer1_m_depthMap, MaterialSrg::m_sampler, layerUv, uv_ddx, uv_ddy).m_depth;
|
||||
layerDepthValues.r *= MaterialSrg::m_layer1_m_depthFactor;
|
||||
layerDepthValues.r -= MaterialSrg::m_layer1_m_depthOffset;
|
||||
}
|
||||
|
||||
if(o_layer2_enabled && o_layer2_o_useDepthMap)
|
||||
if(o_layer2_enabled)
|
||||
{
|
||||
float2 layerUv = uv;
|
||||
if(MaterialSrg::m_parallaxUvIndex == 0)
|
||||
if(o_layer2_o_useDepthMap)
|
||||
{
|
||||
layerUv = mul(MaterialSrg::m_layer2_m_uvMatrix, float3(uv, 1.0)).xy;
|
||||
float2 layerUv = uv;
|
||||
if(MaterialSrg::m_parallaxUvIndex == 0)
|
||||
{
|
||||
layerUv = mul(MaterialSrg::m_layer2_m_uvMatrix, float3(uv, 1.0)).xy;
|
||||
}
|
||||
|
||||
layerDepthValues.g = SampleDepthOrHeightMap(MaterialSrg::m_layer2_m_depthInverted, MaterialSrg::m_layer2_m_depthMap, MaterialSrg::m_sampler, layerUv, uv_ddx, uv_ddy).m_depth;
|
||||
layerDepthValues.g *= MaterialSrg::m_layer2_m_depthFactor;
|
||||
}
|
||||
|
||||
layerDepthValues.g = SampleDepthOrHeightMap(MaterialSrg::m_layer2_m_depthInverted, MaterialSrg::m_layer2_m_depthMap, MaterialSrg::m_sampler, layerUv, uv_ddx, uv_ddy).m_depth;
|
||||
layerDepthValues.g *= MaterialSrg::m_layer2_m_depthFactor;
|
||||
layerDepthValues.g -= MaterialSrg::m_layer2_m_depthOffset;
|
||||
|
||||
}
|
||||
|
||||
if(o_layer3_enabled && o_layer3_o_useDepthMap)
|
||||
if(o_layer3_enabled)
|
||||
{
|
||||
float2 layerUv = uv;
|
||||
if(MaterialSrg::m_parallaxUvIndex == 0)
|
||||
if(o_layer3_o_useDepthMap)
|
||||
{
|
||||
layerUv = mul(MaterialSrg::m_layer3_m_uvMatrix, float3(uv, 1.0)).xy;
|
||||
float2 layerUv = uv;
|
||||
if(MaterialSrg::m_parallaxUvIndex == 0)
|
||||
{
|
||||
layerUv = mul(MaterialSrg::m_layer3_m_uvMatrix, float3(uv, 1.0)).xy;
|
||||
}
|
||||
|
||||
layerDepthValues.b = SampleDepthOrHeightMap(MaterialSrg::m_layer3_m_depthInverted, MaterialSrg::m_layer3_m_depthMap, MaterialSrg::m_sampler, layerUv, uv_ddx, uv_ddy).m_depth;
|
||||
layerDepthValues.b *= MaterialSrg::m_layer3_m_depthFactor;
|
||||
}
|
||||
|
||||
layerDepthValues.b = SampleDepthOrHeightMap(MaterialSrg::m_layer3_m_depthInverted, MaterialSrg::m_layer3_m_depthMap, MaterialSrg::m_sampler, layerUv, uv_ddx, uv_ddy).m_depth;
|
||||
layerDepthValues.b *= MaterialSrg::m_layer3_m_depthFactor;
|
||||
layerDepthValues.b -= MaterialSrg::m_layer3_m_depthOffset;
|
||||
|
||||
}
|
||||
|
||||
// Note, when the blend source is BlendMaskSource::VertexColors, parallax will not be able to blend correctly between layers. It will end up using the same blend mask values
|
||||
// for every UV position when searching for the intersection. This leads to smearing artifacts at the transition point, but these won't be so noticeable as long as
|
||||
// you have a small depth factor relative to the size of the blend transition.
|
||||
float3 blendWeights = GetBlendWeights(uv);
|
||||
return layerDepthValues;
|
||||
}
|
||||
|
||||
|
||||
//! Uses a layer blend mask to further displace each layer's surface so that it disappears beyond the other surfaces.
|
||||
//! Note the blend mask does not apply to the first layer, it is the implicit base layer. Layers 2 and 3 are masked by the r and g channels of the mask.
|
||||
//! @param blendMaskValues layer mask values as returned by GetApplicableBlendMaskValues()
|
||||
//! @param layerDepthValues layer depth values as returned by GetLayerDepthValues()
|
||||
//! @param zeroMaskDisplacement the target displacement value that corresponds to a mask value of 0
|
||||
//! @return new layer depth values that have been adjusted according to the layerMaskValues
|
||||
float3 ApplyBlendMaskToDepthValues(float3 blendMaskValues, float3 layerDepthValues, float zeroMaskDisplacement)
|
||||
{
|
||||
if(o_layer2_enabled || o_layer3_enabled)
|
||||
{
|
||||
// We add to the depth value rather than lerp toward m_displacementMin to avoid squashing the topology, but instead lower it out of sight.
|
||||
|
||||
if(o_layer2_enabled)
|
||||
{
|
||||
float dropoffRange = MaterialSrg::m_layer2_m_depthOffset - zeroMaskDisplacement;
|
||||
layerDepthValues.g += dropoffRange * (1-blendMaskValues.r);
|
||||
}
|
||||
|
||||
if(o_layer3_enabled)
|
||||
{
|
||||
float dropoffRange = MaterialSrg::m_layer3_m_depthOffset - zeroMaskDisplacement;
|
||||
layerDepthValues.b += dropoffRange * (1-blendMaskValues.g);
|
||||
}
|
||||
}
|
||||
|
||||
return layerDepthValues;
|
||||
}
|
||||
|
||||
//! Callback function for ParallaxMapping.azsli
|
||||
DepthResult GetDepth(float2 uv, float2 uv_ddx, float2 uv_ddy)
|
||||
{
|
||||
LayerBlendSource blendSource = GetFinalLayerBlendSource();
|
||||
|
||||
float3 layerDepthValues = GetLayerDepthValues(uv, uv_ddx, uv_ddy);
|
||||
|
||||
// Note, when the blend source uses the blend mask from the vertex colors, parallax will not be able to blend correctly between layers. It will end up using the same blend mask values
|
||||
// for every UV position when searching for the intersection. This leads to smearing artifacts at the transition point, but these won't be as noticeable if
|
||||
// you have a small depth factor relative to the size of the blend transition.
|
||||
float3 blendMaskValues = GetApplicableBlendMaskValues(blendSource, uv, s_blendMaskFromVertexStream);
|
||||
|
||||
bool useBlendMask =
|
||||
LayerBlendSource::Displacement_With_BlendMaskTexture == blendSource ||
|
||||
LayerBlendSource::Displacement_With_BlendMaskVertexColors == blendSource;
|
||||
|
||||
if(useBlendMask)
|
||||
{
|
||||
// Regarding GetSubMinDisplacement(), when a mask of 0 pushes the surface all the way to the bottom, we want that
|
||||
// to go a little below the min so it will disappear if there is something else right at the min.
|
||||
|
||||
layerDepthValues = ApplyBlendMaskToDepthValues(blendMaskValues, layerDepthValues, GetSubMinDisplacement());
|
||||
}
|
||||
|
||||
// When blending the depth together, we don't use MaterialSrg::m_displacementBlendDistance. The intention is that m_displacementBlendDistance
|
||||
// is for transitioning the appearance of the surface itself, but we still want a distinct change in the heightmap. If someday we want to
|
||||
// support smoothly blending the depth as well, there is a bit more work to do to get it to play nice with the blend mask code in GetLayerDepthValues().
|
||||
float layerDepthBlendDistance = 0.0f;
|
||||
float3 blendWeightValues = GetBlendWeights(blendSource, blendMaskValues, layerDepthValues, layerDepthBlendDistance);
|
||||
|
||||
float depth = BlendLayers(layerDepthValues.r, layerDepthValues.g, layerDepthValues.b, blendWeightValues);
|
||||
|
||||
float depth = BlendLayers(layerDepthValues.r, layerDepthValues.g, layerDepthValues.b, blendWeights);
|
||||
return DepthResultAbsolute(depth);
|
||||
}
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ VSDepthOutput MainVS(VSInput IN)
|
||||
}
|
||||
else
|
||||
{
|
||||
OUT.m_blendMask = float3(1,1,1);
|
||||
OUT.m_blendMask = float3(0,0,0);
|
||||
}
|
||||
|
||||
return OUT;
|
||||
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
--------------------------------------------------------------------------------------
|
||||
--
|
||||
-- All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
-- its licensors.
|
||||
--
|
||||
-- For complete copyright and license terms please see the LICENSE at the root of this
|
||||
-- distribution (the "License"). All use of this software is governed by the License,
|
||||
-- or, if provided, by the license below or the license accompanying this file. Do not
|
||||
-- remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
--
|
||||
--
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
-- This functor handles general parallax properties that affect the entire material.
|
||||
|
||||
function GetMaterialPropertyDependencies()
|
||||
return {
|
||||
"blend.blendSource",
|
||||
"blend.enableLayer2",
|
||||
"blend.enableLayer3",
|
||||
"parallax.enable",
|
||||
"layer1_parallax.textureMap",
|
||||
"layer2_parallax.textureMap",
|
||||
"layer3_parallax.textureMap",
|
||||
"layer1_parallax.useTexture",
|
||||
"layer2_parallax.useTexture",
|
||||
"layer3_parallax.useTexture",
|
||||
"layer1_parallax.factor",
|
||||
"layer2_parallax.factor",
|
||||
"layer3_parallax.factor",
|
||||
"layer1_parallax.offset",
|
||||
"layer2_parallax.offset",
|
||||
"layer3_parallax.offset"
|
||||
}
|
||||
end
|
||||
|
||||
-- These values must align with LayerBlendSource in StandardMultilayerPBR_Common.azsli.
|
||||
LayerBlendSource_BlendMaskTexture = 0
|
||||
LayerBlendSource_BlendMaskVertexColors = 1
|
||||
LayerBlendSource_Displacement = 2
|
||||
LayerBlendSource_Displacement_With_BlendMaskTexture = 3
|
||||
LayerBlendSource_Displacement_With_BlendMaskVertexColors = 4
|
||||
|
||||
function BlendSourceUsesDisplacement(context)
|
||||
local blendSource = context:GetMaterialPropertyValue_enum("blend.blendSource")
|
||||
local blendSourceIncludesDisplacement = (blendSource == LayerBlendSource_Displacement or
|
||||
blendSource == LayerBlendSource_Displacement_With_BlendMaskTexture or
|
||||
blendSource == LayerBlendSource_Displacement_With_BlendMaskVertexColors)
|
||||
return blendSourceIncludesDisplacement
|
||||
end
|
||||
|
||||
-- Calculates the min and max displacement height values encompassing all enabled layers.
|
||||
-- @return a table with two values {min,max}. Negative values are below the surface and positive values are above the surface.
|
||||
function CalcOverallHeightRange(context)
|
||||
|
||||
local heightMinMax = {nil, nil}
|
||||
|
||||
local function GetMergedHeightRange(heightMinMax, offset, factor)
|
||||
top = offset
|
||||
bottom = offset - factor
|
||||
|
||||
if(heightMinMax[1] == nil) then
|
||||
heightMinMax[1] = top
|
||||
else
|
||||
heightMinMax[1] = math.max(heightMinMax[1], top)
|
||||
end
|
||||
|
||||
if(heightMinMax[0] == nil) then
|
||||
heightMinMax[0] = bottom
|
||||
else
|
||||
heightMinMax[0] = math.min(heightMinMax[0], bottom)
|
||||
end
|
||||
end
|
||||
|
||||
local enableParallax = context:GetMaterialPropertyValue_bool("parallax.enable")
|
||||
|
||||
if(enableParallax or BlendSourceUsesDisplacement(context)) then
|
||||
local hasTextureLayer1 = nil ~= context:GetMaterialPropertyValue_Image("layer1_parallax.textureMap")
|
||||
local hasTextureLayer2 = nil ~= context:GetMaterialPropertyValue_Image("layer2_parallax.textureMap")
|
||||
local hasTextureLayer3 = nil ~= context:GetMaterialPropertyValue_Image("layer3_parallax.textureMap")
|
||||
|
||||
local useTextureLayer1 = context:GetMaterialPropertyValue_bool("layer1_parallax.useTexture")
|
||||
local useTextureLayer2 = context:GetMaterialPropertyValue_bool("layer2_parallax.useTexture")
|
||||
local useTextureLayer3 = context:GetMaterialPropertyValue_bool("layer3_parallax.useTexture")
|
||||
|
||||
local factorLayer1 = context:GetMaterialPropertyValue_float("layer1_parallax.factor")
|
||||
local factorLayer2 = context:GetMaterialPropertyValue_float("layer2_parallax.factor")
|
||||
local factorLayer3 = context:GetMaterialPropertyValue_float("layer3_parallax.factor")
|
||||
|
||||
if not hasTextureLayer1 or not useTextureLayer1 then factorLayer1 = 0 end
|
||||
if not hasTextureLayer2 or not useTextureLayer2 then factorLayer2 = 0 end
|
||||
if not hasTextureLayer3 or not useTextureLayer3 then factorLayer3 = 0 end
|
||||
|
||||
local offsetLayer1 = context:GetMaterialPropertyValue_float("layer1_parallax.offset")
|
||||
local offsetLayer2 = context:GetMaterialPropertyValue_float("layer2_parallax.offset")
|
||||
local offsetLayer3 = context:GetMaterialPropertyValue_float("layer3_parallax.offset")
|
||||
|
||||
local enableLayer2 = context:GetMaterialPropertyValue_bool("blend.enableLayer2")
|
||||
local enableLayer3 = context:GetMaterialPropertyValue_bool("blend.enableLayer3")
|
||||
|
||||
GetMergedHeightRange(heightMinMax, offsetLayer1, factorLayer1)
|
||||
if(enableLayer2) then GetMergedHeightRange(heightMinMax, offsetLayer2, factorLayer2) end
|
||||
if(enableLayer3) then GetMergedHeightRange(heightMinMax, offsetLayer3, factorLayer3) end
|
||||
|
||||
else
|
||||
heightMinMax = {0,0}
|
||||
end
|
||||
|
||||
return heightMinMax
|
||||
end
|
||||
|
||||
function Process(context)
|
||||
local heightMinMax = CalcOverallHeightRange(context)
|
||||
context:SetShaderConstant_float("m_displacementMin", heightMinMax[0])
|
||||
context:SetShaderConstant_float("m_displacementMax", heightMinMax[1])
|
||||
end
|
||||
|
||||
function ProcessEditor(context)
|
||||
local enable = context:GetMaterialPropertyValue_bool("parallax.enable")
|
||||
|
||||
local visibility = MaterialPropertyVisibility_Enabled
|
||||
if(not enable) then
|
||||
visibility = MaterialPropertyVisibility_Hidden
|
||||
end
|
||||
|
||||
context:SetMaterialPropertyVisibility("parallax.parallaxUv", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.algorithm", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.quality", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.pdo", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.showClipping", visibility)
|
||||
|
||||
if BlendSourceUsesDisplacement(context) then
|
||||
context:SetMaterialPropertyVisibility("blend.displacementBlendDistance", MaterialPropertyVisibility_Enabled)
|
||||
else
|
||||
context:SetMaterialPropertyVisibility("blend.displacementBlendDistance", MaterialPropertyVisibility_Hidden)
|
||||
end
|
||||
|
||||
-- We set the displacementBlendDistance slider range to match the range of displacement, so the slider will feel good
|
||||
-- regardless of how big the overall displacement is. Using a soft max allows the user to exceed the limit if desired,
|
||||
-- but the main reason for the *soft* max is to avoid impacting the value of displacementBlendDistance which could
|
||||
-- otherwise lead to edge cases.
|
||||
local heightMinMax = CalcOverallHeightRange(context)
|
||||
local totalDisplacementRange = heightMinMax[1] - heightMinMax[0]
|
||||
context:SetMaterialPropertySoftMaxValue_float("blend.displacementBlendDistance", math.max(totalDisplacementRange, 0.001))
|
||||
end
|
||||
|
||||
+36
-13
@@ -116,7 +116,7 @@ VSOutput ForwardPassVS(VSInput IN)
|
||||
}
|
||||
else
|
||||
{
|
||||
OUT.m_blendMask = float3(1,1,1);
|
||||
OUT.m_blendMask = float3(0,0,0);
|
||||
}
|
||||
|
||||
// Shadow coords will be calculated in the pixel shader in this case
|
||||
@@ -310,6 +310,8 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
|
||||
s_blendMaskFromVertexStream = IN.m_blendMask;
|
||||
|
||||
LayerBlendSource blendSource = GetFinalLayerBlendSource();
|
||||
|
||||
// ------- Tangents & Bitangets -------
|
||||
|
||||
// We support two UV streams, but only a single stream of tangent/bitangent. So for UV[1+] we generated the tangent/bitangent in screen-space.
|
||||
@@ -332,16 +334,25 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
|
||||
// ------- Debug Modes -------
|
||||
|
||||
if(o_debugDrawMode == DebugDrawMode::BlendSource)
|
||||
if(o_debugDrawMode == DebugDrawMode::BlendMask)
|
||||
{
|
||||
float3 blendSource = GetBlendSourceValues(IN.m_uv[MaterialSrg::m_blendMaskUvIndex]);
|
||||
return DebugOutput(blendSource);
|
||||
float3 blendMaskValues = GetApplicableBlendMaskValues(blendSource, IN.m_uv[MaterialSrg::m_blendMaskUvIndex], IN.m_blendMask);
|
||||
return DebugOutput(blendMaskValues);
|
||||
}
|
||||
|
||||
if(o_debugDrawMode == DebugDrawMode::DepthMaps)
|
||||
if(o_debugDrawMode == DebugDrawMode::Displacement)
|
||||
{
|
||||
float depth = GetNormalizedDepth(-MaterialSrg::m_displacementMax, -MaterialSrg::m_displacementMin, IN.m_uv[MaterialSrg::m_parallaxUvIndex], float2(0,0), float2(0,0));
|
||||
return DebugOutput(float3(depth,depth,depth));
|
||||
float startDepth = -MaterialSrg::m_displacementMax;
|
||||
float stopDepth = -MaterialSrg::m_displacementMin;
|
||||
float depth = GetNormalizedDepth(startDepth, stopDepth, IN.m_uv[MaterialSrg::m_parallaxUvIndex], float2(0,0), float2(0,0));
|
||||
float height = 1 - saturate(depth);
|
||||
return DebugOutput(float3(height,height,height));
|
||||
}
|
||||
|
||||
if(o_debugDrawMode == DebugDrawMode::FinalBlendWeights)
|
||||
{
|
||||
float3 blendWeights = GetBlendWeights(blendSource, IN.m_uv[MaterialSrg::m_blendMaskUvIndex], IN.m_blendMask);
|
||||
return DebugOutput(blendWeights);
|
||||
}
|
||||
|
||||
// ------- Parallax -------
|
||||
@@ -373,21 +384,27 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
// ------- Calculate Layer Blend Mask Values -------
|
||||
|
||||
// Now that any parallax has been calculated, we calculate the blend factors for any layers that are impacted by the parallax.
|
||||
float3 blendWeights = GetBlendWeights(IN.m_uv[MaterialSrg::m_blendMaskUvIndex]);
|
||||
float3 blendWeights = GetBlendWeights(blendSource, IN.m_uv[MaterialSrg::m_blendMaskUvIndex], IN.m_blendMask);
|
||||
|
||||
// ------- Layer 1 (base layer) -----------
|
||||
|
||||
ProcessedMaterialInputs lightingInputLayer1;
|
||||
if(blendWeights.r > 0)
|
||||
{
|
||||
StandardMaterialInputs inputs;
|
||||
FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer1_, o_layer1_, blendWeights.r)
|
||||
lightingInputLayer1 = ProcessStandardMaterialInputs(inputs);
|
||||
}
|
||||
else
|
||||
{
|
||||
lightingInputLayer1.InitializeToZero();
|
||||
blendWeights.r = 0;
|
||||
}
|
||||
|
||||
// ----------- Layer 2 -----------
|
||||
|
||||
ProcessedMaterialInputs lightingInputLayer2;
|
||||
if(o_layer2_enabled)
|
||||
if(o_layer2_enabled && blendWeights.g > 0)
|
||||
{
|
||||
StandardMaterialInputs inputs;
|
||||
FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer2_, o_layer2_, blendWeights.g)
|
||||
@@ -396,12 +413,13 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
else
|
||||
{
|
||||
lightingInputLayer2.InitializeToZero();
|
||||
blendWeights.g = 0;
|
||||
}
|
||||
|
||||
// ----------- Layer 3 -----------
|
||||
|
||||
ProcessedMaterialInputs lightingInputLayer3;
|
||||
if(o_layer3_enabled)
|
||||
if(o_layer3_enabled && blendWeights.b > 0)
|
||||
{
|
||||
StandardMaterialInputs inputs;
|
||||
FILL_STANDARD_MATERIAL_INPUTS(inputs, MaterialSrg::m_layer3_, o_layer3_, blendWeights.b)
|
||||
@@ -410,6 +428,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
else
|
||||
{
|
||||
lightingInputLayer3.InitializeToZero();
|
||||
blendWeights.b = 0;
|
||||
}
|
||||
|
||||
// ------- Combine all layers ---------
|
||||
@@ -420,12 +439,16 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
|
||||
// ------- Combine Normals ---------
|
||||
|
||||
float3 normalTS = lightingInputLayer1.m_normalTS;
|
||||
if(o_layer2_enabled)
|
||||
float3 normalTS = float3(0,0,1);
|
||||
if(blendWeights.r > 0)
|
||||
{
|
||||
normalTS = lightingInputLayer1.m_normalTS;
|
||||
}
|
||||
if(o_layer2_enabled && blendWeights.g > 0)
|
||||
{
|
||||
normalTS = ReorientTangentSpaceNormal(normalTS, lightingInputLayer2.m_normalTS);
|
||||
}
|
||||
if(o_layer3_enabled)
|
||||
if(o_layer3_enabled && blendWeights.b > 0)
|
||||
{
|
||||
normalTS = ReorientTangentSpaceNormal(normalTS, lightingInputLayer3.m_normalTS);
|
||||
}
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
--------------------------------------------------------------------------------------
|
||||
--
|
||||
-- All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
-- its licensors.
|
||||
--
|
||||
-- For complete copyright and license terms please see the LICENSE at the root of this
|
||||
-- distribution (the "License"). All use of this software is governed by the License,
|
||||
-- or, if provided, by the license below or the license accompanying this file. Do not
|
||||
-- remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
--
|
||||
--
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
-- This functor handles general parallax properties that affect the entire material.
|
||||
|
||||
function GetMaterialPropertyDependencies()
|
||||
return {
|
||||
"parallax.enable",
|
||||
"layer1_parallax.enable",
|
||||
"layer2_parallax.enable",
|
||||
"layer3_parallax.enable",
|
||||
"layer1_parallax.factor",
|
||||
"layer2_parallax.factor",
|
||||
"layer3_parallax.factor",
|
||||
"layer1_parallax.offset",
|
||||
"layer2_parallax.offset",
|
||||
"layer3_parallax.offset"
|
||||
}
|
||||
end
|
||||
|
||||
function GetShaderOptionDependencies()
|
||||
return {"o_parallax_feature_enabled"}
|
||||
end
|
||||
|
||||
function MergeRange(heightMinMax, offset, factor)
|
||||
top = offset
|
||||
bottom = offset - factor
|
||||
|
||||
if(heightMinMax[1] == nil) then
|
||||
heightMinMax[1] = top
|
||||
else
|
||||
heightMinMax[1] = math.max(heightMinMax[1], top)
|
||||
end
|
||||
|
||||
if(heightMinMax[0] == nil) then
|
||||
heightMinMax[0] = bottom
|
||||
else
|
||||
heightMinMax[0] = math.min(heightMinMax[0], bottom)
|
||||
end
|
||||
end
|
||||
|
||||
function Process(context)
|
||||
local enableParallax = context:GetMaterialPropertyValue_bool("parallax.enable")
|
||||
local enable1 = context:GetMaterialPropertyValue_bool("layer1_parallax.enable")
|
||||
local enable2 = context:GetMaterialPropertyValue_bool("layer2_parallax.enable")
|
||||
local enable3 = context:GetMaterialPropertyValue_bool("layer3_parallax.enable")
|
||||
enableParallax = enableParallax and (enable1 or enable2 or enable3)
|
||||
context:SetShaderOptionValue_bool("o_parallax_feature_enabled", enableParallax)
|
||||
|
||||
if(enableParallax) then
|
||||
local factorLayer1 = context:GetMaterialPropertyValue_float("layer1_parallax.factor")
|
||||
local factorLayer2 = context:GetMaterialPropertyValue_float("layer2_parallax.factor")
|
||||
local factorLayer3 = context:GetMaterialPropertyValue_float("layer3_parallax.factor")
|
||||
|
||||
local offsetLayer1 = context:GetMaterialPropertyValue_float("layer1_parallax.offset")
|
||||
local offsetLayer2 = context:GetMaterialPropertyValue_float("layer2_parallax.offset")
|
||||
local offsetLayer3 = context:GetMaterialPropertyValue_float("layer3_parallax.offset")
|
||||
|
||||
local heightMinMax = {nil, nil}
|
||||
if(enable1) then MergeRange(heightMinMax, offsetLayer1, factorLayer1) end
|
||||
if(enable2) then MergeRange(heightMinMax, offsetLayer2, factorLayer2) end
|
||||
if(enable3) then MergeRange(heightMinMax, offsetLayer3, factorLayer3) end
|
||||
|
||||
if(heightMinMax[1] - heightMinMax[0] < 0.0001) then
|
||||
context:SetShaderOptionValue_bool("o_parallax_feature_enabled", false)
|
||||
else
|
||||
context:SetShaderConstant_float("m_displacementMin", heightMinMax[0])
|
||||
context:SetShaderConstant_float("m_displacementMax", heightMinMax[1])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ProcessEditor(context)
|
||||
local enable = context:GetMaterialPropertyValue_bool("parallax.enable")
|
||||
|
||||
local visibility = MaterialPropertyVisibility_Enabled
|
||||
if(not enable) then
|
||||
visibility = MaterialPropertyVisibility_Hidden
|
||||
end
|
||||
|
||||
context:SetMaterialPropertyVisibility("parallax.parallaxUv", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.algorithm", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.quality", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.pdo", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.showClipping", visibility)
|
||||
end
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
--------------------------------------------------------------------------------------
|
||||
--
|
||||
-- All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
-- its licensors.
|
||||
--
|
||||
-- For complete copyright and license terms please see the LICENSE at the root of this
|
||||
-- distribution (the "License"). All use of this software is governed by the License,
|
||||
-- or, if provided, by the license below or the license accompanying this file. Do not
|
||||
-- remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
--
|
||||
--
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
-- This functor handles parallax properties that are specific to a single layer.
|
||||
|
||||
function GetMaterialPropertyDependencies()
|
||||
return {"parallax.enable", "parallax.textureMap"}
|
||||
end
|
||||
|
||||
function GetShaderOptionDependencies()
|
||||
return {"o_useDepthMap"}
|
||||
end
|
||||
|
||||
function Process(context)
|
||||
local enable = context:GetMaterialPropertyValue_bool("parallax.enable")
|
||||
local textureMap = context:GetMaterialPropertyValue_Image("parallax.textureMap")
|
||||
context:SetShaderOptionValue_bool("o_useDepthMap", enable and textureMap ~= nil)
|
||||
end
|
||||
|
||||
function ProcessEditor(context)
|
||||
local enable = context:GetMaterialPropertyValue_bool("parallax.enable")
|
||||
|
||||
if enable then
|
||||
context:SetMaterialPropertyVisibility("parallax.textureMap", MaterialPropertyVisibility_Enabled)
|
||||
else
|
||||
context:SetMaterialPropertyVisibility("parallax.textureMap", MaterialPropertyVisibility_Hidden)
|
||||
end
|
||||
|
||||
local textureMap = context:GetMaterialPropertyValue_Image("parallax.textureMap")
|
||||
local visibility = MaterialPropertyVisibility_Enabled
|
||||
if(not enable or textureMap == nil) then
|
||||
visibility = MaterialPropertyVisibility_Hidden
|
||||
end
|
||||
|
||||
context:SetMaterialPropertyVisibility("parallax.factor", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.offset", visibility)
|
||||
context:SetMaterialPropertyVisibility("parallax.invert", visibility)
|
||||
end
|
||||
+1
-1
@@ -83,7 +83,7 @@ VertexOutput MainVS(VertexInput IN)
|
||||
}
|
||||
else
|
||||
{
|
||||
OUT.m_blendMask = float3(1,1,1);
|
||||
OUT.m_blendMask = float3(0,0,0);
|
||||
}
|
||||
|
||||
return OUT;
|
||||
|
||||
@@ -33,11 +33,11 @@ set(FILES
|
||||
Materials/Types/StandardMultilayerPBR_Common.azsli
|
||||
Materials/Types/StandardMultilayerPBR_DepthPass_WithPS.azsl
|
||||
Materials/Types/StandardMultilayerPBR_DepthPass_WithPS.shader
|
||||
Materials/Types/StandardMultilayerPBR_Displacement.lua
|
||||
Materials/Types/StandardMultilayerPBR_ForwardPass.azsl
|
||||
Materials/Types/StandardMultilayerPBR_ForwardPass.shader
|
||||
Materials/Types/StandardMultilayerPBR_ForwardPass_EDS.shader
|
||||
Materials/Types/StandardMultilayerPBR_Parallax.lua
|
||||
Materials/Types/StandardMultilayerPBR_ParallaxPerLayer.lua
|
||||
Materials/Types/StandardMultilayerPBR_LayerEnable.lua
|
||||
Materials/Types/StandardMultilayerPBR_ShaderEnable.lua
|
||||
Materials/Types/StandardMultilayerPBR_Shadowmap_WithPS.azsl
|
||||
Materials/Types/StandardMultilayerPBR_Shadowmap_WithPS.shader
|
||||
|
||||
@@ -225,3 +225,16 @@ float NextRandomFloatUniform(inout uint seed)
|
||||
seed = Xorshift(seed);
|
||||
return (float)seed / 4294967295.0f;
|
||||
}
|
||||
|
||||
//! Returns the inverse of lerp, 't', such that value = lerp(a, b, t), or returns 0 when a == b.
|
||||
float LerpInverse(float a, float b, float value)
|
||||
{
|
||||
if(abs(a - b) <= EPSILON)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (value - a) / (b - a);
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,12 @@ float3 GetTangentSpaceNormal_Unnormalized(float2 normalMapSample, float normalSt
|
||||
// The image build pipeline drops the B channel so we have to reconstruct it here.
|
||||
surfaceNormal.z = sqrt(1 - dot(surfaceNormal.xy, surfaceNormal.xy));
|
||||
|
||||
// Don't allow z to be zero just in case normalStrength approaches 0, to avoid a 0-length normal.
|
||||
// It doesn't make sense anyway to have a surface with a normal map completely tangential.
|
||||
// This also addresses the possibility of z being NaN, in the case where x^2+y^2 > 1, so we don't need to call saturate in the sqrt operation above.
|
||||
// (Note this edge case would be particularly evident in multilayer material types, where the normal map is masked out using normalStrength).
|
||||
surfaceNormal.z = max(surfaceNormal.z, 0.01);
|
||||
|
||||
surfaceNormal.xy *= normalStrength;
|
||||
|
||||
return surfaceNormal;
|
||||
|
||||
-3
@@ -36,7 +36,6 @@
|
||||
"diffuseTextureMap": "TestData/Textures/cc0/bark1_disp.jpg"
|
||||
},
|
||||
"layer1_parallax": {
|
||||
"enable": true,
|
||||
"factor": 0.02500000037252903,
|
||||
"textureMap": "TestData/Textures/cc0/bark1_disp.jpg"
|
||||
},
|
||||
@@ -80,7 +79,6 @@
|
||||
"specularTextureMap": "TestData/Textures/cc0/Tiles009_1K_Displacement.jpg"
|
||||
},
|
||||
"layer2_parallax": {
|
||||
"enable": true,
|
||||
"factor": 0.01600000075995922,
|
||||
"textureMap": "TestData/Textures/cc0/Lava004_1K_Displacement.jpg"
|
||||
},
|
||||
@@ -118,7 +116,6 @@
|
||||
"diffuseTextureMap": "TestData/Textures/cc0/PaintedMetal003_1K_Displacement.jpg"
|
||||
},
|
||||
"layer3_parallax": {
|
||||
"enable": true,
|
||||
"factor": 0.004999999888241291,
|
||||
"textureMap": "TestData/Textures/cc0/PaintedMetal003_1K_Displacement.jpg"
|
||||
},
|
||||
|
||||
-2
@@ -15,7 +15,6 @@
|
||||
"textureMap": "TestData/Textures/cc0/bark1_norm.jpg"
|
||||
},
|
||||
"layer1_parallax": {
|
||||
"enable": true,
|
||||
"factor": 0.03999999910593033,
|
||||
"textureMap": "TestData/Textures/cc0/bark1_disp.jpg"
|
||||
},
|
||||
@@ -32,7 +31,6 @@
|
||||
"textureMap": "TestData/Textures/cc0/Rock030_2K_Normal.jpg"
|
||||
},
|
||||
"layer2_parallax": {
|
||||
"enable": true,
|
||||
"factor": 0.05299999937415123,
|
||||
"offset": -0.024000000208616258,
|
||||
"textureMap": "TestData/Textures/cc0/Rock030_2K_Displacement.jpg"
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
"parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"general": {
|
||||
"debugDrawMode": "DepthMaps"
|
||||
"blend": {
|
||||
"debugDrawMode": "BlendMask"
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"description": "",
|
||||
"materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
|
||||
"parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"blend": {
|
||||
"debugDrawMode": "FinalBlendWeights"
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
"parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"general": {
|
||||
"debugDrawMode": "BlendSource"
|
||||
"blend": {
|
||||
"debugDrawMode": "Displacement"
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"blend": {
|
||||
"blendSource": "VertexColors"
|
||||
"blendSource": "BlendMaskVertexColors"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"description": "",
|
||||
"materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
|
||||
"parentMaterial": "",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"blend": {
|
||||
"blendSource": "Displacement",
|
||||
"displacementBlendDistance": 0.008999999612569809,
|
||||
"enableLayer2": true,
|
||||
"enableLayer3": true
|
||||
},
|
||||
"layer1_baseColor": {
|
||||
"textureMap": "TestData/Textures/cc0/Ground033_1K_Color.jpg"
|
||||
},
|
||||
"layer1_normal": {
|
||||
"textureMap": "TestData/Textures/cc0/Ground033_1K_Normal.jpg"
|
||||
},
|
||||
"layer1_occlusion": {
|
||||
"diffuseTextureMap": "TestData/Textures/cc0/Ground033_1K_AmbientOcclusion.jpg"
|
||||
},
|
||||
"layer1_parallax": {
|
||||
"factor": 0.017000000923871995,
|
||||
"offset": -0.006000000052154064,
|
||||
"textureMap": "TestData/Textures/cc0/Ground033_1K_Displacement.jpg"
|
||||
},
|
||||
"layer1_roughness": {
|
||||
"textureMap": "TestData/Textures/cc0/Ground033_1K_Roughness.jpg"
|
||||
},
|
||||
"layer2_baseColor": {
|
||||
"textureMap": "TestData/Textures/cc0/Rock030_2K_Color.jpg"
|
||||
},
|
||||
"layer2_normal": {
|
||||
"textureMap": "TestData/Textures/cc0/Rock030_2K_Normal.jpg"
|
||||
},
|
||||
"layer2_occlusion": {
|
||||
"diffuseTextureMap": "TestData/Textures/cc0/Rocks002_1K_AmbientOcclusion.jpg"
|
||||
},
|
||||
"layer2_parallax": {
|
||||
"factor": 0.03099999949336052,
|
||||
"offset": 0.0020000000949949028,
|
||||
"textureMap": "TestData/Textures/cc0/Rock030_2K_Displacement.jpg"
|
||||
},
|
||||
"layer2_roughness": {
|
||||
"textureMap": "TestData/Textures/cc0/Rock030_2K_Roughness.jpg"
|
||||
},
|
||||
"layer2_uv": {
|
||||
"center": [
|
||||
0.5,
|
||||
0.5
|
||||
],
|
||||
"offsetU": 0.1599999964237213,
|
||||
"offsetV": 0.07999999821186066,
|
||||
"rotateDegrees": 90.0
|
||||
},
|
||||
"layer3_baseColor": {
|
||||
"textureMap": "TestData/Textures/cc0/Rocks002_1K_Color.jpg"
|
||||
},
|
||||
"layer3_normal": {
|
||||
"textureMap": "TestData/Textures/cc0/Rocks002_1K_Normal.jpg"
|
||||
},
|
||||
"layer3_parallax": {
|
||||
"factor": 0.027000000700354577,
|
||||
"textureMap": "TestData/Textures/cc0/Rocks002_1K_Displacement.jpg"
|
||||
},
|
||||
"layer3_roughness": {
|
||||
"textureMap": "TestData/Textures/cc0/Rocks002_1K_Roughness.jpg"
|
||||
},
|
||||
"layer3_uv": {
|
||||
"scale": 3.4999988079071047
|
||||
},
|
||||
"parallax": {
|
||||
"algorithm": "Relief",
|
||||
"enable": true,
|
||||
"pdo": true,
|
||||
"quality": "Low"
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"description": "",
|
||||
"materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
|
||||
"parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/005_UseDisplacement.material",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"blend": {
|
||||
"enableLayer2": false
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"description": "",
|
||||
"materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
|
||||
"parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/005_UseDisplacement.material",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"blend": {
|
||||
"enableLayer3": false
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"description": "",
|
||||
"materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
|
||||
"parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/005_UseDisplacement.material",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"blend": {
|
||||
"blendSource": "Displacement_With_BlendMaskTexture"
|
||||
},
|
||||
"layer1_parallax": {
|
||||
"offset": -0.004000000189989805
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"description": "",
|
||||
"materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
|
||||
"parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/005_UseDisplacement_With_BlendMaskTexture.material",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"blend": {
|
||||
"displacementBlendDistance": 0.0010000000474974514
|
||||
},
|
||||
"layer1_parallax": {
|
||||
"offset": -0.00800000037997961,
|
||||
"textureMap": ""
|
||||
},
|
||||
"layer2_parallax": {
|
||||
"offset": -0.00800000037997961,
|
||||
"textureMap": ""
|
||||
},
|
||||
"layer3_parallax": {
|
||||
"offset": -0.00800000037997961,
|
||||
"textureMap": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"description": "",
|
||||
"materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
|
||||
"parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/005_UseDisplacement_With_BlendMaskTexture.material",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"layer1_parallax": {
|
||||
"offset": -0.03200000151991844,
|
||||
"textureMap": ""
|
||||
},
|
||||
"layer2_parallax": {
|
||||
"offset": -0.00800000037997961,
|
||||
"textureMap": ""
|
||||
},
|
||||
"layer3_parallax": {
|
||||
"offset": -0.00800000037997961,
|
||||
"textureMap": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"description": "",
|
||||
"materialType": "Materials/Types/StandardMultilayerPBR.materialtype",
|
||||
"parentMaterial": "TestData/Materials/StandardMultilayerPbrTestCases/005_UseDisplacement.material",
|
||||
"propertyLayoutVersion": 3,
|
||||
"properties": {
|
||||
"blend": {
|
||||
"blendSource": "Displacement_With_BlendMaskVertexColors",
|
||||
"displacementBlendDistance": 0.02387000061571598
|
||||
},
|
||||
"parallax": {
|
||||
"enable": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f9ec269d03a9552c0ecf24778912fa6190c412b006433db8b7c40e1c0c83e6f7
|
||||
size 516915
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b53c4aca020d5833618a5b73b6578c8693dd14e603eb32681e2c7ecc90f59047
|
||||
size 1020622
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:46ea8a9406ce6df21ce3a6045aac5b1421ce119919ff050951277dd76464ee2c
|
||||
size 258716
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ac1ad9bea240374bfc6aaaacc42e24eadfbf93c7185617fc1c52e610cb45cb69
|
||||
size 1292910
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8fce266a7445a4d4b5bb3fbf7cb3330e0580b058aeaf2ef7f265a01641dbbdc4
|
||||
size 637326
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ca54f762bcddc10ab2d609f10864328cb5a567c43efb8c9bcfe9cb2955db9577
|
||||
size 433887
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5b5f5ff297aef6470045d087cf0c3341f7782e36a750965a052d49d03dd37426
|
||||
size 1595449
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c8753448320e0916a70036ef77a06bce746bfa45c14e62b2fbda0987a13bfbb3
|
||||
size 277114
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5ea23ea8d85d1fffa119e481e6ac85ad3a3096470a5e12f252d37e1b293e5e37
|
||||
size 2119669
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:caa6e94f904135461da4d200fc6c21c86dc99cc7d413ea740e678f7758b2b156
|
||||
size 555680
|
||||
Reference in New Issue
Block a user