Eposing the jitter sequence and debugging it

This commit is contained in:
Sam Gateau 2017-08-27 22:08:33 -07:00
parent 4035478b9a
commit 0f67f9bc52
8 changed files with 263 additions and 132 deletions

View file

@ -178,6 +178,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
const int AntialiasingPass_ParamsSlot = 0;
const int AntialiasingPass_FrameTransformSlot = 1;
const int AntialiasingPass_JitterBufferSlot = 2;
const int AntialiasingPass_HistoryMapSlot = 0;
const int AntialiasingPass_SourceMapSlot = 1;
@ -209,7 +210,8 @@ const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline() {
slotBindings.insert(gpu::Shader::Binding(std::string("taaParamsBuffer"), AntialiasingPass_ParamsSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), AntialiasingPass_FrameTransformSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("taaJitterBuffer"), AntialiasingPass_JitterBufferSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("historyMap"), AntialiasingPass_HistoryMapSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("sourceMap"), AntialiasingPass_SourceMapSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("velocityMap"), AntialiasingPass_VelocityMapSlot));
@ -258,6 +260,7 @@ const gpu::PipelinePointer& Antialiasing::getDebugBlendPipeline() {
gpu::Shader::BindingSet slotBindings;
slotBindings.insert(gpu::Shader::Binding(std::string("taaParamsBuffer"), AntialiasingPass_ParamsSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("taaJitterBuffer"), AntialiasingPass_JitterBufferSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), AntialiasingPass_FrameTransformSlot));
slotBindings.insert(gpu::Shader::Binding(std::string("nextMap"), AntialiasingPass_NextMapSlot));
@ -282,12 +285,19 @@ const gpu::PipelinePointer& Antialiasing::getDebugBlendPipeline() {
void Antialiasing::configure(const Config& config) {
_params.edit().blend = config.blend;
_params.edit().velocityScale = config.velocityScale;
_params.edit().setUnjitter(config.unjitter);
_params.edit().debugShowVelocityThreshold = config.debugShowVelocityThreshold;
_params.edit().debugX = config.debugX;
_params.edit().setDebug(config.debug);
_params.edit().setShowDebugCursor(config.showCursorPixel);
_params.edit().setDebugCursor(config.debugCursorTexcoord);
_params.edit().setDebugOrbZoom(config.debugOrbZoom);
_params.edit().setShowJitterSequence(config.showJitterSequence);
_params.edit().setShowClosestFragment(config.showClosestFragment);
}
@ -298,9 +308,10 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
RenderArgs* args = renderContext->args;
auto& deferredFrameTransform = inputs.get0();
auto& sourceBuffer = inputs.get1();
auto& linearDepthBuffer = inputs.get2();
auto& velocityBuffer = inputs.get3();
auto& jitterBuffer = inputs.get1();
auto& sourceBuffer = inputs.get2();
auto& linearDepthBuffer = inputs.get3();
auto& velocityBuffer = inputs.get4();
int width = sourceBuffer->getWidth();
int height = sourceBuffer->getHeight();
@ -338,9 +349,10 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
batch.setResourceTexture(AntialiasingPass_VelocityMapSlot, velocityBuffer->getVelocityTexture());
batch.setResourceTexture(AntialiasingPass_DepthMapSlot, linearDepthBuffer->getLinearDepthTexture());
batch.setUniformBuffer(AntialiasingPass_ParamsSlot, _params._buffer);
batch.setUniformBuffer(AntialiasingPass_ParamsSlot, _params);
batch.setUniformBuffer(AntialiasingPass_FrameTransformSlot, deferredFrameTransform->getFrameTransformBuffer());
batch.setUniformBuffer(AntialiasingPass_JitterBufferSlot, jitterBuffer);
batch.setFramebuffer(_antialiasingBuffer[nextFrame]);
batch.setPipeline(getAntialiasingPipeline());
batch.draw(gpu::TRIANGLE_STRIP, 4);
@ -359,8 +371,9 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
batch.setUniformBuffer(AntialiasingPass_ParamsSlot, nullptr);
batch.setUniformBuffer(AntialiasingPass_FrameTransformSlot, nullptr);
batch.setResourceTexture(AntialiasingPass_DepthMapSlot, nullptr);
batch.setUniformBuffer(AntialiasingPass_JitterBufferSlot, nullptr);
batch.setResourceTexture(AntialiasingPass_DepthMapSlot, nullptr);
batch.setResourceTexture(AntialiasingPass_HistoryMapSlot, nullptr);
batch.setResourceTexture(AntialiasingPass_VelocityMapSlot, nullptr);
batch.setResourceTexture(AntialiasingPass_NextMapSlot, nullptr);

View file

@ -18,17 +18,67 @@
#include "DeferredFrameTransform.h"
#include "VelocityBufferPass.h"
class JitterSampleConfig : public render::Job::Config {
Q_OBJECT
Q_PROPERTY(float scale MEMBER scale NOTIFY dirty)
Q_PROPERTY(bool freeze MEMBER freeze NOTIFY dirty)
public:
JitterSampleConfig() : render::Job::Config(true) {}
float scale{ 0.5f };
bool freeze{ false };
signals:
void dirty();
};
class JitterSample {
public:
struct SampleSequence {
SampleSequence();
static const int SEQUENCE_LENGTH{ 8 };
glm::vec2 offsets[SEQUENCE_LENGTH];
int sequenceLength{ SEQUENCE_LENGTH };
int currentIndex{ 0 };
};
using JitterBuffer = gpu::StructBuffer<SampleSequence>;
using Config = JitterSampleConfig;
using JobModel = render::Job::ModelO<JitterSample, JitterBuffer, Config>;
void configure(const Config& config);
void run(const render::RenderContextPointer& renderContext, JitterBuffer& jitterBuffer);
private:
JitterBuffer _jitterBuffer;
float _scale{ 1.0 };
bool _freeze{ false };
};
class AntialiasingConfig : public render::Job::Config {
Q_OBJECT
Q_PROPERTY(float blend MEMBER blend NOTIFY dirty)
Q_PROPERTY(float velocityScale MEMBER velocityScale NOTIFY dirty)
Q_PROPERTY(bool unjitter MEMBER unjitter NOTIFY dirty)
Q_PROPERTY(bool debug MEMBER debug NOTIFY dirty)
Q_PROPERTY(float debugX MEMBER debugX NOTIFY dirty)
Q_PROPERTY(float debugShowVelocityThreshold MEMBER debugShowVelocityThreshold NOTIFY dirty)
Q_PROPERTY(bool showCursorPixel MEMBER showCursorPixel NOTIFY dirty)
Q_PROPERTY(glm::vec2 debugCursorTexcoord MEMBER debugCursorTexcoord NOTIFY dirty)
Q_PROPERTY(float debugOrbZoom MEMBER debugOrbZoom NOTIFY dirty)
Q_PROPERTY(bool showJitterSequence MEMBER showJitterSequence NOTIFY dirty)
Q_PROPERTY(bool showClosestFragment MEMBER showClosestFragment NOTIFY dirty)
public:
AntialiasingConfig() : render::Job::Config(true) {}
@ -40,13 +90,19 @@ public:
glm::vec2 debugCursorTexcoord{ 0.5f, 0.5f };
float debugOrbZoom{ 2.0f };
bool unjitter{ true };
bool debug { false };
bool showCursorPixel { false };
bool showJitterSequence{ false };
bool showClosestFragment{ false };
signals:
void dirty();
};
#define SET_BIT(bitfield, bitIndex, value) bitfield = ((bitfield) & ~(1 << (bitIndex))) | ((value) << (bitIndex))
#define GET_BIT(bitfield, bitIndex) ((bitfield) & (1 << (bitIndex)))
struct TAAParams {
float debugX{ 0.0f };
@ -54,11 +110,18 @@ struct TAAParams {
float velocityScale{ 1.0f };
float debugShowVelocityThreshold{ 1.0f };
glm::vec4 debug{ 0.0f };
glm::ivec4 debug{ 0 };
glm::vec4 pixelInfo{ 0.5f, 0.5f, 2.0f, 0.0f };
void setDebug(bool enabled) { debug.x = (float)enabled; }
bool isDebug() const { return (bool) debug.x; }
void setUnjitter(bool enabled) { SET_BIT(debug.y, 0, enabled); }
bool isUnjitter() const { return (bool)GET_BIT(debug.y, 0); }
void setDebug(bool enabled) { SET_BIT(debug.x, 0, enabled); }
bool isDebug() const { return (bool) GET_BIT(debug.x, 0); }
void setShowDebugCursor(bool enabled) { SET_BIT(debug.x, 1, enabled); }
bool showDebugCursor() const { return (bool)GET_BIT(debug.x, 1); }
void setDebugCursor(glm::vec2 debugCursor) { pixelInfo.x = debugCursor.x; pixelInfo.y = debugCursor.y; }
glm::vec2 getDebugCursor() const { return glm::vec2(pixelInfo.x, pixelInfo.y); }
@ -66,12 +129,16 @@ struct TAAParams {
void setDebugOrbZoom(float orbZoom) { pixelInfo.z = orbZoom; }
float getDebugOrbZoom() const { return pixelInfo.z; }
void setShowJitterSequence(bool enabled) { SET_BIT(debug.x, 2, enabled); }
void setShowClosestFragment(bool enabled) { SET_BIT(debug.x, 3, enabled); }
};
using TAAParamsBuffer = gpu::StructBuffer<TAAParams>;
class Antialiasing {
public:
using Inputs = render::VaryingSet4 < DeferredFrameTransformPointer, gpu::FramebufferPointer, LinearDepthFramebufferPointer, VelocityFramebufferPointer > ;
using Inputs = render::VaryingSet5 < DeferredFrameTransformPointer, JitterSample::JitterBuffer, gpu::FramebufferPointer, LinearDepthFramebufferPointer, VelocityFramebufferPointer > ;
using Config = AntialiasingConfig;
using JobModel = render::Job::ModelI<Antialiasing, Inputs, Config>;
@ -136,45 +203,5 @@ private:
int _geometryId { 0 };
};
*/
class JitterSampleConfig : public render::Job::Config {
Q_OBJECT
Q_PROPERTY(float scale MEMBER scale NOTIFY dirty)
Q_PROPERTY(bool freeze MEMBER freeze NOTIFY dirty)
public:
JitterSampleConfig() : render::Job::Config(true) {}
float scale { 0.5f };
bool freeze{ false };
signals:
void dirty();
};
class JitterSample {
public:
struct SampleSequence {
SampleSequence();
static const int SEQUENCE_LENGTH { 8 };
int sequenceLength{ SEQUENCE_LENGTH };
int currentIndex { 0 };
glm::vec2 offsets[SEQUENCE_LENGTH];
};
using JitterBuffer = gpu::StructBuffer<SampleSequence>;
using Config = JitterSampleConfig;
using JobModel = render::Job::ModelO<JitterSample, JitterBuffer, Config>;
void configure(const Config& config);
void run(const render::RenderContextPointer& renderContext, JitterBuffer& jitterBuffer);
private:
JitterBuffer _jitterBuffer;
float _scale { 1.0 };
bool _freeze { false };
};
#endif // hifi_AntialiasingEffect_h

View file

@ -221,7 +221,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
}
// AA job to be revisited
const auto antialiasingInputs = Antialiasing::Inputs(deferredFrameTransform, primaryFramebuffer, linearDepthTarget, velocityBuffer).asVarying();
const auto antialiasingInputs = Antialiasing::Inputs(deferredFrameTransform, jitterBuffer, primaryFramebuffer, linearDepthTarget, velocityBuffer).asVarying();
task.addJob<Antialiasing>("Antialiasing", antialiasingInputs);

View file

@ -19,10 +19,12 @@ in vec2 varTexCoord0;
layout(location = 0) out vec4 outFragColor;
void main() {
vec2 texelSize = getInvWidthHeight();
vec2 fragUV = varTexCoord0 - float(taa_unjitter()) * taa_getJitterSample(sequence.currentIndex) * texelSize;
vec3 nearFragUV = taa_findClosestFragment3x3(varTexCoord0);
vec3 nearFragUV = taa_findClosestFragment3x3(fragUV);
vec2 fragVel = taa_fetchVelocityMap(nearFragUV.xy);
vec2 fragUV = varTexCoord0;
/*vec3 sourceColor;
vec3 historyColor;

View file

@ -13,6 +13,20 @@
<@include DeferredTransform.slh@>
<$declareDeferredFrameTransform()$>
const int SEQUENCE_LENGTH = 8;
struct JitterSequence {
vec4 offsets[SEQUENCE_LENGTH / 2];
int sequenceLength;
int currentIndex;
};
layout(std140) uniform taaJitterBuffer {
JitterSequence sequence;
};
vec2 taa_getJitterSample(int index) {
return vec2((bool(index & 0x01) ? sequence.offsets[index >> 1].zw : sequence.offsets[index >> 1].xy));
}
<@include gpu/Color.slh@>
uniform sampler2D depthMap;
@ -27,7 +41,7 @@ struct TAAParams
float blend;
float motionScale;
float debugShowVelocityThreshold;
vec4 debugCursor;
ivec4 debug;
vec4 pixelInfo_orbZoom;
};
@ -35,6 +49,26 @@ layout(std140) uniform taaParamsBuffer {
TAAParams params;
};
#define GET_BIT(bitfield, bitIndex) bool((bitfield) & (1 << (bitIndex)))
bool taa_showDebugCursor() {
return GET_BIT(params.debug.x, 1);
}
bool taa_showJitterSequence() {
return GET_BIT(params.debug.x, 2);
}
bool taa_showClosestFragment() {
return GET_BIT(params.debug.x, 3);
}
bool taa_unjitter() {
return GET_BIT(params.debug.y, 0);
}
vec2 taa_getDebugCursorTexcoord() {
return params.pixelInfo_orbZoom.xy;
}
@ -133,6 +167,7 @@ vec3 taa_findClosestFragment3x3(vec2 uv)
vec2 taa_fetchSourceAndHistory(vec2 fragUV, vec2 fragVelocity, out vec3 sourceColor, out vec3 historyColor) {
sourceColor = taa_fetchSourceMap(fragUV).xyz;
vec2 prevFragUV = fragUV - fragVelocity;
historyColor = sourceColor;
if (!(any(lessThan(prevFragUV, vec2(0.0))) || any(greaterThan(prevFragUV, vec2(1.0))))) {
@ -154,8 +189,9 @@ vec3 taa_temporalReprojection(vec2 fragUV, vec2 fragVelocity, float fragZe)
vec4 texel1 = vec4(historyColor, 1.0);
vec4 texel0 = vec4(sourceColor, 1.0);
vec2 imageSize = getWidthHeight(0);
vec2 texelSize = getInvWidthHeight();
vec2 imageSize = getWidthHeight(0);
vec2 texelSize = getInvWidthHeight();
fragUV += float(taa_unjitter()) * taa_getJitterSample(sequence.currentIndex) * texelSize;
const float _SubpixelThreshold = 0.5;
const float _GatherBase = 0.5;
@ -213,7 +249,7 @@ vec2 texelSize = getInvWidthHeight();
float k_feedback = mix(_FeedbackMin, _FeedbackMax, unbiased_weight_sqr);
// output
vec3 nextColor = mix(texel0, texel1, k_feedback).xyz;
vec3 nextColor = mix(texel1, texel0, k_feedback).xyz;
// vec3 nextColor = mix(texel0, texel1, params.blend);

View file

@ -26,83 +26,106 @@ void main(void) {
vec3 sourceColor = texture(sourceMap, varTexCoord0).xyz;
vec2 imageSize = getWidthHeight(0);
vec2 texelSize = getInvWidthHeight();
vec2 pixPos = varTexCoord0 * imageSize;
vec2 pixVelocity = imageSize * texture(velocityMap, varTexCoord0).xy;
float pixVelocityLength = length(pixVelocity);
vec2 velocity = params.motionScale * pixVelocity * getInvWidthHeight();
vec2 velocity = params.motionScale * pixVelocity * texelSize;
vec2 prevTexCoord = varTexCoord0 - velocity;
vec2 prevPix = prevTexCoord * imageSize;
// Pixel Debugged
vec3 cursorFrag = taa_findClosestFragment3x3(taa_getDebugCursorTexcoord());
vec2 cursorUV = cursorFrag.xy;
vec2 cursorPixelPos = cursorUV * imageSize;
vec2 cursorVelocity = texture(velocityMap, cursorUV).xy;
vec2 cursorPrevUV = cursorUV - cursorVelocity;
cursorVelocity *= imageSize;
float cursorVelocityLength = length(cursorVelocity);
vec2 cursorVelocityDir = cursorVelocity / cursorVelocityLength;
if (taa_showDebugCursor()) {
vec3 cursorFrag = taa_findClosestFragment3x3(taa_getDebugCursorTexcoord());
vec2 cursorUV = cursorFrag.xy;
vec2 cursorPixelPos = cursorUV * imageSize;
vec2 cursorVelocity = texture(velocityMap, cursorUV).xy;
vec2 cursorPrevUV = cursorUV - cursorVelocity;
cursorVelocity *= imageSize;
float cursorVelocityLength = length(cursorVelocity);
vec2 cursorVelocityDir = cursorVelocity / cursorVelocityLength;
vec2 cursorToFragVec = pixPos - cursorPixelPos;
float cursorToFragLength = length(cursorToFragVec);
vec2 cursorToFragVec = pixPos - cursorPixelPos;
float cursorToFragLength = length(cursorToFragVec);
if ((cursorToFragLength <= cursorVelocityLength)) {
vec2 cursorVelocityDir = cursorVelocity / cursorVelocityLength;
vec2 cursorVelocityNor = vec2(cursorVelocityDir.y, -cursorVelocityDir.x);
if ((cursorToFragLength <= cursorVelocityLength)) {
vec2 cursorVelocityDir = cursorVelocity / cursorVelocityLength;
vec2 cursorVelocityNor = vec2(cursorVelocityDir.y, -cursorVelocityDir.x);
if ((dot(cursorVelocityDir, cursorToFragVec) < 0) && abs(dot(cursorVelocityNor, cursorToFragVec)) < 1.0) {
if ((dot(cursorVelocityDir, cursorToFragVec) < 0) && abs(dot(cursorVelocityNor, cursorToFragVec)) < 1.0) {
vec3 speedColor = taa_getVelocityColorRelative(cursorToFragLength);
outFragColor = vec4(speedColor, 1.0);
return;
}
}
float tenPercentHeight = 0.1 * imageSize.y;
float centerWidth = imageSize.x * 0.5;
vec2 nextOrbPos = vec2(centerWidth, imageSize.y - 3 * tenPercentHeight);
vec2 nextOrbPosToPix = pixPos - nextOrbPos;
float nextOrbPosToPixLength = length(nextOrbPosToPix);
vec2 prevOrbPos = nextOrbPos - cursorVelocityDir * 2.0 * tenPercentHeight;
vec2 prevOrbPosToPix = pixPos - prevOrbPos;
float prevOrbPosToPixLength = length(prevOrbPosToPix);
if ((prevOrbPosToPixLength < tenPercentHeight) && (cursorVelocityLength > 0.5)) {
vec2 prevOrbPosToPix_uv = cursorPrevUV + prevOrbPosToPix * texelSize / taa_getDebugOrbZoom();
vec3 preOrbColor = vec3(0.0);
if (!(any(lessThan(prevOrbPosToPix_uv, vec2(0.0))) || any(greaterThan(prevOrbPosToPix_uv, vec2(1.0))))) {
preOrbColor = texture(historyMap, prevOrbPosToPix_uv).xyz;
}
if (prevOrbPosToPixLength < 2.0) {
preOrbColor = vec3(1.0, 0.0, 1.0);
}
float distanceToNext = length(imageSize * (cursorUV - prevOrbPosToPix_uv));
if (distanceToNext < 2.0) {
preOrbColor = vec3(1.0, 0.5, 0.0);
}
outFragColor = vec4(preOrbColor, 1.0);
return;
}
if (nextOrbPosToPixLength < tenPercentHeight) {
vec2 nextOrbPosToPix_uv = cursorUV + nextOrbPosToPix * texelSize / taa_getDebugOrbZoom();
vec3 nextOrbColor = vec3(0.0);
if (!(any(lessThan(nextOrbPosToPix_uv, vec2(0.0))) || any(greaterThan(nextOrbPosToPix_uv, vec2(1.0))))) {
nextOrbColor = texture(nextMap, nextOrbPosToPix_uv).xyz;
}
float distanceToPrev = length(imageSize * (cursorPrevUV - nextOrbPosToPix_uv));
if (distanceToPrev < 2.0) {
nextOrbColor = vec3(1.0, 0.0, 1.0);
}
if (nextOrbPosToPixLength < 2.0) {
nextOrbColor = vec3(1.0, 0.5, 0.0);
}
outFragColor = vec4(nextOrbColor, 1.0);
return;
}
}
if (taa_showJitterSequence()) {
float tenPercentHeight = 0.1 * imageSize.y;
vec2 jitterRegionSize = vec2(tenPercentHeight);
vec2 jitterRegionPos = (pixPos - vec2(tenPercentHeight, imageSize.y - tenPercentHeight));
if ((all(lessThan(jitterRegionPos, jitterRegionSize)) && all(greaterThan(jitterRegionPos, vec2(0.0))))) {
vec3 speedColor = taa_getVelocityColorRelative(cursorToFragLength);
float niceDotR2 = 4;
outFragColor = vec4(speedColor, 1.0);
return;
}
}
for (int s = 0; s < SEQUENCE_LENGTH; s++) {
vec2 pixToSampleVec = jitterRegionPos - (vec2(0.5) + taa_getJitterSample(s)) * jitterRegionSize;
float radius2 = (s == sequence.currentIndex ? 2.0 * niceDotR2 : niceDotR2);
if (dot(pixToSampleVec, pixToSampleVec) < radius2) {
outFragColor = vec4(colorRamp(float(s) / float(SEQUENCE_LENGTH)), 1.0);
return;
}
}
float tenPercentHeight = 0.1 * imageSize.y;
float centerWidth = imageSize.x * 0.5;
vec2 nextOrbPos = vec2(centerWidth, imageSize.y - 3 * tenPercentHeight);
vec2 nextOrbPosToPix = pixPos - nextOrbPos;
float nextOrbPosToPixLength = length(nextOrbPosToPix);
vec2 prevOrbPos = nextOrbPos - cursorVelocityDir * 2.0 * tenPercentHeight;
vec2 prevOrbPosToPix = pixPos - prevOrbPos;
float prevOrbPosToPixLength = length(prevOrbPosToPix);
if ((prevOrbPosToPixLength < tenPercentHeight) && (cursorVelocityLength > 0.5)) {
vec2 prevOrbPosToPix_uv = cursorPrevUV + prevOrbPosToPix * getInvWidthHeight() / taa_getDebugOrbZoom();
vec3 preOrbColor = vec3(0.0);
if (!(any(lessThan(prevOrbPosToPix_uv, vec2(0.0))) || any(greaterThan(prevOrbPosToPix_uv, vec2(1.0))))) {
preOrbColor = texture(historyMap, prevOrbPosToPix_uv).xyz;
}
if (prevOrbPosToPixLength < 2.0) {
preOrbColor = vec3(1.0, 0.0, 1.0);
}
float distanceToNext = length(imageSize * (cursorUV - prevOrbPosToPix_uv));
if (distanceToNext < 2.0) {
preOrbColor = vec3(1.0, 0.5, 0.0);
}
outFragColor = vec4(preOrbColor, 1.0);
return;
}
if (nextOrbPosToPixLength < tenPercentHeight) {
vec2 nextOrbPosToPix_uv = cursorUV + nextOrbPosToPix * getInvWidthHeight() / taa_getDebugOrbZoom();
vec3 nextOrbColor = vec3(0.0);
if (!(any(lessThan(nextOrbPosToPix_uv, vec2(0.0))) || any(greaterThan(nextOrbPosToPix_uv, vec2(1.0))))) {
nextOrbColor = texture(nextMap, nextOrbPosToPix_uv).xyz;
}
float distanceToPrev = length(imageSize * (cursorPrevUV - nextOrbPosToPix_uv));
if (distanceToPrev < 2.0) {
nextOrbColor = vec3(1.0, 0.0, 1.0);
}
if (nextOrbPosToPixLength < 2.0) {
nextOrbColor = vec3(1.0, 0.5, 0.0);
}
outFragColor = vec4(nextOrbColor, 1.0);
return;
}
// Debug region before debugX
@ -116,10 +139,14 @@ void main(void) {
return;
}
vec3 fragUV = taa_findClosestFragment3x3(varTexCoord0);
outFragColor = vec4((fragUV.xy - varTexCoord0) * imageSize * 0.5 + vec2(0.5), 0.0, 1.0);
return;
if (taa_showClosestFragment()) {
vec3 fragUV = taa_findClosestFragment3x3(varTexCoord0);
outFragColor = vec4((fragUV.xy - varTexCoord0) * imageSize * 0.5 + vec2(0.5), 0.0, 1.0);
return;
}
outFragColor = vec4(nextColor, 1.0);
vec3 prevColor = nextColor;

View file

@ -46,15 +46,29 @@ Rectangle {
max: 1.0
min: 0.0
}
CheckBox {
text: "Debug"
checked: Render.getConfig("RenderMainView.Antialiasing")["debug"]
onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["debug"] = checked }
Row {
CheckBox {
text: "Unjitter"
checked: Render.getConfig("RenderMainView.Antialiasing")["unjitter"]
onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["unjitter"] = checked }
}
}
CheckBox {
text: "Freeze "
checked: Render.getConfig("RenderMainView.JitterCam")["freeze"]
onCheckedChanged: { Render.getConfig("RenderMainView.JitterCam")["freeze"] = checked }
Row {
CheckBox {
text: "Debug"
checked: Render.getConfig("RenderMainView.Antialiasing")["debug"]
onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["debug"] = checked }
}
CheckBox {
text: "Freeze "
checked: Render.getConfig("RenderMainView.JitterCam")["freeze"]
onCheckedChanged: { Render.getConfig("RenderMainView.JitterCam")["freeze"] = checked }
}
CheckBox {
text: "Show Debug Cursor"
checked: Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"]
onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"] = checked }
}
}
ConfigSlider {
label: qsTr("Debug X")
@ -64,6 +78,18 @@ Rectangle {
max: 1.0
min: 0.0
}
Row {
CheckBox {
text: "Jitter Sequence"
checked: Render.getConfig("RenderMainView.Antialiasing")["showJitterSequence"]
onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showJitterSequence"] = checked }
}
CheckBox {
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