Page 1 of 6

[FO4/SSE] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 15:58
by kingeric1992
SMAA 1x for 0.288+
Image

Code: Select all

/*===========================================================================================
 *                                 file descriptions
=============================================================================================
 * implemented to enbeffectpostpass.fx by kingeric1992 for Fallout 4 ENB mod 0.288+
 *                                                                      update.  Sep/29/2016
 *      for more detail, visit http://enbseries.enbdev.com/forum/viewtopic.php?f=7&t=4721
 *
 ** Only SMAA 1x is avaliable
 *
 * SMAA T2x requires moving camera in sub pixel jitters.
 * SMAA S2x requires MSAA 2x buffer
 * SMAA 4x  requires both of the above
 *
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 * Usage:
 * add
 *              #define  SMAA_UINAME 0  // 1 == use smaa method independently
 *              #define  PASSNAME0   targetname
 *              #define  PASSNAME1   targetname1
 *              #define  PASSNAME2   targetname2
 *              #include "enbsmaa.fx"
 *                                          at the end of enbeffectpostpass.fx.
 * where the targetname(N) is follow up the technique chain and increment to one before, if
 * the last technique is called THISPASS4, then set targetname to THISPASS5 and the rest with
 * increasing index.  ( targetname index "0" is empty )
 *
 * If you wish to have SMAA as standalone effect that doesn't chain after other technique, set
 * SMAA_UINAME to 1 and have the pass index start from empty (which means "0").
 *
 * in addition, you can change internal rendertarget with :
 * (they will be cleard, so change to other texture if any of the default tex is in used to pass 
 * along data, otherwise, ignore this.)
 *
 *              #define  SMAA_EDGE_TEX      texture0name   // default is RenderTargetRGB32F (only require 2bit-RG channel)
 *              #define  SMAA_BLEND_TEX     texture1name   // default is RenderTargetRGBA64 (requred RGBA [0,1] )
 *
 *                                          prior to inclueing "enbsmaa.fx" 
 *
 * Loading multiple times with different PASSNAME is possible (under same name is not recommended).
 *
==============================================================================================
 *                              Settings
============================================================================================*/

#define SMAA_PRESET      5  // 0 == low, 1 == medium, 2 == high, 3 == ultra, 4 == custom preset, 5 == runtime UI tweak
#define SMAA_PREDICATION 1  // 0 == off, see descriptions below
#define SMAA_EDGE_MODE   0  // 0 == color(quality), 1 == luma, 2 == depth(performance)
#define SMAA_DEBUG       1  // 0 == off, enable additional options to display texture in each stage

THIS IS NOT SMAA 4x, read descriptions above. (☄◣ω◢)☄
parameter descriptions in enbsmaa.fx
enb smaa.zip
Sep/29/2016
(63.85 KiB) Downloaded 2939 times
file history:
Dec/11/2015
**initial upload

Dec/12/2015
**hotfix on typo with rendertarget.

Sep/29/2016
**replace stencil test with alpha, (stencil is not working in previous release, which is causing some extra fps drop)
**various change in macros setup so that the file now use reference SMAA.h.
**added standalone support for enbsmaa.fx (see the demo enbeffectpostpass.fx).
**added constant setting to increase performance if UI tweaker is not required.

Re: [Fallout 4] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 17:38
by --JawZ--
A wonderful addition, now there really is no reason to use ReShade ;)

Re: [Fallout 4] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 17:56
by kingeric1992
--JawZ--
still, it doesn't apply on hud like Reshade and power armor hud looks pretty aliased.

and it can't handle thin lines (such as power cables in a distance) without some of the 4x subpixel feature.


a demo from smaa doc
Image

Re: [Fallout 4] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 18:03
by --JawZ--
SMAA with ReShade, and most other effects that utilize a blur event, causes flickering. So far I have yet to see such flickering being caused when ported to ENBSeries, so that is something I could easily live with, if just to remove the flickering.
SMAA isn't handling thin lines in general very good, from my testing at least.

Just a possible solution, mix in a bit of depth functionality, close depth SMAA x1, far depth SMAA x4.
Not sure how good it would be or how the performance would be affected as this was just a quick "while-reading-comment-post" idea.

Re: [Fallout 4] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 20:05
by MaxG3D
Could you send your postpass? I'm having trouble figuring out how to implement it.

Re: [Fallout 4] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 20:47
by --JawZ--
The instructions for adding it is in the enbsmaa.fx file.

If i'm reading the instructions correct, this should be how it should look with the default enbeffectpostpass.fx.
I have not implemented it yet myself, so might have done something wrong here.

Code: Select all

//+++++++++++++++++++++++++++++
//internal parameters, modify or add new
//+++++++++++++++++++++++++++++
#define  PASSNAME0   TemporaryTarget  // These are the additions to the file
#define  PASSNAME1   TemporaryTarget1  // These are the additions to the file
#define  PASSNAME2   TemporaryTarget2  // These are the additions to the file

-----------------------------

#include "enbsmaa.fx"  // These are the additions to the file

//+++++++++++++++++++++++++++++
//
//+++++++++++++++++++++++++++++
struct VS_INPUT_POST

Re: [Fallout 4] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 21:09
by kingeric1992
file update fix typo. (I need to stop doing that!!)

and the place to add it: any where after this.

Code: Select all

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Techniques are drawn one after another and they use the result of
// the previous technique as input color to the next one.  The number
// of techniques is limited to 255.  If UIName is specified, then it
// is a base technique which may have extra techniques with indexing
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
examples on integrating vanilla enbeffectpostpass.fx

Code: Select all

// if wish to change default render target, need to set here before any enbsmaa.fx includes.
//(currently texture setting is shared between multiple includes, will come up some better idea in future update)
        #define  SMAA_EDGE_TEX      RenderTargetRGBA64     // default is RenderTargetRGB32F (only require RG channel)
        #define  SMAA_BLEND_TEX     RenderTargetRGBA64F  // default is RenderTargetRGBA64 (RGBA requred)

// set sharp amount to 0 to bypass sharpen.
        #define  PASSNAME0   Sharp1
        #define  PASSNAME1   Sharp2
        #define  PASSNAME2   Sharp3
        #include "enbsmaa.fx" 


//adding it to different technique profile in same postpass:
//do not reset texture here. 

        #define  PASSNAME0   TemporaryTarget3
        #define  PASSNAME1   TemporaryTarget4
        #define  PASSNAME2   TemporaryTarget5
        #include "enbsmaa.fx" 



also the notations are only for chaining after others, require modification on enbsmaa.fx if you wish to use it as standalong effect.

Re: [Fallout 4] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 21:34
by ibbanez
Awesome. This was one of the things I was going to try and add. I've been reading as much as I can on writing shaders and trying to get a good resource, but they always seem to be in a different context than how we are using them. Great work by the way and I look forward to seeing what else you can do. Reading your stuff, even the Skyrim stuff, always seems to help me siphon though the noise, sometimes.

Re: [Fallout 4] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 21:40
by kingeric1992
--JawZ-- wrote: Just a possible solution, mix in a bit of depth functionality, close depth SMAA x1, far depth SMAA x4.
it is not that, 4x is not a term of scale, it use some of the concepts from TXAA and MSAA on top of 1x. and those require special resource besides color & depth.

Re: [Fallout 4] SMAA 1x for 0.288+

Posted: 11 Dec 2015, 21:47
by ibbanez
Question, can those .dds files be placed inside the enbseries folder, or do they have to reside in the Main folder, along with the .fx files? Thanks.