Fix Blend Mode on Terrain materials to be unenviable due to not implemented
#4056
This commit is contained in:
@@ -57,7 +57,7 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
[EditorOrder(20), VisibleIf(nameof(IsStandard)), EditorDisplay("General"), Tooltip("Defines how material inputs and properties are combined to result the final surface color.")]
|
[EditorOrder(20), VisibleIf(nameof(IsStandard)), EditorDisplay("General"), Tooltip("Defines how material inputs and properties are combined to result the final surface color.")]
|
||||||
public MaterialShadingModel ShadingModel;
|
public MaterialShadingModel ShadingModel;
|
||||||
|
|
||||||
[EditorOrder(30), VisibleIf(nameof(IsStandard)), EditorDisplay("General"), Tooltip("Determinates how materials' color should be blended with the background colors.")]
|
[EditorOrder(30), VisibleIf(nameof(ShowBlendMode)), EditorDisplay("General"), Tooltip("Determinates how materials' color should be blended with the background colors.")]
|
||||||
public MaterialBlendMode BlendMode;
|
public MaterialBlendMode BlendMode;
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
@@ -145,6 +145,7 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
|
|
||||||
// Visibility conditionals
|
// Visibility conditionals
|
||||||
|
|
||||||
|
private bool ShowBlendMode => Domain != MaterialDomain.Terrain;
|
||||||
private bool IsPostProcess => Domain == MaterialDomain.PostProcess;
|
private bool IsPostProcess => Domain == MaterialDomain.PostProcess;
|
||||||
private bool IsDecal => Domain == MaterialDomain.Decal;
|
private bool IsDecal => Domain == MaterialDomain.Decal;
|
||||||
private bool IsGUI => Domain == MaterialDomain.GUI;
|
private bool IsGUI => Domain == MaterialDomain.GUI;
|
||||||
@@ -187,6 +188,14 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
|
|
||||||
// Link
|
// Link
|
||||||
Window = window;
|
Window = window;
|
||||||
|
|
||||||
|
// [Deprecated in 1.12]
|
||||||
|
// Fix old terrain materials to go back into opaque
|
||||||
|
if (Domain == MaterialDomain.Terrain && BlendMode != MaterialBlendMode.Opaque)
|
||||||
|
{
|
||||||
|
BlendMode = MaterialBlendMode.Opaque;
|
||||||
|
FlaxEngine.Scripting.InvokeOnUpdate(Window.MarkAsEdited);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "MaterialShader.h"
|
#include "MaterialShader.h"
|
||||||
#include "Engine/Core/Math/Rectangle.h"
|
|
||||||
#include "Engine/Core/Types/Span.h"
|
#include "Engine/Core/Types/Span.h"
|
||||||
#include "Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.h"
|
#include "Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.h"
|
||||||
#include "Engine/Renderer/GlobalSignDistanceFieldPass.h"
|
#include "Engine/Renderer/GlobalSignDistanceFieldPass.h"
|
||||||
|
|||||||
@@ -150,21 +150,6 @@ bool TerrainMaterialShader::Load()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Support blending but then use only emissive channel
|
|
||||||
switch (_info.BlendMode)
|
|
||||||
{
|
|
||||||
case MaterialBlendMode::Transparent:
|
|
||||||
psDesc.BlendMode = BlendingMode::AlphaBlend;
|
|
||||||
break;
|
|
||||||
case MaterialBlendMode::Additive:
|
|
||||||
psDesc.BlendMode = BlendingMode::Additive;
|
|
||||||
break;
|
|
||||||
case MaterialBlendMode::Multiply:
|
|
||||||
psDesc.BlendMode = BlendingMode::Multiply;
|
|
||||||
break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GBuffer Pass
|
// GBuffer Pass
|
||||||
psDesc.VS = _shader->GetVS("VS");
|
psDesc.VS = _shader->GetVS("VS");
|
||||||
psDesc.PS = _shader->GetPS("PS_GBuffer");
|
psDesc.PS = _shader->GetPS("PS_GBuffer");
|
||||||
@@ -185,7 +170,6 @@ bool TerrainMaterialShader::Load()
|
|||||||
|
|
||||||
// Depth Pass
|
// Depth Pass
|
||||||
psDesc.CullMode = CullMode::TwoSided;
|
psDesc.CullMode = CullMode::TwoSided;
|
||||||
psDesc.BlendMode = BlendingMode::Opaque;
|
|
||||||
psDesc.DepthClipEnable = false;
|
psDesc.DepthClipEnable = false;
|
||||||
psDesc.DepthWriteEnable = true;
|
psDesc.DepthWriteEnable = true;
|
||||||
psDesc.DepthEnable = true;
|
psDesc.DepthEnable = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user