Deleted unused "default" materials from RPI. Long ago these were used as defaults for FBX material conversion process, but that's no longer the case. And I'm about to add a new approach for default material conversion in SceneAPI.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>monroegm-disable-blank-issue-2
parent
edfac0f7f0
commit
0cf6ecf3f7
@ -1,90 +0,0 @@
|
||||
{
|
||||
"description": "A simple default base material used primarily for imported model files like FBX.",
|
||||
"propertyLayout": {
|
||||
"version": 1,
|
||||
"properties": {
|
||||
"general": [
|
||||
{
|
||||
"id": "DiffuseColor",
|
||||
"type": "color",
|
||||
"defaultValue": [ 1.0, 1.0, 1.0 ],
|
||||
"connection": {
|
||||
"type": "shaderInput",
|
||||
"id": "m_diffuseColor"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "DiffuseMap",
|
||||
"type": "image",
|
||||
"defaultValue": "",
|
||||
"connection": {
|
||||
"type": "shaderInput",
|
||||
"id": "m_diffuseMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "UseDiffuseMap",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"connection": {
|
||||
"type": "shaderOption",
|
||||
"id": "o_useDiffuseMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "SpecularColor",
|
||||
"type": "color",
|
||||
"defaultValue": [ 0.0, 0.0, 0.0 ],
|
||||
"connection": {
|
||||
"type": "shaderInput",
|
||||
"id": "m_specularColor"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "SpecularMap",
|
||||
"type": "image",
|
||||
"defaultValue": "",
|
||||
"connection": {
|
||||
"type": "shaderInput",
|
||||
"id": "m_specularMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "UseSpecularMap",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"connection": {
|
||||
"type": "shaderOption",
|
||||
"id": "o_useSpecularMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "NormalMap",
|
||||
"type": "image",
|
||||
"defaultValue": "",
|
||||
"connection": {
|
||||
"type": "shaderInput",
|
||||
"id": "m_normalMap"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "UseNormalMap",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"connection": {
|
||||
"type": "shaderOption",
|
||||
"id": "o_useNormalMap"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"shaders": [
|
||||
{
|
||||
"file": "DefaultMaterial.shader"
|
||||
},
|
||||
{
|
||||
"file": "DefaultMaterial_DepthPass.shader"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,127 +0,0 @@
|
||||
|
||||
/*
|
||||
* 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 <scenesrg.srgi>
|
||||
#include <viewsrg.srgi>
|
||||
|
||||
#include <Atom/RPI/ShaderResourceGroups/DefaultDrawSrg.azsli>
|
||||
#include <Atom/RPI/ShaderResourceGroups/DefaultObjectSrg.azsli>
|
||||
#include <Atom/RPI/TangentSpace.azsli>
|
||||
|
||||
ShaderResourceGroup MaterialSrg : SRG_PerMaterial
|
||||
{
|
||||
float4 m_diffuseColor;
|
||||
float3 m_specularColor;
|
||||
|
||||
Texture2D m_diffuseMap;
|
||||
Texture2D m_normalMap;
|
||||
Texture2D m_specularMap;
|
||||
|
||||
Sampler m_sampler
|
||||
{
|
||||
MaxAnisotropy = 16;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
AddressW = Wrap;
|
||||
};
|
||||
}
|
||||
|
||||
option bool o_useDiffuseMap = false;
|
||||
option bool o_useSpecularMap = false;
|
||||
option bool o_useNormalMap = false;
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float3 m_position : POSITION;
|
||||
float3 m_normal : NORMAL;
|
||||
float4 m_tangent : TANGENT;
|
||||
float3 m_bitangent : BITANGENT;
|
||||
float2 m_uv : UV0;
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 m_position : SV_Position;
|
||||
float3 m_normal : NORMAL;
|
||||
float3 m_tangent : TANGENT;
|
||||
float3 m_bitangent : BITANGENT;
|
||||
float2 m_uv : UV0;
|
||||
float3 m_positionToCamera : VIEW;
|
||||
};
|
||||
|
||||
VertexOutput MainVS(VertexInput input)
|
||||
{
|
||||
const float4x4 objectToWorldMatrix = ObjectSrg::GetWorldMatrix();
|
||||
|
||||
VertexOutput output;
|
||||
float3 worldPosition = mul(objectToWorldMatrix, float4(input.m_position,1)).xyz;
|
||||
output.m_position = mul(ViewSrg::m_viewProjectionMatrix, float4(worldPosition, 1.0));
|
||||
|
||||
output.m_uv = input.m_uv;
|
||||
|
||||
output.m_positionToCamera = ViewSrg::m_worldPosition - worldPosition;
|
||||
|
||||
float3x3 objectToWorldMatrixIT = ObjectSrg::GetWorldMatrixInverseTranspose();
|
||||
|
||||
ConstructTBN(input.m_normal, input.m_tangent, input.m_bitangent, objectToWorldMatrix, objectToWorldMatrixIT, output.m_normal, output.m_tangent, output.m_bitangent);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
struct PixelOutput
|
||||
{
|
||||
float4 m_color : SV_Target0;
|
||||
};
|
||||
|
||||
PixelOutput MainPS(VertexOutput input)
|
||||
{
|
||||
PixelOutput output;
|
||||
|
||||
// Very rough placeholder lighting
|
||||
static const float3 lightDir = normalize(float3(1,1,1));
|
||||
|
||||
float4 baseColor = MaterialSrg::m_diffuseColor;
|
||||
if (o_useDiffuseMap)
|
||||
{
|
||||
baseColor *= MaterialSrg::m_diffuseMap.Sample(MaterialSrg::m_sampler, input.m_uv);
|
||||
}
|
||||
|
||||
float3 specular = MaterialSrg::m_specularColor;
|
||||
if (o_useSpecularMap)
|
||||
{
|
||||
specular *= MaterialSrg::m_specularMap.Sample(MaterialSrg::m_sampler, input.m_uv).rgb;
|
||||
}
|
||||
|
||||
float3 normal;
|
||||
if (o_useNormalMap)
|
||||
{
|
||||
float4 sampledValue = MaterialSrg::m_normalMap.Sample(MaterialSrg::m_sampler, input.m_uv);
|
||||
normal = GetWorldSpaceNormal(sampledValue.xy, input.m_normal, input.m_tangent, input.m_bitangent);
|
||||
}
|
||||
else
|
||||
{
|
||||
normal = normalize(input.m_normal);
|
||||
}
|
||||
|
||||
float3 viewDir = normalize(input.m_positionToCamera);
|
||||
float3 H = normalize(lightDir + viewDir);
|
||||
float NdotH = max(0.001, dot(normal, H));
|
||||
float NdotL = saturate(dot(normal, lightDir));
|
||||
|
||||
float3 diffuse = NdotL * baseColor.xyz;
|
||||
|
||||
specular = pow(NdotH, 5.0) * specular;
|
||||
|
||||
// Combined
|
||||
float3 result = diffuse + specular + float3(0.1, 0.1, 0.1) * baseColor.xyz;
|
||||
|
||||
output.m_color = float4(result.xyz, baseColor.a);
|
||||
|
||||
return output;
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
{
|
||||
"Source" : "DefaultMaterial.azsl",
|
||||
|
||||
"DepthStencilState" : {
|
||||
"Depth" : { "Enable" : true, "CompareFunc" : "Equal" }
|
||||
},
|
||||
|
||||
"DrawList" : "forward",
|
||||
|
||||
"ProgramSettings":
|
||||
{
|
||||
"EntryPoints":
|
||||
[
|
||||
{
|
||||
"name": "MainVS",
|
||||
"type": "Vertex"
|
||||
},
|
||||
{
|
||||
"name": "MainPS",
|
||||
"type": "Fragment"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
|
||||
/*
|
||||
* 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 <scenesrg.srgi>
|
||||
#include <viewsrg.srgi>
|
||||
|
||||
#include <Atom/RPI/ShaderResourceGroups/DefaultObjectSrg.azsli>
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float3 m_position : POSITION;
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 m_position : SV_Position;
|
||||
};
|
||||
|
||||
VertexOutput MainVS(VertexInput input)
|
||||
{
|
||||
const float4x4 objectToWorldMatrix = ObjectSrg::GetWorldMatrix();
|
||||
|
||||
VertexOutput output;
|
||||
float3 worldPosition = mul(objectToWorldMatrix, float4(input.m_position,1)).xyz;
|
||||
output.m_position = mul(ViewSrg::m_viewProjectionMatrix, float4(worldPosition, 1.0));
|
||||
return output;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
{
|
||||
"Source" : "DefaultMaterial_DepthPass.azsl",
|
||||
|
||||
"DepthStencilState" : {
|
||||
"Depth" : { "Enable" : true, "CompareFunc" : "GreaterEqual" }
|
||||
},
|
||||
|
||||
"DrawList" : "depth",
|
||||
|
||||
"ProgramSettings":
|
||||
{
|
||||
"EntryPoints":
|
||||
[
|
||||
{
|
||||
"name": "MainVS",
|
||||
"type": "Vertex"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue