mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:24:22 +02:00
Some more refinment, no clear changes though
This commit is contained in:
parent
66d35118cb
commit
af09ae0686
4 changed files with 29 additions and 25 deletions
|
@ -19,21 +19,26 @@ in vec2 varTexCoord0;
|
|||
layout(location = 0) out vec4 outFragColor;
|
||||
|
||||
void main() {
|
||||
vec2 texelSize = getInvWidthHeight();
|
||||
vec2 fragUV = varTexCoord0;
|
||||
|
||||
vec2 texelSize = getInvWidthHeight();
|
||||
vec2 fragJitterPix = taa_getJitterSample(sequence.currentIndex);
|
||||
if (taa_unjitter()) {
|
||||
fragUV -= taa_getJitterSample(sequence.currentIndex) * texelSize;
|
||||
fragUV -= fragJitterPix * texelSize;
|
||||
}
|
||||
|
||||
vec3 nearFragUV = taa_findClosestFragment3x3(fragUV);
|
||||
vec2 fragVel = taa_fetchVelocityMap(nearFragUV.xy);
|
||||
|
||||
/*vec3 sourceColor;
|
||||
vec3 sourceColor;
|
||||
vec3 historyColor;
|
||||
vec2 prevFragUV = taa_fetchSourceAndHistory(fragUV, fragVel, sourceColor, historyColor);
|
||||
vec3 nextColor = mix(historyColor, sourceColor, params.blend);
|
||||
*/
|
||||
vec3 nextColor = taa_temporalReprojection(fragUV, fragVel, nearFragUV.z);
|
||||
|
||||
vec3 nextColor = mix(historyColor, sourceColor, params.blend);
|
||||
|
||||
if (taa_constrainColor()) {
|
||||
nextColor = taa_temporalReprojection(sourceColor, historyColor, fragUV, fragVel, nearFragUV.z, fragJitterPix);
|
||||
}
|
||||
|
||||
outFragColor = vec4(nextColor, 1.0);
|
||||
}
|
||||
|
|
|
@ -182,21 +182,17 @@ float Luminance(vec3 rgb) {
|
|||
return rgb.x/4.0 + rgb.y/2.0 + rgb.z/4.0;
|
||||
}
|
||||
|
||||
vec3 taa_temporalReprojection(vec2 fragUV, vec2 fragVelocity, float fragZe)
|
||||
vec3 taa_temporalReprojection(vec3 sourceColor, vec3 historyColor, vec2 fragUV, vec2 fragVelocity, float fragZe, vec2 fragJitterPix)
|
||||
{
|
||||
vec3 sourceColor;
|
||||
vec3 historyColor;
|
||||
vec2 prevFragUV = taa_fetchSourceAndHistory(fragUV, fragVelocity, sourceColor, historyColor);
|
||||
|
||||
vec4 texel1 = vec4(historyColor, 1.0);
|
||||
vec4 texel0 = vec4(sourceColor, 1.0);
|
||||
|
||||
vec2 imageSize = getWidthHeight(0);
|
||||
vec2 texelSize = getInvWidthHeight();
|
||||
|
||||
if (taa_unjitter()) {
|
||||
fragUV += taa_getJitterSample(sequence.currentIndex) * texelSize;
|
||||
}
|
||||
/* if (taa_unjitter()) {
|
||||
fragUV += fragJitterPix * texelSize;
|
||||
}*/
|
||||
|
||||
const float _SubpixelThreshold = 0.5;
|
||||
const float _GatherBase = 0.5;
|
||||
|
@ -256,10 +252,6 @@ vec3 taa_temporalReprojection(vec2 fragUV, vec2 fragVelocity, float fragZe)
|
|||
// output
|
||||
vec3 nextColor = mix(texel1, texel0, k_feedback).xyz;
|
||||
|
||||
if (!taa_constrainColor()) {
|
||||
nextColor = mix(historyColor, sourceColor, params.blend);
|
||||
}
|
||||
|
||||
return taa_resolveColor(nextColor);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@ void main(void) {
|
|||
vec2 imageSize = getWidthHeight(0);
|
||||
vec2 texelSize = getInvWidthHeight();
|
||||
|
||||
vec2 fragJitterPix = taa_getJitterSample(sequence.currentIndex);
|
||||
|
||||
|
||||
|
||||
vec2 pixPos = varTexCoord0 * imageSize;
|
||||
vec2 pixVelocity = imageSize * texture(velocityMap, varTexCoord0).xy;
|
||||
float pixVelocityLength = length(pixVelocity);
|
||||
|
@ -37,16 +41,18 @@ void main(void) {
|
|||
|
||||
// Pixel Debugged
|
||||
if (taa_showDebugCursor()) {
|
||||
vec3 cursorFrag = taa_findClosestFragment3x3(taa_getDebugCursorTexcoord());
|
||||
vec2 cursorUV = cursorFrag.xy;
|
||||
vec2 cursorPixelPos = cursorUV * imageSize;
|
||||
vec2 cursorUVRaw = taa_getDebugCursorTexcoord();
|
||||
vec2 cursorPosRaw = floor(cursorUVRaw * imageSize) + vec2(0.5);
|
||||
vec3 cursorFrag = taa_findClosestFragment3x3(cursorUVRaw);
|
||||
vec2 cursorUV = cursorFrag.xy - fragJitterPix * texelSize;
|
||||
vec2 cursorPos = 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;
|
||||
vec2 cursorToFragVec = pixPos - cursorPos;
|
||||
float cursorToFragLength = length(cursorToFragVec);
|
||||
|
||||
if ((cursorToFragLength <= cursorVelocityLength)) {
|
||||
|
@ -65,7 +71,8 @@ void main(void) {
|
|||
float tenPercentHeight = 0.1 * imageSize.y;
|
||||
float centerWidth = imageSize.x * 0.5;
|
||||
|
||||
vec2 nextOrbPos = vec2(centerWidth, imageSize.y - 3 * tenPercentHeight);
|
||||
//vec2 nextOrbPos = vec2(centerWidth, imageSize.y - 3 * tenPercentHeight);
|
||||
vec2 nextOrbPos = cursorPos;
|
||||
vec2 nextOrbPosToPix = pixPos - nextOrbPos;
|
||||
float nextOrbPosToPixLength = length(nextOrbPosToPix);
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@
|
|||
});
|
||||
|
||||
function setDebugCursor(x, y) {
|
||||
nx = (x / Window.innerWidth);
|
||||
ny = 1.0 - ((y) / (Window.innerHeight - 32));
|
||||
nx = ((x + 0.5) / Window.innerWidth);
|
||||
ny = 1.0 - ((y + 0.5) / (Window.innerHeight));
|
||||
|
||||
Render.getConfig("RenderMainView").getConfig("Antialiasing").debugCursorTexcoord = { x: nx, y: ny };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue