From c5bd9ecf4fd7ad8cc40de3d0a25f316f5a9beee5 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 19 Aug 2019 18:14:29 -0700 Subject: [PATCH] REfreshing the antialiasing qml na dconfig of the Jitter Job --- .../render-utils/src/AntialiasingEffect.cpp | 36 +-- .../render-utils/src/AntialiasingEffect.h | 4 +- .../render-utils/src/RenderDeferredTask.cpp | 9 +- .../utilities/render/luci/Antialiasing.qml | 207 ++++++++---------- .../developer/utilities/render/luci/Bloom.qml | 6 + .../utilities/render/luci/ShadingModel.qml | 3 +- 6 files changed, 128 insertions(+), 137 deletions(-) diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index 180e914d60..0e70cb7f3c 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -298,29 +298,33 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const }); } - void JitterSampleConfig::setIndex(int current) { _index = (current) % JitterSample::SEQUENCE_LENGTH; emit dirty(); } -int JitterSampleConfig::cycleStopPauseRun() { - _state = (_state + 1) % 3; +void JitterSampleConfig::setState(int state) { + _state = (state) % 3; switch (_state) { - case 0: { - return none(); - break; - } - case 1: { - return pause(); - break; - } - case 2: - default: { - return play(); - break; - } + case 0: { + none(); + break; } + case 1: { + pause(); + break; + } + case 2: + default: { + play(); + break; + } + } + emit dirty(); +} + +int JitterSampleConfig::cycleStopPauseRun() { + setState((_state + 1) % 3); return _state; } diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index 7d8bbb44d9..415571d348 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -25,6 +25,7 @@ class JitterSampleConfig : public render::Job::Config { Q_PROPERTY(bool freeze MEMBER freeze NOTIFY dirty) Q_PROPERTY(bool stop MEMBER stop NOTIFY dirty) Q_PROPERTY(int index READ getIndex NOTIFY dirty) + Q_PROPERTY(int state READ getState WRITE setState NOTIFY dirty) public: JitterSampleConfig() : render::Job::Config(true) {} @@ -33,6 +34,7 @@ public: bool freeze{ false }; void setIndex(int current); + void setState(int state); public slots: int cycleStopPauseRun(); @@ -58,7 +60,7 @@ class JitterSample { public: enum { - SEQUENCE_LENGTH = 64 + SEQUENCE_LENGTH = 32 }; using Config = JitterSampleConfig; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 4561cf903d..cfcc6777d6 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -150,8 +150,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren // Prepare deferred, generate the shared Deferred Frame Transform. Only valid with the scaled frame buffer const auto deferredFrameTransform = task.addJob("DeferredFrameTransform", jitter); - const auto opaqueRangeTimer = task.addJob("BeginOpaqueRangeTimer", "DrawOpaques"); - const auto prepareDeferredInputs = PrepareDeferred::Inputs(scaledPrimaryFramebuffer, lightingModel).asVarying(); const auto prepareDeferredOutputs = task.addJob("PrepareDeferred", prepareDeferredInputs); const auto deferredFramebuffer = prepareDeferredOutputs.getN(0); @@ -164,8 +162,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel, jitter).asVarying(); task.addJob("DrawOpaqueDeferred", opaqueInputs, shapePlumber); - task.addJob("OpaqueRangeTimer", opaqueRangeTimer); - // Opaque all rendered // Linear Depth Pass @@ -216,13 +212,10 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto transparentsInputs = RenderTransparentDeferred::Inputs(transparents, hazeFrame, lightFrame, lightingModel, lightClusters, shadowFrame, jitter).asVarying(); task.addJob("DrawTransparentDeferred", transparentsInputs, shapePlumber); - const auto outlineRangeTimer = task.addJob("BeginHighlightRangeTimer", "Highlight"); - + // Highlight const auto outlineInputs = DrawHighlightTask::Inputs(items, deferredFramebuffer, lightingFramebuffer, deferredFrameTransform, jitter).asVarying(); task.addJob("DrawHighlight", outlineInputs); - task.addJob("HighlightRangeTimer", outlineRangeTimer); - // Layered Over (in front) const auto inFrontOpaquesInputs = DrawLayered3D::Inputs(inFrontOpaque, lightingModel, hazeFrame, jitter).asVarying(); const auto inFrontTransparentsInputs = DrawLayered3D::Inputs(inFrontTransparent, lightingModel, hazeFrame, jitter).asVarying(); diff --git a/scripts/developer/utilities/render/luci/Antialiasing.qml b/scripts/developer/utilities/render/luci/Antialiasing.qml index 6d1209157f..46d8a8fcdb 100644 --- a/scripts/developer/utilities/render/luci/Antialiasing.qml +++ b/scripts/developer/utilities/render/luci/Antialiasing.qml @@ -22,15 +22,12 @@ import "../../lib/prop" as Prop Column{ - HifiConstants { id: hifi; } + id: antialiasing - id: antialiasing - padding: 10 anchors.left: parent.left anchors.right: parent.right - spacing: 10 - Prop.PropScalar { + Prop.PropScalar { label: "MSAA" object: Render.getConfig("RenderMainView.PreparePrimaryBufferForward") property: "numSamples" @@ -38,49 +35,58 @@ Column{ max: 32 integral: true } - Row { - spacing: 10 - id: fxaaOnOff - property bool debugFXAA: false - HifiControls.Button { - function getTheText() { - if (Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff) { - return "FXAA" - } else { - return "TAA" - } - } - text: getTheText() - onClicked: { - var onOff = !Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff; - if (onOff) { - Render.getConfig("RenderMainView.JitterCam").none(); - Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = true; - } else { - Render.getConfig("RenderMainView.JitterCam").play(); - Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = false; - } - + + Prop.PropEnum { + label: "Deferred AA Method" + enums: [ + "Off", + "TAA", + "FXAA", + ] + + valueVarSetter: function (mode) { setAAMode(mode) } + valueVarGetter: function () { return Render.getConfig("RenderMainView.JitterCam").state + + Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff * 2 } + + function setAAMode(mode) { + console.log("Deferred AA mode is " + mode) + + if (mode == 0) { + Render.getConfig("RenderMainView.JitterCam").state = 0; + Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = false; + } else if (mode == 1) { + Render.getConfig("RenderMainView.JitterCam").state = 1; + Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = false; + } else { + Render.getConfig("RenderMainView.JitterCam").state = 0; + Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = true; } } } Separator {} + Prop.PropEnum { + label: "Jitter" + object: Render.getConfig("RenderMainView.JitterCam") + property: "state" + + enums: [ + "Off", + "On", + "Paused", + ] + } + Prop.PropScalar { + label: "Sample Index" + object: Render.getConfig("RenderMainView.JitterCam") + property: "index" + // min: -1 + // max: 32 + readOnly: true + integral: true + } Row { spacing: 10 - - HifiControls.Button { - text: { - var state = 2 - (Render.getConfig("RenderMainView.JitterCam").freeze * 1 - Render.getConfig("RenderMainView.JitterCam").stop * 2); - if (state === 2) { - return "Jitter" - } else if (state === 1) { - return "Paused at " + Render.getConfig("RenderMainView.JitterCam").index + "" - } else { - return "No Jitter" - } - } - onClicked: { Render.getConfig("RenderMainView.JitterCam").cycleStopPauseRun(); } - } + HifiControls.Button { text: "<" onClicked: { Render.getConfig("RenderMainView.JitterCam").prev(); } @@ -90,96 +96,75 @@ Column{ onClicked: { Render.getConfig("RenderMainView.JitterCam").next(); } } } - Separator {} - HifiControls.CheckBox { - boxSize: 20 - text: "Constrain color" - checked: Render.getConfig("RenderMainView.Antialiasing")["constrainColor"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["constrainColor"] = checked } - } - ConfigSlider { - label: qsTr("Covariance gamma") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") + Separator {} + Prop.PropBool { + label: "Constrain color" + object: Render.getConfig("RenderMainView.Antialiasing") + property: "constrainColor" + } + Prop.PropScalar { + label: "Covariance gamma" + object: Render.getConfig("RenderMainView.Antialiasing") property: "covarianceGamma" max: 1.5 min: 0.5 - height: 38 - } - Separator {} - HifiControls.CheckBox { - boxSize: 20 - text: "Feedback history color" - checked: Render.getConfig("RenderMainView.Antialiasing")["feedbackColor"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["feedbackColor"] = checked } - } - - ConfigSlider { - label: qsTr("Source blend") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") + } + Separator {} + Prop.PropBool { + label: "Feedback history color" + object: Render.getConfig("RenderMainView.Antialiasing") + property: "feedbackColor" + } + Prop.PropScalar { + label: "Source blend" + object: Render.getConfig("RenderMainView.Antialiasing") property: "blend" max: 1.0 min: 0.0 - height: 38 } - - ConfigSlider { - label: qsTr("Post sharpen") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") + Prop.PropScalar { + label: "Post sharpen" + object: Render.getConfig("RenderMainView.Antialiasing") property: "sharpen" max: 1.0 min: 0.0 } - Separator {} - Row { - - spacing: 10 - HifiControls.CheckBox { - boxSize: 20 - text: "Debug" - checked: Render.getConfig("RenderMainView.Antialiasing")["debug"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["debug"] = checked } - } - HifiControls.CheckBox { - boxSize: 20 - text: "Show Debug Cursor" - checked: Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"] = checked } - } - } - ConfigSlider { - label: qsTr("Debug Region <") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") + Separator {} + Prop.PropBool { + label: "Debug" + object: Render.getConfig("RenderMainView.Antialiasing") + property: "debug" + } + Prop.PropBool { + label: "Show Debug Cursor" + object: Render.getConfig("RenderMainView.Antialiasing") + property: "showCursorPixel" + } + Prop.PropScalar { + label: "Debug Region <" + object: Render.getConfig("RenderMainView.Antialiasing") property: "debugX" max: 1.0 min: 0.0 } - HifiControls.CheckBox { - boxSize: 20 - text: "Closest Fragment" - checked: Render.getConfig("RenderMainView.Antialiasing")["showClosestFragment"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showClosestFragment"] = checked } - } - ConfigSlider { - label: qsTr("Debug Velocity Threshold [pix]") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") + Prop.PropBool { + label: "Closest Fragment" + object: Render.getConfig("RenderMainView.Antialiasing") + property: "showClosestFragment" + } + Prop.PropScalar { + label: "Debug Velocity Threshold [pix]" + object: Render.getConfig("RenderMainView.Antialiasing") property: "debugShowVelocityThreshold" max: 50 min: 0.0 - height: 38 } - ConfigSlider { - label: qsTr("Debug Orb Zoom") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") + Prop.PropScalar { + label: "Debug Orb Zoom" + object: Render.getConfig("RenderMainView.Antialiasing") property: "debugOrbZoom" max: 32.0 min: 1.0 - height: 38 - } + } } diff --git a/scripts/developer/utilities/render/luci/Bloom.qml b/scripts/developer/utilities/render/luci/Bloom.qml index 67c931f66c..0edaea702b 100644 --- a/scripts/developer/utilities/render/luci/Bloom.qml +++ b/scripts/developer/utilities/render/luci/Bloom.qml @@ -37,6 +37,12 @@ Column { ] valueVarSetter: function (mode) { bloom.setDebugMode(mode) } + } + + Prop.PropBool { + label: "Debug Bloom Buffer" + object: Render.getConfig("RenderMainView.Bloom") + property: "enabled" } } diff --git a/scripts/developer/utilities/render/luci/ShadingModel.qml b/scripts/developer/utilities/render/luci/ShadingModel.qml index 78ca7f1740..afeca5a204 100644 --- a/scripts/developer/utilities/render/luci/ShadingModel.qml +++ b/scripts/developer/utilities/render/luci/ShadingModel.qml @@ -35,7 +35,8 @@ Column { "Emissive:LightingModel:enableEmissive", "Lightmap:LightingModel:enableLightmap", "Background:LightingModel:enableBackground", - "Haze:LightingModel:enableHaze", + "Haze:LightingModel:enableHaze", + "Bloom:LightingModel:enableBloom", "AO:LightingModel:enableAmbientOcclusion", "Textures:LightingModel:enableMaterialTexturing" ]