Adding a toggle button to the developer/Render menu to be able to disable taa and fall back to Fxaa

This commit is contained in:
samcake 2018-05-16 13:09:55 -07:00
parent 808fb5a5d9
commit 21e069c90c
4 changed files with 38 additions and 12 deletions

View file

@ -47,6 +47,7 @@
#include "AmbientOcclusionEffect.h" #include "AmbientOcclusionEffect.h"
#include "RenderShadowTask.h" #include "RenderShadowTask.h"
#include "AntialiasingEffect.h"
#if defined(Q_OS_MAC) || defined(Q_OS_WIN) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
#include "SpeechRecognizer.h" #include "SpeechRecognizer.h"
@ -380,6 +381,25 @@ Menu::Menu() {
// Developer > Render >>> // Developer > Render >>>
MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render"); MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render");
action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AntiAliasing, 0, true);
connect(action, &QAction::triggered, [action] {
auto renderConfig = qApp->getRenderEngine()->getConfiguration();
if (renderConfig) {
auto mainViewJitterCamConfig = renderConfig->getConfig<JitterSample>("RenderMainView.JitterCam");
auto mainViewAntialiasingConfig = renderConfig->getConfig<Antialiasing>("RenderMainView.Antialiasing");
if (mainViewJitterCamConfig && mainViewAntialiasingConfig) {
if (action->isChecked()) {
mainViewJitterCamConfig->play();
mainViewAntialiasingConfig->debugFXAAX = 1.0;
} else {
mainViewJitterCamConfig->none();
mainViewAntialiasingConfig->debugFXAAX = 0.0;
}
}
}
});
action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Shadows, 0, true); action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Shadows, 0, true);
connect(action, &QAction::triggered, [action] { connect(action, &QAction::triggered, [action] {
auto renderConfig = qApp->getRenderEngine()->getConfiguration(); auto renderConfig = qApp->getRenderEngine()->getConfiguration();

View file

@ -210,6 +210,7 @@ namespace MenuOption {
const QString DesktopTabletToToolbar = "Desktop Tablet Becomes Toolbar"; const QString DesktopTabletToToolbar = "Desktop Tablet Becomes Toolbar";
const QString HMDTabletToToolbar = "HMD Tablet Becomes Toolbar"; const QString HMDTabletToToolbar = "HMD Tablet Becomes Toolbar";
const QString Shadows = "Shadows"; const QString Shadows = "Shadows";
const QString AntiAliasing = "Temporal Antialiasing (FXAA if disabled)";
const QString AmbientOcclusion = "Ambient Occlusion"; const QString AmbientOcclusion = "Ambient Occlusion";
} }

View file

@ -95,7 +95,7 @@ class AntialiasingConfig : public render::Job::Config {
Q_PROPERTY(bool debug MEMBER debug NOTIFY dirty) Q_PROPERTY(bool debug MEMBER debug NOTIFY dirty)
Q_PROPERTY(float debugX MEMBER debugX NOTIFY dirty) Q_PROPERTY(float debugX MEMBER debugX NOTIFY dirty)
Q_PROPERTY(float debugFXAAX MEMBER debugFXAAX NOTIFY dirty) Q_PROPERTY(bool fxaaOnOff READ debugFXAA WRITE setDebugFXAA NOTIFY dirty)
Q_PROPERTY(float debugShowVelocityThreshold MEMBER debugShowVelocityThreshold NOTIFY dirty) Q_PROPERTY(float debugShowVelocityThreshold MEMBER debugShowVelocityThreshold NOTIFY dirty)
Q_PROPERTY(bool showCursorPixel MEMBER showCursorPixel NOTIFY dirty) Q_PROPERTY(bool showCursorPixel MEMBER showCursorPixel NOTIFY dirty)
Q_PROPERTY(glm::vec2 debugCursorTexcoord MEMBER debugCursorTexcoord NOTIFY dirty) Q_PROPERTY(glm::vec2 debugCursorTexcoord MEMBER debugCursorTexcoord NOTIFY dirty)
@ -106,6 +106,10 @@ class AntialiasingConfig : public render::Job::Config {
public: public:
AntialiasingConfig() : render::Job::Config(true) {} AntialiasingConfig() : render::Job::Config(true) {}
void setDebugFXAA(bool debug) { debugFXAAX = (debug ? 0.0f : 1.0f); emit dirty();}
bool debugFXAA() const { return (debugFXAAX == 0.0f ? true : false); }
float blend{ 0.25f }; float blend{ 0.25f };
float sharpen{ 0.05f }; float sharpen{ 0.05f };

View file

@ -38,21 +38,22 @@ Rectangle {
id: fxaaOnOff id: fxaaOnOff
property bool debugFXAA: false property bool debugFXAA: false
HifiControls.Button { HifiControls.Button {
text: { function getTheText() {
if (fxaaOnOff.debugFXAA) { if (Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff) {
return "FXAA" return "FXAA"
} else { } else {
return "TAA" return "TAA"
} }
} }
text: getTheText()
onClicked: { onClicked: {
fxaaOnOff.debugFXAA = !fxaaOnOff.debugFXAA var onOff = !Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff;
if (fxaaOnOff.debugFXAA) { if (onOff) {
Render.getConfig("RenderMainView.JitterCam").none(); Render.getConfig("RenderMainView.JitterCam").none();
Render.getConfig("RenderMainView.Antialiasing").debugFXAAX = 0; Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = true;
} else { } else {
Render.getConfig("RenderMainView.JitterCam").play(); Render.getConfig("RenderMainView.JitterCam").play();
Render.getConfig("RenderMainView.Antialiasing").debugFXAAX = 1.0; Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = false;
} }
} }