BasePbr working

Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
This commit is contained in:
antonmic
2021-12-15 22:30:37 -08:00
parent fbd7b67e11
commit a436ea7f9b
7 changed files with 13 additions and 71 deletions
@@ -1,8 +1,8 @@
{
"description": "",
"materialType": "Materials\\Types\\Temp\\BasePBR.materialtype",
"materialType": "Materials\\Types\\BasePBR.materialtype",
"parentMaterial": "",
"propertyLayoutVersion": 3,
"propertyLayoutVersion": 0,
"properties": {
"baseColor": {
"color": [
@@ -1,8 +1,8 @@
{
"description": "",
"materialType": "Materials\\Types\\Temp\\BasePBR.materialtype",
"materialType": "Materials\\Types\\BasePBR.materialtype",
"parentMaterial": "",
"propertyLayoutVersion": 3,
"propertyLayoutVersion": 0,
"properties": {
"baseColor": {
"color": [
@@ -1,8 +1,8 @@
{
"description": "",
"materialType": "Materials/Types/Temp/BasePBR.materialtype",
"materialType": "Materials/Types/BasePBR.materialtype",
"parentMaterial": "",
"propertyLayoutVersion": 3,
"propertyLayoutVersion": 0,
"properties": {
"baseColor": {
"color": [
@@ -596,24 +596,6 @@
"args": {
"file": "StandardPBR_Metallic.lua"
}
},
{
"type": "Lua",
"args": {
"file": "StandardPBR_HandleOpacityDoubleSided.lua"
}
},
{
"type": "Lua",
"args": {
"file": "StandardPBR_HandleOpacityMode.lua"
}
},
{
"type": "Lua",
"args": {
"file": "BasePBR_ShaderEnable.lua"
}
}
],
"uvNameMap": {
@@ -69,7 +69,7 @@ struct VSOutput
VSOutput BasePbr_ForwardPassVS(VSInput IN)
{
VSOutput OUT = (VSOutput)0;
VSOutput OUT;
float3 worldPosition = mul(ObjectSrg::GetWorldMatrix(), float4(IN.m_position, 1.0)).xyz;
@@ -101,7 +101,8 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace)
PrepareGeneratedTangent(IN.m_normal, IN.m_worldPosition, isFrontFace, IN.m_uv, UvSetCount, tangents, bitangents);
}
Surface surface = (Surface)0;
Surface surface;
surface.clearCoat.InitializeToZero();
surface.position = IN.m_worldPosition.xyz;
// ------- Normal -------
@@ -139,7 +140,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace)
// ------- Lighting Data -------
LightingData lightingData = (LightingData)0;
LightingData lightingData;
// Light iterator
lightingData.tileIterator.Init(IN.m_position, PassSrg::m_lightListRemapped, PassSrg::m_tileLightData);
@@ -173,7 +174,8 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace)
float alpha = 1.0f;
PbrLightingOutput lightingOutput = GetPbrLightingOutput(surface, lightingData, alpha);
lightingOutput.m_diffuseColor.w = -1; // Disable subsurface scattering
// Disable subsurface scattering
lightingOutput.m_diffuseColor.w = -1;
return lightingOutput;
}
@@ -183,8 +185,7 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace)
ForwardPassOutput BasePbr_ForwardPassPS_EDS(VSOutput IN, bool isFrontFace : SV_IsFrontFace)
{
ForwardPassOutput OUT;
PbrLightingOutput lightingOutput = (PbrLightingOutput)0;
lightingOutput = ForwardPassPS_Common(IN, isFrontFace);
PbrLightingOutput lightingOutput = ForwardPassPS_Common(IN, isFrontFace);
#ifdef UNIFIED_FORWARD_OUTPUT
OUT.m_color.rgb = lightingOutput.m_diffuseColor.rgb + lightingOutput.m_specularColor.rgb;
@@ -1,40 +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
--
--
--
----------------------------------------------------------------------------------------------------
function TryGetShaderByTag(context, shaderTag)
if context:HasShaderWithTag(shaderTag) then
return context:GetShaderByTag(shaderTag)
else
return nil
end
end
function TrySetShaderEnabled(shader, enabled)
if shader then
shader:SetEnabled(enabled)
end
end
function Process(context)
local depthPass = context:GetShaderByTag("DepthPass")
local shadowMap = context:GetShaderByTag("Shadowmap")
local forwardPassEDS = context:GetShaderByTag("ForwardPass_EDS")
-- Use TryGetShaderByTag because these shaders only exist in BasePBR but this script is also used for EnhancedPBR
local lowEndForwardEDS = TryGetShaderByTag(context, "LowEndForward_EDS")
depthPass:SetEnabled(true);
shadowMap:SetEnabled(true);
forwardPassEDS:SetEnabled(true);
TrySetShaderEnabled(lowEndForwardEDS, true)
end
@@ -30,7 +30,6 @@
}
},
"CompilerHints" : {
"DisableOptimizations" : false
},