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

View file

@ -18,17 +18,67 @@
#include "DeferredFrameTransform.h" #include "DeferredFrameTransform.h"
#include "VelocityBufferPass.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 { class AntialiasingConfig : public render::Job::Config {
Q_OBJECT Q_OBJECT
Q_PROPERTY(float blend MEMBER blend NOTIFY dirty) Q_PROPERTY(float blend MEMBER blend NOTIFY dirty)
Q_PROPERTY(float velocityScale MEMBER velocityScale 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(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 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)
Q_PROPERTY(float debugOrbZoom MEMBER debugOrbZoom 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: public:
AntialiasingConfig() : render::Job::Config(true) {} AntialiasingConfig() : render::Job::Config(true) {}
@ -40,13 +90,19 @@ public:
glm::vec2 debugCursorTexcoord{ 0.5f, 0.5f }; glm::vec2 debugCursorTexcoord{ 0.5f, 0.5f };
float debugOrbZoom{ 2.0f }; float debugOrbZoom{ 2.0f };
bool unjitter{ true };
bool debug { false }; bool debug { false };
bool showCursorPixel { false }; bool showCursorPixel { false };
bool showJitterSequence{ false };
bool showClosestFragment{ false };
signals: signals:
void dirty(); void dirty();
}; };
#define SET_BIT(bitfield, bitIndex, value) bitfield = ((bitfield) & ~(1 << (bitIndex))) | ((value) << (bitIndex))
#define GET_BIT(bitfield, bitIndex) ((bitfield) & (1 << (bitIndex)))
struct TAAParams { struct TAAParams {
float debugX{ 0.0f }; float debugX{ 0.0f };
@ -54,11 +110,18 @@ struct TAAParams {
float velocityScale{ 1.0f }; float velocityScale{ 1.0f };
float debugShowVelocityThreshold{ 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 }; glm::vec4 pixelInfo{ 0.5f, 0.5f, 2.0f, 0.0f };
void setDebug(bool enabled) { debug.x = (float)enabled; } void setUnjitter(bool enabled) { SET_BIT(debug.y, 0, enabled); }
bool isDebug() const { return (bool) debug.x; } 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; } void setDebugCursor(glm::vec2 debugCursor) { pixelInfo.x = debugCursor.x; pixelInfo.y = debugCursor.y; }
glm::vec2 getDebugCursor() const { return glm::vec2(pixelInfo.x, pixelInfo.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; } void setDebugOrbZoom(float orbZoom) { pixelInfo.z = orbZoom; }
float getDebugOrbZoom() const { return pixelInfo.z; } 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>; using TAAParamsBuffer = gpu::StructBuffer<TAAParams>;
class Antialiasing { class Antialiasing {
public: 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 Config = AntialiasingConfig;
using JobModel = render::Job::ModelI<Antialiasing, Inputs, Config>; using JobModel = render::Job::ModelI<Antialiasing, Inputs, Config>;
@ -136,45 +203,5 @@ private:
int _geometryId { 0 }; 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 #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 // 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); task.addJob<Antialiasing>("Antialiasing", antialiasingInputs);

View file

@ -19,10 +19,12 @@ in vec2 varTexCoord0;
layout(location = 0) out vec4 outFragColor; layout(location = 0) out vec4 outFragColor;
void main() { 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 fragVel = taa_fetchVelocityMap(nearFragUV.xy);
vec2 fragUV = varTexCoord0;
/*vec3 sourceColor; /*vec3 sourceColor;
vec3 historyColor; vec3 historyColor;

View file

@ -13,6 +13,20 @@
<@include DeferredTransform.slh@> <@include DeferredTransform.slh@>
<$declareDeferredFrameTransform()$> <$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@> <@include gpu/Color.slh@>
uniform sampler2D depthMap; uniform sampler2D depthMap;
@ -27,7 +41,7 @@ struct TAAParams
float blend; float blend;
float motionScale; float motionScale;
float debugShowVelocityThreshold; float debugShowVelocityThreshold;
vec4 debugCursor; ivec4 debug;
vec4 pixelInfo_orbZoom; vec4 pixelInfo_orbZoom;
}; };
@ -35,6 +49,26 @@ layout(std140) uniform taaParamsBuffer {
TAAParams params; 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() { vec2 taa_getDebugCursorTexcoord() {
return params.pixelInfo_orbZoom.xy; 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) { vec2 taa_fetchSourceAndHistory(vec2 fragUV, vec2 fragVelocity, out vec3 sourceColor, out vec3 historyColor) {
sourceColor = taa_fetchSourceMap(fragUV).xyz; sourceColor = taa_fetchSourceMap(fragUV).xyz;
vec2 prevFragUV = fragUV - fragVelocity; vec2 prevFragUV = fragUV - fragVelocity;
historyColor = sourceColor; historyColor = sourceColor;
if (!(any(lessThan(prevFragUV, vec2(0.0))) || any(greaterThan(prevFragUV, vec2(1.0))))) { if (!(any(lessThan(prevFragUV, vec2(0.0))) || any(greaterThan(prevFragUV, vec2(1.0))))) {
@ -156,6 +191,7 @@ vec3 taa_temporalReprojection(vec2 fragUV, vec2 fragVelocity, float fragZe)
vec2 imageSize = getWidthHeight(0); vec2 imageSize = getWidthHeight(0);
vec2 texelSize = getInvWidthHeight(); vec2 texelSize = getInvWidthHeight();
fragUV += float(taa_unjitter()) * taa_getJitterSample(sequence.currentIndex) * texelSize;
const float _SubpixelThreshold = 0.5; const float _SubpixelThreshold = 0.5;
const float _GatherBase = 0.5; const float _GatherBase = 0.5;
@ -213,7 +249,7 @@ vec2 texelSize = getInvWidthHeight();
float k_feedback = mix(_FeedbackMin, _FeedbackMax, unbiased_weight_sqr); float k_feedback = mix(_FeedbackMin, _FeedbackMax, unbiased_weight_sqr);
// output // output
vec3 nextColor = mix(texel0, texel1, k_feedback).xyz; vec3 nextColor = mix(texel1, texel0, k_feedback).xyz;
// vec3 nextColor = mix(texel0, texel1, params.blend); // vec3 nextColor = mix(texel0, texel1, params.blend);

View file

@ -26,15 +26,17 @@ void main(void) {
vec3 sourceColor = texture(sourceMap, varTexCoord0).xyz; vec3 sourceColor = texture(sourceMap, varTexCoord0).xyz;
vec2 imageSize = getWidthHeight(0); vec2 imageSize = getWidthHeight(0);
vec2 texelSize = getInvWidthHeight();
vec2 pixPos = varTexCoord0 * imageSize; vec2 pixPos = varTexCoord0 * imageSize;
vec2 pixVelocity = imageSize * texture(velocityMap, varTexCoord0).xy; vec2 pixVelocity = imageSize * texture(velocityMap, varTexCoord0).xy;
float pixVelocityLength = length(pixVelocity); float pixVelocityLength = length(pixVelocity);
vec2 velocity = params.motionScale * pixVelocity * getInvWidthHeight(); vec2 velocity = params.motionScale * pixVelocity * texelSize;
vec2 prevTexCoord = varTexCoord0 - velocity; vec2 prevTexCoord = varTexCoord0 - velocity;
vec2 prevPix = prevTexCoord * imageSize; vec2 prevPix = prevTexCoord * imageSize;
// Pixel Debugged // Pixel Debugged
if (taa_showDebugCursor()) {
vec3 cursorFrag = taa_findClosestFragment3x3(taa_getDebugCursorTexcoord()); vec3 cursorFrag = taa_findClosestFragment3x3(taa_getDebugCursorTexcoord());
vec2 cursorUV = cursorFrag.xy; vec2 cursorUV = cursorFrag.xy;
vec2 cursorPixelPos = cursorUV * imageSize; vec2 cursorPixelPos = cursorUV * imageSize;
@ -72,7 +74,7 @@ void main(void) {
float prevOrbPosToPixLength = length(prevOrbPosToPix); float prevOrbPosToPixLength = length(prevOrbPosToPix);
if ((prevOrbPosToPixLength < tenPercentHeight) && (cursorVelocityLength > 0.5)) { if ((prevOrbPosToPixLength < tenPercentHeight) && (cursorVelocityLength > 0.5)) {
vec2 prevOrbPosToPix_uv = cursorPrevUV + prevOrbPosToPix * getInvWidthHeight() / taa_getDebugOrbZoom(); vec2 prevOrbPosToPix_uv = cursorPrevUV + prevOrbPosToPix * texelSize / taa_getDebugOrbZoom();
vec3 preOrbColor = vec3(0.0); vec3 preOrbColor = vec3(0.0);
if (!(any(lessThan(prevOrbPosToPix_uv, vec2(0.0))) || any(greaterThan(prevOrbPosToPix_uv, vec2(1.0))))) { if (!(any(lessThan(prevOrbPosToPix_uv, vec2(0.0))) || any(greaterThan(prevOrbPosToPix_uv, vec2(1.0))))) {
preOrbColor = texture(historyMap, prevOrbPosToPix_uv).xyz; preOrbColor = texture(historyMap, prevOrbPosToPix_uv).xyz;
@ -88,7 +90,7 @@ void main(void) {
return; return;
} }
if (nextOrbPosToPixLength < tenPercentHeight) { if (nextOrbPosToPixLength < tenPercentHeight) {
vec2 nextOrbPosToPix_uv = cursorUV + nextOrbPosToPix * getInvWidthHeight() / taa_getDebugOrbZoom(); vec2 nextOrbPosToPix_uv = cursorUV + nextOrbPosToPix * texelSize / taa_getDebugOrbZoom();
vec3 nextOrbColor = vec3(0.0); vec3 nextOrbColor = vec3(0.0);
if (!(any(lessThan(nextOrbPosToPix_uv, vec2(0.0))) || any(greaterThan(nextOrbPosToPix_uv, vec2(1.0))))) { if (!(any(lessThan(nextOrbPosToPix_uv, vec2(0.0))) || any(greaterThan(nextOrbPosToPix_uv, vec2(1.0))))) {
nextOrbColor = texture(nextMap, nextOrbPosToPix_uv).xyz; nextOrbColor = texture(nextMap, nextOrbPosToPix_uv).xyz;
@ -104,6 +106,27 @@ void main(void) {
outFragColor = vec4(nextOrbColor, 1.0); outFragColor = vec4(nextOrbColor, 1.0);
return; 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))))) {
float niceDotR2 = 4;
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;
}
}
}
}
// Debug region before debugX // Debug region before debugX
if (varTexCoord0.x > params.debugX) { if (varTexCoord0.x > params.debugX) {
@ -116,10 +139,14 @@ void main(void) {
return; return;
} }
if (taa_showClosestFragment()) {
vec3 fragUV = taa_findClosestFragment3x3(varTexCoord0); vec3 fragUV = taa_findClosestFragment3x3(varTexCoord0);
outFragColor = vec4((fragUV.xy - varTexCoord0) * imageSize * 0.5 + vec2(0.5), 0.0, 1.0); outFragColor = vec4((fragUV.xy - varTexCoord0) * imageSize * 0.5 + vec2(0.5), 0.0, 1.0);
return; return;
}
outFragColor = vec4(nextColor, 1.0); outFragColor = vec4(nextColor, 1.0);
vec3 prevColor = nextColor; vec3 prevColor = nextColor;

View file

@ -46,6 +46,14 @@ Rectangle {
max: 1.0 max: 1.0
min: 0.0 min: 0.0
} }
Row {
CheckBox {
text: "Unjitter"
checked: Render.getConfig("RenderMainView.Antialiasing")["unjitter"]
onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["unjitter"] = checked }
}
}
Row {
CheckBox { CheckBox {
text: "Debug" text: "Debug"
checked: Render.getConfig("RenderMainView.Antialiasing")["debug"] checked: Render.getConfig("RenderMainView.Antialiasing")["debug"]
@ -56,6 +64,12 @@ Rectangle {
checked: Render.getConfig("RenderMainView.JitterCam")["freeze"] checked: Render.getConfig("RenderMainView.JitterCam")["freeze"]
onCheckedChanged: { Render.getConfig("RenderMainView.JitterCam")["freeze"] = checked } 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 { ConfigSlider {
label: qsTr("Debug X") label: qsTr("Debug X")
integral: false integral: false
@ -64,6 +78,18 @@ Rectangle {
max: 1.0 max: 1.0
min: 0.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 { ConfigSlider {
label: qsTr("Debug Velocity Threshold [pix]") label: qsTr("Debug Velocity Threshold [pix]")
integral: false integral: false