Implement the force unlit option (#1344)
This commit is contained in:
committed by
GitHub
parent
1a60397492
commit
0f85565b49
@@ -182,8 +182,6 @@ void GeneralWindow::Create(EditorComponent* _editor)
|
||||
freezeCullingCameraCheckBox.SetCheck(wi::renderer::GetFreezeCullingCameraEnabled());
|
||||
AddWidget(&freezeCullingCameraCheckBox);
|
||||
|
||||
|
||||
|
||||
disableAlbedoMapsCheckBox.Create("Disable albedo maps: ");
|
||||
disableAlbedoMapsCheckBox.SetTooltip("Disables albedo maps on objects for easier lighting debugging");
|
||||
disableAlbedoMapsCheckBox.OnClick([](wi::gui::EventArgs args) {
|
||||
@@ -201,6 +199,15 @@ void GeneralWindow::Create(EditorComponent* _editor)
|
||||
forceDiffuseLightingCheckBox.SetCheck(wi::renderer::IsForceDiffuseLighting());
|
||||
AddWidget(&forceDiffuseLightingCheckBox);
|
||||
|
||||
forceUnlitCheckBox.Create("Force unlit: ");
|
||||
forceUnlitCheckBox.SetTooltip("Sets every surface without lighting and shadows");
|
||||
forceUnlitCheckBox.OnClick([](wi::gui::EventArgs args) {
|
||||
wi::renderer::SetForceUnlit(args.bValue);
|
||||
});
|
||||
forceUnlitCheckBox.SetCheck(wi::renderer::IsForceUnlit());
|
||||
AddWidget(&forceUnlitCheckBox);
|
||||
|
||||
|
||||
focusModeCheckBox.Create(ICON_EYE " Focus mode GUI: ");
|
||||
focusModeCheckBox.SetCheckText(ICON_EYE);
|
||||
focusModeCheckBox.SetTooltip("Reduce the amount of effects in the editor GUI to improve accessibility");
|
||||
@@ -1547,6 +1554,7 @@ void GeneralWindow::ResizeLayout()
|
||||
layout.add_right(freezeCullingCameraCheckBox);
|
||||
layout.add_right(disableAlbedoMapsCheckBox);
|
||||
layout.add_right(forceDiffuseLightingCheckBox);
|
||||
layout.add_right(forceUnlitCheckBox);
|
||||
|
||||
layout.jump();
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
wi::gui::CheckBox freezeCullingCameraCheckBox;
|
||||
wi::gui::CheckBox disableAlbedoMapsCheckBox;
|
||||
wi::gui::CheckBox forceDiffuseLightingCheckBox;
|
||||
wi::gui::CheckBox forceUnlitCheckBox;
|
||||
wi::gui::CheckBox focusModeCheckBox;
|
||||
wi::gui::CheckBox disableRoundCornersCheckBox;
|
||||
wi::gui::CheckBox disableGradientCheckBox;
|
||||
|
||||
@@ -1240,6 +1240,7 @@ enum FRAME_OPTIONS
|
||||
OPTION_BIT_VOLUMETRICCLOUDS_RECEIVE_SHADOW = 1 << 19,
|
||||
OPTION_BIT_CAPSULE_SHADOW_ENABLED = 1 << 20,
|
||||
OPTION_BIT_DISABLE_SHADOWMAPS = 1 << 21,
|
||||
OPTION_BIT_FORCE_UNLIT = 1 << 22,
|
||||
};
|
||||
|
||||
// ---------- Common Constant buffers: -----------------
|
||||
|
||||
@@ -40,6 +40,12 @@ struct Lighting
|
||||
|
||||
inline void ApplyLighting(in Surface surface, in Lighting lighting, inout half4 color)
|
||||
{
|
||||
if (GetFrame().options & OPTION_BIT_FORCE_UNLIT)
|
||||
{
|
||||
color.rgb = surface.albedo;
|
||||
return;
|
||||
}
|
||||
|
||||
half3 diffuse = lighting.direct.diffuse / PI + lighting.indirect.diffuse * GetGIBoost() * (1 - surface.F) * surface.occlusion + surface.ssgi;
|
||||
half3 specular = lighting.direct.specular + lighting.indirect.specular * surface.occlusion; // reminder: cannot apply surface.F for whole indirect specular, because multiple layers have separate fresnels (sheen, clearcoat)
|
||||
color.rgb = lerp(surface.albedo * diffuse, surface.refraction.rgb, surface.refraction.a);
|
||||
|
||||
@@ -39,6 +39,11 @@ inline half3 PlanarReflection(in Surface surface, in half2 bumpColor)
|
||||
|
||||
inline void ForwardLighting(inout Surface surface, inout Lighting lighting)
|
||||
{
|
||||
if (GetFrame().options & OPTION_BIT_FORCE_UNLIT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_ENVMAPS
|
||||
// Apply environment maps:
|
||||
half4 envmapAccumulation = 0;
|
||||
@@ -282,6 +287,11 @@ inline uint GetFlatTileIndex(min16uint2 pixel)
|
||||
|
||||
inline void TiledLighting(inout Surface surface, inout Lighting lighting, uint flatTileIndex)
|
||||
{
|
||||
if (GetFrame().options & OPTION_BIT_FORCE_UNLIT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_ENVMAPS
|
||||
// Apply environment maps:
|
||||
half4 envmapAccumulation = 0;
|
||||
|
||||
@@ -215,6 +215,13 @@ struct Surface
|
||||
f0 = surfaceMap.b = surfaceMap.a = 0;
|
||||
}
|
||||
|
||||
#ifndef ENVMAPRENDERING
|
||||
if (GetFrame().options & OPTION_BIT_FORCE_UNLIT)
|
||||
#endif // ENVMAPRENDERING
|
||||
{
|
||||
albedo = baseColor.rgb;
|
||||
}
|
||||
|
||||
[branch]
|
||||
if (material.IsUsingSpecularGlossinessWorkflow())
|
||||
{
|
||||
@@ -302,7 +309,7 @@ struct Surface
|
||||
#endif // CARTOON
|
||||
|
||||
#ifndef ENVMAPRENDERING
|
||||
if (GetFrame().options & OPTION_BIT_FORCE_DIFFUSE_LIGHTING)
|
||||
if (GetFrame().options & OPTION_BIT_FORCE_DIFFUSE_LIGHTING || GetFrame().options & OPTION_BIT_FORCE_UNLIT)
|
||||
#endif // ENVMAPRENDERING
|
||||
{
|
||||
F = 0;
|
||||
|
||||
@@ -130,6 +130,7 @@ bool raytracedShadows = false;
|
||||
bool tessellationEnabled = true;
|
||||
bool disableAlbedoMaps = false;
|
||||
bool forceDiffuseLighting = false;
|
||||
bool forceUnlit = false;
|
||||
bool SHADOWS_ENABLED = true;
|
||||
bool SCREENSPACESHADOWS = false;
|
||||
bool SURFELGI = false;
|
||||
@@ -4315,6 +4316,10 @@ void UpdatePerFrameData(
|
||||
{
|
||||
frameCB.options |= OPTION_BIT_FORCE_DIFFUSE_LIGHTING;
|
||||
}
|
||||
if (IsForceUnlit())
|
||||
{
|
||||
frameCB.options |= OPTION_BIT_FORCE_UNLIT;
|
||||
}
|
||||
if (vis.scene->weather.IsVolumetricCloudsCastShadow() && vis.scene->weather.IsVolumetricClouds())
|
||||
{
|
||||
frameCB.options |= OPTION_BIT_VOLUMETRICCLOUDS_CAST_SHADOW;
|
||||
@@ -19130,6 +19135,14 @@ bool IsForceDiffuseLighting()
|
||||
{
|
||||
return forceDiffuseLighting;
|
||||
}
|
||||
void SetForceUnlit(bool value)
|
||||
{
|
||||
forceUnlit = value;
|
||||
}
|
||||
bool IsForceUnlit()
|
||||
{
|
||||
return forceUnlit;
|
||||
}
|
||||
void SetScreenSpaceShadowsEnabled(bool value)
|
||||
{
|
||||
SCREENSPACESHADOWS = value;
|
||||
|
||||
@@ -1205,6 +1205,8 @@ namespace wi::renderer
|
||||
bool IsDisableAlbedoMaps();
|
||||
void SetForceDiffuseLighting(bool value);
|
||||
bool IsForceDiffuseLighting();
|
||||
void SetForceUnlit(bool value);
|
||||
bool IsForceUnlit();
|
||||
void SetScreenSpaceShadowsEnabled(bool value);
|
||||
bool GetScreenSpaceShadowsEnabled();
|
||||
void SetSurfelGIEnabled(bool value);
|
||||
|
||||
Reference in New Issue
Block a user