Search Unity

Temporal AA Dithering

Discussion in 'High Definition Render Pipeline' started by Reanimate_L, Jul 6, 2021.

  1. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Is there a way to do Temporal AA dithering in HDRP with shadergraph?
    Not sure if i missed it or not, but it seems i can't fetch TAA_Jitter value from shadergraph, or is shader properties even exist in HDRP? maybe with other name.
     
    Camarent and Win3xploder like this.
  2. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Hi! Did you manage to find a way to access TAA_Jitter inside shadergraph or hlsl?
     
  3. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Sadly no. i guess it's just doesn't exist in shadergraph.
     
  4. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Oh! I manage to find it. It actually exists in ShaderVariablesGlobal.cs (and hlsl version of it - ShaderVariablesGlobal.cs.hlsl). So what you are looking for is
    Code (CSharp):
    1. // TAA Frame Index ranges from 0 to 7.
    2.         public Vector4 _TaaFrameInfo;               // { taaSharpenStrength, unused, taaFrameIndex, taaEnabled ? 1 : 0 }
    3.  
    4.         // Current jitter strength (0 if TAA is disabled)
    5.         public Vector4 _TaaJitterStrength;          // { x, y, x/width, y/height }
    I used custom function node to access it. It works without any additional includes but rider does not know about it but it works =)
    upload_2021-10-21_11-44-16.png
     
  5. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Oh it called _TaaFrameInfo?. Nice find man. . .
    any chance to share the Custom Function code?
     
  6. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Here is subgraph that I created for exposing those parameters
     

    Attached Files:

    Reanimate_L likes this.
  7. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    That's how it looks like
    upload_2021-10-21_18-56-11.png
     
    DiaryChris, Reanimate_L and PutridEx like this.
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    @Camarent Superb, Thanks a lot!!!! :)
    I'll try it out
     
  9. DiaryChris

    DiaryChris

    Joined:
    Nov 13, 2018
    Posts:
    3
    I had found it too. But after that, I met the error " undeclared identifier '_TaaFrameInfo' ". how did you solve it?
     
  10. DiaryChris

    DiaryChris

    Joined:
    Nov 13, 2018
    Posts:
    3
    I found that there is no error in the inspector window, though there are several errors in the graph. But it eventually works.
     
  11. Win3xploder

    Win3xploder

    Joined:
    Dec 5, 2014
    Posts:
    161
    How do I use the subgraph to implement temporal dithering?
     
    Last edited: Mar 19, 2022
  12. Win3xploder

    Win3xploder

    Joined:
    Dec 5, 2014
    Posts:
    161
    I understand that I need to move the dither pattern around in order to affect the average temporal sampled pixel, but I can't figure it out.