Announcement

Collapse
No announcement yet.

Temporal AA sharpening

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Temporal AA sharpening

    Updated 03.09.2017
    Rewrote most of the code and put it into separate files.


    I've added a step to the TAA post process that sharpens the image without destroying the initial TAA result.
    It produces sharp textures while preserving smooth edges on foliage, characters etc..

    r.TemporalAASharpen between 0.1 and 0.3 gives good natural results. https://imgsli.com/MDc2MA
    It produces sharp textures without the edge artifacts that Tonemapper.Sharpen does. https://imgsli.com/MDc1OA


    How it works
    It creates a temporally stable depth mask (https://imgsli.com/MDc2MQ) that is used to blend out edges that should not be sharpened.
    It also uses the color contrast to create a secondary mask (https://imgsli.com/MDc2Mg) that is used to blend out high contrast pixels. This mask is very subtle, and helps to avoid sharpening already high contrast pixels that usually results in white or black borders. (Zoom in: https://imgsli.com/MDc1OA)





    Installation
    4.17 version: https://github.com/hallatore/UnrealE...A_Sharpen_4.17
    4.16 version: https://github.com/hallatore/UnrealE...A_Sharpen_4.16
    4.15 version: https://github.com/hallatore/UnrealE...A_Sharpen_4.15
    1. Add the changes from the latest commit.
    2. Run GenerateProjectFiles to update the solution with the new files.
    3. Build the solution.
    Last edited by hallatore; 09-18-2017, 03:01 AM.

    #2
    Here are some screenshots with extreme values.

    Comment


      #3
      I'm hoping to give this a go tomorrow or this weekend some time (I just upgraded my fork to 4.17.1 so I am tired of engine builds for the day), but nice work, this looks rad. Does it hold up in-motion, since that's largely where TAA is at its worst.
      Trent Polack (@mittense)
      Personal Site | Development Blog | Joy Machine

      Comment


        #4
        Have been coming across these same things on my own project, trying to compromise between AA types and how it affects art, ghosting, etc. I think I've come to a compromise but, I would like to try out your settings, unfortunately the page returns with a 404 page not found error. Also was curious, did you make all of this through blueprint with console commands or was it some kind of material programming and/or coding?

        Comment


          #5
          Originally posted by mittense View Post
          I'm hoping to give this a go tomorrow or this weekend some time (I just upgraded my fork to 4.17.1 so I am tired of engine builds for the day), but nice work, this looks rad. Does it hold up in-motion, since that's largely where TAA is at its worst.
          It's run right after TAA every frame, so it should do a good job every frame. It won't remove stuff like ghosting though, that can be dealt with by other settings/tweaks.

          Originally posted by Grayve Rose View Post
          Have been coming across these same things on my own project, trying to compromise between AA types and how it affects art, ghosting, etc. I think I've come to a compromise but, I would like to try out your settings, unfortunately the page returns with a 404 page not found error. Also was curious, did you make all of this through blueprint with console commands or was it some kind of material programming and/or coding?
          You need to be signed into github and have access to the UnreanEngine repo. This is a tweak to the core engine, not a blueprint or material.

          Comment


            #6
            Updated the code with the console variable r.TemporalAADynamicSharpen. 0.2 - 0.25 is about the same as with no AA, but works quite a bit higher.
            It's more forgiving than normal sharpen with extreme values.
            Last edited by hallatore; 08-18-2017, 02:17 AM.

            Comment


              #7
              Could you show some screenshots comparing this to this? https://forums.unrealengine.com/show...ponsive-scenes
              Easy to use UMG Mini Map on the UE4 Marketplace.
              Forum thread: https://forums.unrealengine.com/show...-Plug-and-Play

              Comment


                #8
                Originally posted by John Alcatraz View Post
                Could you show some screenshots comparing this to this? https://forums.unrealengine.com/show...ponsive-scenes
                That one is for ghosting when you move the camera around. This is for the the blurry textures you get from TAA.
                They solve different problems, but I think they could work well together.

                Comment


                  #9
                  One thing I'd recommend is to cap your changes with

                  Code:
                  // TAACHANGE_Begin.
                  <RAWR>
                  // TAACHANGE_End.
                  It makes it a lot easier for people to integrate changes.
                  Trent Polack (@mittense)
                  Personal Site | Development Blog | Joy Machine

                  Comment


                    #10
                    Originally posted by hallatore View Post
                    That one is for ghosting when you move the camera around. This is for the the blurry textures you get from TAA.
                    They solve different problems, but I think they could work well together.
                    I think the other one is also for making the scene appear more sharp.

                    How well does your sharpening work with SSAO? The tonemapper sharpen makes the SSAO very noisy again.

                    Originally posted by mittense View Post
                    It makes it a lot easier for people to integrate changes.
                    Why would those comments be needed? You see the commits he made, so you can just merge those commits and its clear what changed in those. I think comments in the code indicating where something was changed would just make it ugly.
                    Easy to use UMG Mini Map on the UE4 Marketplace.
                    Forum thread: https://forums.unrealengine.com/show...-Plug-and-Play

                    Comment


                      #11
                      Originally posted by John Alcatraz View Post
                      I think the other one is also for making the scene appear more sharp.
                      How well does your sharpening work with SSAO? The tonemapper sharpen makes the SSAO very noisy again.
                      The other changes make the scene more sharp when you move around. I don't think it should change the sharpness when the camera is stationary?
                      This method should have no effect on SSAO. Try it out!


                      I want eventually want to submit this as a pull request. Comments would be nice if it was just for custom integration.
                      Will still have to clean up some of the code, it's not done yet.

                      Comment


                        #12
                        Originally posted by John Alcatraz View Post
                        Why would those comments be needed? You see the commits he made, so you can just merge those commits and its clear what changed in those. I think comments in the code indicating where something was changed would just make it ugly.
                        Because, as time goes on, it becomes a lot more difficult for that to be viable, especially when working within epic forks.

                        It's also a general convention for any third-party engine alterations.
                        Trent Polack (@mittense)
                        Personal Site | Development Blog | Joy Machine

                        Comment


                          #13
                          Originally posted by mittense View Post
                          It's also a general convention for any third-party engine alterations.
                          Any good docs on conventions? Just done minor pull requests that didn't need any commenting.
                          Got any examples in the current source?

                          Comment


                            #14
                            Originally posted by hallatore View Post
                            Any good docs on conventions? Just done minor pull requests that didn't need any commenting.
                            Got any examples in the current source?
                            You wouldn't want to do this in a pull request to Epic proper, but until then, this is an example of how NVIDIA handles it:

                            Code:
                            // NVCHANGE_BEGIN: Nvidia Volumetric Lighting
                            #if WITH_NVVOLUMETRICLIGHTING
                            	NVVolumetricLightingBeginAccumulation( RHICmdList );
                            #endif
                            // NVCHANGE_END: Nvidia Volumetric Lighting
                            Trent Polack (@mittense)
                            Personal Site | Development Blog | Joy Machine

                            Comment


                              #15
                              Originally posted by mittense View Post
                              You wouldn't want to do this in a pull request to Epic proper, but until then, this is an example of how NVIDIA handles it:
                              OK thanks.

                              Would love to get some feedback on the code also. Haven't written any C++ or shader code before, so most of the .cpp stuff is just guessing.

                              Comment

                              Working...
                              X