Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"name": "general",
"displayName": "General Settings",
"description": "General settings.",
"properties": [
{
"name": "doubleSided",
"displayName": "Double-sided",
"description": "Whether to render back-faces or just front-faces.",
"type": "Bool",
"connection": {
"type": "InternalProperty",
"name": "doubleSided"
}
},
{
"name": "applySpecularAA",
"displayName": "Apply Specular AA",
"description": "Whether to apply specular anti-aliasing in the shader.",
"type": "Bool",
"defaultValue": true,
"connection": {
"type": "ShaderOption",
"name": "o_applySpecularAA"
}
},
{
"name": "enableShadows",
"displayName": "Receive Shadows",
"description": "Whether to use the shadow maps during lighting.",
"type": "Bool",
"defaultValue": false,
"connection": {
"type": "ShaderOption",
"name": "o_enableShadows"
}
},
{
// This will have to be connected manually by the .materialtype, because some material types
// have an additional "Shadowmap_WithPS" shader in addition to "Shadowmap".
"name": "castShadows",
"displayName": "Cast Shadows",
"description": "Whether to cast shadows onto other objects.",
"type": "Bool",
"defaultValue": false,
"connection": {
"type": "InternalProperty",
"name": "castShadows"
}
},
{
"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"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"name": "opacity",
"displayName": "Opacity",
"description": "Properties for configuring the materials transparency.",
"properties": [
{
"name": "mode",
"displayName": "Opacity Mode",
"description": "Indicates the general approach how transparency is to be applied.",
"type": "Enum",
"enumValues": [ "Opaque", "Cutout", "Blended", "TintedTransparent" ],
"defaultValue": "Cutout",
"connection": {
"type": "ShaderOption",
"name": "o_opacity_mode"
}
},
{
"name": "alphaSource",
"displayName": "Alpha Source",
"description": "Indicates whether to get the opacity texture from the Base Color map (Packed) or from a separate greyscale texture (Split).",
"type": "Enum",
"enumValues": [ "Packed", "Split", "None" ],
"defaultValue": "Packed",
"connection": {
"type": "ShaderOption",
"name": "o_opacity_source"
}
},
{
"name": "textureMap",
"displayName": "Texture",
"description": "Texture for defining surface opacity.",
"type": "Image",
"connection": {
"type": "ShaderInput",
"name": "m_opacityMap"
}
},
{
"name": "textureMapUv",
"displayName": "UV",
"description": "Opacity map UV set",
"type": "Enum",
"enumIsUv": true,
"defaultValue": "Tiled",
"connection": {
"type": "ShaderInput",
"name": "m_opacityMapUvIndex"
}
},
{
"name": "factor",
"displayName": "Factor",
"description": "Factor for cutout threshold and blending",
"type": "Float",
"min": 0.0,
"max": 1.0,
"defaultValue": 0.5,
"connection": {
"type": "ShaderInput",
"name": "m_opacityFactor"
}
},
{
"name": "alphaAffectsSpecular",
"displayName": "Alpha affects specular",
"description": "How much the alpha value should also affect specular reflection. This should be 0.0 for materials where light can transmit through their physical surface (like glass), but 1.0 when alpha determines the very presence of a surface (like hair or grass)",
"type": "float",
"min": 0.0,
"max": 1.0,
"defaultValue": 0.0,
"connection": {
"type": "ShaderInput",
"name": "m_opacityAffectsSpecularFactor"
}
}
],
"functors": [
{
"type": "Lua",
"args": {
"file": "Materials/Types/StandardPBR_HandleOpacityMode.lua"
}
}
]
}
113 changes: 113 additions & 0 deletions Gems/Billboards/Assets/BillboardStandardPBR/BillboardStandardPBR.azsli
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* 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_VERTEX_COLOR 1

//TODO(MaterialPipeline): Inline the MaterialSrg files since they aren't reused.
//TODO(MaterialPipeline): Try removing different parts of the SRG and see how hard/easy it is to customize the surface function.
#include <Atom/Feature/Common/Assets/Shaders/Materials/StandardPBR/StandardPBR_MaterialSrg.azsli>

#include <Atom/Features/PBR/DefaultObjectSrg.azsli>
#include <Atom/RPI/ShaderResourceGroups/DefaultDrawSrg.azsli>

#if MATERIALPIPELINE_SHADER_HAS_PIXEL_STAGE

COMMON_OPTIONS_BASE_COLOR()
COMMON_OPTIONS_VERTEX_COLOR()
COMMON_OPTIONS_ROUGHNESS()
COMMON_OPTIONS_METALLIC()
COMMON_OPTIONS_SPECULAR_F0()
COMMON_OPTIONS_NORMAL()
COMMON_OPTIONS_CLEAR_COAT()
COMMON_OPTIONS_OCCLUSION()
COMMON_OPTIONS_EMISSIVE()
COMMON_OPTIONS_PARALLAX()

bool ShouldHandleParallax()
{
// Parallax mapping's non uniform uv transformations break screen space subsurface scattering, disable it when subsurface scattering is enabled.
return !o_enableSubsurfaceScattering && o_parallax_feature_enabled && o_useHeightmap;
}

bool NeedsTangentFrame()
{
return ShouldHandleParallax() || o_normal_useTexture || (o_clearCoat_enabled && o_clearCoat_normal_useTexture);
}

// Callback function for ParallaxMapping.azsli
DepthResult GetDepth(float2 uv, float2 uv_ddx, float2 uv_ddy)
{
return SampleDepthFromHeightmap(MaterialSrg::m_heightmap, MaterialSrg::m_sampler, uv, uv_ddx, uv_ddy);
}


#include <Atom/Feature/Common/Assets/Shaders/Materials/BasePBR/BasePBR_VertexData.azsli>

// custom geom shaders
#include "BillboardStandardPBR_VertexEval.azsli"
//#include <Atom/Feature/Common/Assets/Shaders/Materials/BasePBR/BasePBR_VertexEval.azsli>

#include <Atom/Feature/Common/Assets/Shaders/Materials/StandardPBR/StandardPBR_PixelGeometryData.azsli>
#include <Atom/Feature/Common/Assets/Shaders/Materials/StandardPBR/StandardPBR_PixelGeometryEval.azsli>

#include <Atom/Feature/Common/Assets/Shaders/Materials/StandardPBR/StandardPBR_SurfaceData.azsli>
#include <Atom/Feature/Common/Assets/Shaders/Materials/StandardPBR/StandardPBR_SurfaceEval.azsli>

#elif MATERIALPIPELINE_SHADER_HAS_GEOMETRIC_PIXEL_STAGE

COMMON_OPTIONS_PARALLAX()

bool ShouldHandleParallax()
{
// TODO(MaterialPipeline): This is the same as the other ShouldHandleParallax() above, needs to be factored out
bool canHandleParallax = !o_enableSubsurfaceScattering && o_parallax_feature_enabled && o_useHeightmap;

// The depth pass shaders need to calculate parallax when the result could affect the depth buffer, or when
// parallax could affect texel clipping.
return canHandleParallax && (o_parallax_enablePixelDepthOffset || o_opacity_mode == OpacityMode::Cutout);
}

bool NeedsTangentFrame()
{
return ShouldHandleParallax();
}

// Callback function for ParallaxMapping.azsli
DepthResult GetDepth(float2 uv, float2 uv_ddx, float2 uv_ddy)
{
return SampleDepthFromHeightmap(MaterialSrg::m_heightmap, MaterialSrg::m_sampler, uv, uv_ddx, uv_ddy);
}

#include <Atom/Feature/Common/Assets/Shaders/Materials/BasePBR/BasePBR_VertexData.azsli>

// custom geom shaders
#include "BillboardStandardPBR_VertexEval.azsli"
//#include <Atom/Feature/Common/Assets/Shaders/Materials/BasePBR/BasePBR_VertexEval.azsli>

#include <Atom/Feature/Common/Assets/Shaders/Materials/StandardPBR/StandardPBR_PixelGeometryData.azsli>
#include <Atom/Feature/Common/Assets/Shaders/Materials/StandardPBR/StandardPBR_PixelGeometryEval.azsli>

#include "Atom/Feature/Common/Assets/Shaders/Materials/MaterialFunctions/StandardGetAlphaAndClip.azsli"

void EvaluateSurface(VsOutput IN, PixelGeometryData geoData)
{
GetAlphaAndClip(geoData.uvs);
}

#else

//TODO(MaterialPipeline): I think we should rename these to "PositionOnly_*"


#include <Atom/Feature/Common/Assets/Shaders/Materials/DepthPass_VertexData.azsli>
#include "BillboardStandardPBR_DepthVertexEval.azsli"
//#include <Atom/Feature/Common/Assets/Shaders/Materials/DepthPass_VertexEval.azsli>

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"description": "Material Type with properties used to define Standard PBR, a metallic-roughness Physically-Based Rendering (PBR) material shading model.",
"version": 5,
"versionUpdates": [
{
"toVersion": 4,
"actions": [
{"op": "rename", "from": "opacity.doubleSided", "to": "general.doubleSided"}
]
},
{
"toVersion": 5,
"actions": [
{"op": "rename", "from": "irradiance.color", "to": "irradiance.manualColor"},
{"op": "setValue", "name": "irradiance.irradianceColorSource", "value": "Manual"}
]
}
],
"propertyLayout": {
"propertyGroups": [
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/BaseColorPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/VertexColorPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/MetallicPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/RoughnessPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/SpecularPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/NormalPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/OcclusionPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/EmissivePropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/ClearCoatPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/ParallaxPropertyGroup.json"
},
{
"$import": "BillboardOpacityPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/UvPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/IrradiancePropertyGroup.json"
},
{
"$import": "BillboardCommonPropertyGroup.json"
},
{
"$import": "@gemroot:Atom_Feature_Common@/Assets/Materials/Types/MaterialInputs/SilhouetteBlockerPropertyGroup.json"
}
]
},
"lightingModel": "Standard",
"materialShaderCode": "BillboardStandardPBR.azsli",
"functors": [
],
"uvNameMap": {
"UV0": "Tiled",
"UV1": "Unwrapped"
}
}

Loading