SHARING: Temporal Anti-Aliasing (TAA) fx for jit.gl.pass

Matteo Marson's icon

Matteo Marson

4月 11 2023 | 4:49 午後

Hey folks,

Some time ago, the Jitter team and I presented some new Jitter objects and functionalities we've been working on (video here). Much of the stuff presented there has already been released, but the temporal anti-aliasing FX didn't make it in the latest Max updates (for several reasons). We decided to share this pass fx for those interested while waiting for it to be included as a built-in tool in the next Max versions.

TAA
Temporal anti-aliasing (TAA) is a spatial anti-aliasing technique for computer-generated video that combines information from past frames and the current frame to remove jaggies in the current frame. In TAA, each pixel is sampled once per frame, but in each frame, the sample is at a different location within the pixel (sub-pixel jittering). Pixels sampled in past frames are blended with pixels sampled in the current frame to produce an anti-aliased image.

The shader named "getGeometry.jxs" applies a sub-pixel jittering to the geometry (in the vertex shader), while "TAA.jxs," contained in the jit.gl.pass effect named "taa.jxp", accumulates and averages the samples over multiple frames.

I hope this patch can serve as a starting point for implementing this terrific anti-aliasing technique in your projects and as an invitation to explore jit.gl.pass functionalities to their full potential.

Cheers!

Temporal Anti-Aliasing (TAA).zip
application/zip 6.86 KB
Temporal Anti-Aliasing FX for jit.gl.pass

Curveau's icon

Curveau

4月 11 2023 | 7:50 午後

Very cool - thanks Matteo!

MakePatchesNotWar's icon

MakePatchesNotWar

4月 12 2023 | 7:02 午後

Thanks! Really appreciate all the attention Jitter has been getting lately!

Herr Markant's icon

Herr Markant

4月 13 2023 | 10:47 午後

To this day I don't quite understand why I should use gl.pass, and why I shouldn't just put a simple fragment shader in / after the scene. Please tell me what's the benfit, and how it will help me CPU/GPU wise.
For my understanding, I can add a fragment shader to a model / mesh without affecting the whole scene?
(Usualy I just work with fragment shaders specialized in feedback fx)

Matteo Marson's icon

Matteo Marson

4月 14 2023 | 9:05 午前

Hi Herr,

there's no significant performance benefit in using jit.gl.pass over a subpatcher with some jit.gl.slab objects. You can replicate any pass fx connecting the shaders it contains in the main patch.
The point with jit.gl.pass is mainly the clarity and re-usability of the code:

1) in most cases, jit.gl.pass is used to implement post-processing effects that require multiple target rendering (aka jit.node @capture > 1). The names of the rendered textures are packed in a list.

With jit.gl.pass, you can parse the list of textures using meaningful names (such as COLOR, NORMAL, VELOCITY, etc...)

2) Since a pretty recent update (I don't remember the exact version), jit.gl.pass has expanded its routing capabilities; now, it's possible to create feedback connections and potentially complex routing schemes within the pass fx.

<input subpass="mysubpass" output="1" history="1" />

Look at the reference page and see jit.gl.pass @fxname tssao-gi-ssr for an example

3) You can set default values very easily (without loadbang/mess), and you can use attrui objects to change the uniforms

At the end of the day, jit.gl.pass is not different from what you can do with single jit.gl.slab objects. Still, building complex effects is easier while keeping everything in one place and relying on textual coding rather than objects and patchcoords (IMO).
Besides, it makes complex post-processing effects accessible to Jitter newcomers.

👽'tW∆s ∆lienz👽's icon

👽'tW∆s ∆lienz👽

4月 14 2023 | 2:43 午後

<input subpass="mysubpass" output="1" history="1" />

woah, i didn't realize this.

indeed, jitter newcomers can get away with alot using gl.pass these days, i'll definitely clean this up and be more exact now that i know the above trick:

Thank You again for so much awesome Jitter englightenment these days(it is definitely a more difficult environ for me than most: not counting how difficult it is to constantly instantiate objects with so many attributes typed into them(and when you change one you have to rescale the entire object), there's so much that's not documented in the usual way, or documented all over the place in many different ways, i feel i have to search really hard for all the tricks, lately these threads and tutorials have been helping more). Much appreciated :)

Herr Markant's icon

Herr Markant

5月 10 2023 | 2:11 午後

Matteo Marson I slowly begin to understand.. Thank you for the clarification..