Please use english language
It is currently 23 Oct 2017, 22:26

All times are UTC





Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: 04 Jan 2017, 08:56 
Offline
User avatar

Joined: 30 Jan 2016, 11:26
Posts: 89
Location: France
Yeah sure, let me just finish some more tweaks about it and I'll put it here or upload the files somewhere.
My effect.fx is modular tho, I hope it won't be a problem for you.

_________________
Released ENB: PRC - PRT - Painterly' | FO4 mods: NAC | Videos: ::Virtual.Camera::


Top
 Profile  
 
Tomoko
PostPosted: 04 Jan 2017, 09:48 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 31 Mar 2012, 15:06
Posts: 1425
Location: France
l00

Sure, take full time.
Nope, modular or not will be no problem. I'm just interested in the AGCC implementation, coz some things can be achieved only via this particular piece.
Thank you !

_________________
Obsidian 900D, AX1500i, Eisbaer 420, i7 6850K@4.425 Ghz, MSI X99 Raider, SLI 2x1080Ti 11G VRAM, 32G RAM@3371, 950 Pro M2, 10 Tb HDDs, W10 Pro 64
Image
K ENB Pure Light SE
K ENB Pure Light
Kountervibe ENB
Kinematic ENB


Top
 Profile  
 
PostPosted: 04 Jan 2017, 10:53 
Offline
User avatar

Joined: 30 Jan 2016, 11:26
Posts: 89
Location: France
So it's customized and tweaked for PRT, be sure to make proper changes for your preset. I use tonemapping and control over image space but you can use a simpler way to load AGCC by just copy/paste the vanilla post process pixel shaders into the AGCC function and returning the result.

So here's what I use in the effect.fx:
Code:
IN EFFECT.FX

///Just copy paste this in the proper locations of your effect.fx file :

///OPTIONAL GUI for tonemapping and image space control

#define ACTIVATE_AGCC          

bool    ENABLE_AGCC             < string UIName = "                   ApplyGameGammaCorrection";> = {false};

bool    ENABLE_FilmicTonemap       < string UIName = "                     AGCC Filmic Tonemapping";> = {false};
float fShoulderStrength    <string UIName="AGCC: Shoulder Strength";  string UIWidget="Spinner";  float UIMin=0.001;  float UIMax=2.0;float UIStep=0.01;> = {1.1};
float fLinearStrength       <string UIName="AGCC: Linear Strength";    string UIWidget="Spinner";  float UIMin=0.0;  float UIMax=5.0;float UIStep=0.001;> = {0.45};
float fLinearAngle          <string UIName="AGCC: Linear Angle";       string UIWidget="Spinner";  float UIMin=0.001;  float UIMax=1.0;float UIStep=0.001;> = {0.16};
float fToeStrength          <string UIName="AGCC: Toe Strength";       string UIWidget="Spinner";  float UIMin=0.0;  float UIMax=2.0;float UIStep=0.001;> = {0.08};
//float fToeNumerator       <string UIName="AGCC: Toe Numerator";      string UIWidget="Spinner";  float UIMin=0.001;  float UIMax=0.5;  float UIStep=0.001;> = {0.001};
float fToeDenominator       <string UIName="AGCC: Toe Denominator";    string UIWidget="Spinner";  float UIMin=0.0;  float UIMax=2.0;> = {0.3};
float fLinearWhite          <string UIName="AGCC: Linear White";       string UIWidget="Spinner";  float UIMin=0.0;  float UIMax=50.0;> = {3.33};

float AGsatDawn          <string UIName="AGCC: Saturation Dawn";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGbriDawn          <string UIName="AGCC: Brightness Dawn";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGctrDawn          <string UIName="AGCC: Contrast Dawn";                string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGtinDawn          <string UIName="AGCC: Color Tint Intensity Dawn";    string UIWidget="Spinner";  float UIMin=-10.0;  float UIMax=10.0;> = {0.0};

float AGsatSunrise          <string UIName="AGCC: Saturation Sunrise";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGbriSunrise          <string UIName="AGCC: Brightness Sunrise";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGctrSunrise          <string UIName="AGCC: Contrast Sunrise";                string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGtinSunrise          <string UIName="AGCC: Color Tint Intensity Sunrise";    string UIWidget="Spinner";  float UIMin=-10.0;  float UIMax=10.0;> = {0.0};

float AGsatDay             <string UIName="AGCC: Saturation Day";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGbriDay             <string UIName="AGCC: Brightness Day";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGctrDay             <string UIName="AGCC: Contrast Day";                string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGtinDay             <string UIName="AGCC: Color Tint Intensity Day";    string UIWidget="Spinner";  float UIMin=-10.0;  float UIMax=10.0;> = {0.0};

float AGsatSunset          <string UIName="AGCC: Saturation Sunset";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGbriSunset          <string UIName="AGCC: Brightness Sunset";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGctrSunset          <string UIName="AGCC: Contrast Sunset";                string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGtinSunset          <string UIName="AGCC: Color Tint Intensity Sunset";    string UIWidget="Spinner";  float UIMin=-10.0;  float UIMax=10.0;> = {0.0};

float AGsatDusk          <string UIName="AGCC: Saturation Dusk";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGbriDusk          <string UIName="AGCC: Brightness Dusk";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGctrDusk          <string UIName="AGCC: Contrast Dusk";                string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGtinDusk          <string UIName="AGCC: Color Tint Intensity Dusk";    string UIWidget="Spinner";  float UIMin=-10.0;  float UIMax=10.0;> = {0.0};


float AGsatNight          <string UIName="AGCC: Saturation Night";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGbriNight          <string UIName="AGCC: Brightness Night";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGctrNight          <string UIName="AGCC: Contrast Night";                string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGtinNight          <string UIName="AGCC: Color Tint Intensity Night";    string UIWidget="Spinner";  float UIMin=-10.0;  float UIMax=10.0;> = {0.0};

float AGsatInterior       <string UIName="AGCC: Saturation Interior";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGbriInterior       <string UIName="AGCC: Brightness Interior";             string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGctrInterior       <string UIName="AGCC: Contrast Interior";                string UIWidget="Spinner";  float UIMin=-1.0;  float UIMax=1.0;> = {0.0};
float AGtinInterior       <string UIName="AGCC: Color Tint Intensity Interior";    string UIWidget="Spinner";  float UIMin=-10.0;  float UIMax=10.0;> = {0.0};

//IN FUNCTIONS:
/// Change the filepath below according to your own file structure
 
#ifdef ACTIVATE_AGCC
   #include "/.../Sky_AGCC.fxh"                       
#endif


// IN PIXEL SHADER
float4 PS_Draw(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target
{
 
#ifdef ACTIVATE_AGCC
    if (ENABLE_AGCC==true) {
      color = SkyAGCC(color, IN.txcoord0.xy);  /// Requires Sky_AGCC.fxh active
   }
#endif

}

/// NEW vanilla process // I only kept Kingeric1992 comments because of my squirrel brain.

float4   PS_DrawO(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target
{
    //It start with loading textures:
//The UV coord of bloom texture has a scaling factor controlled by clamps and a on/off switch.

   bool   scalebloom  = (0.5<=Params01[0].x);
    float2 scaleduv    = clamp(0.0, Params01[6].zy, Params01[6].xy * IN.txcoord0.xy);
    float4 color       = TextureColor.Sample(Sampler0, IN.txcoord0.xy); //hdr scene color, point sampler
    float4 bloom       = TextureBloom.Sample(Sampler1, (scalebloom)? IN.txcoord0.xy: scaleduv); //linear sampler
    float2 middlegray  = TextureAdaptation.Sample(Sampler1, IN.txcoord0.xy).xy; //.x == current, .y == previous
    middlegray.y = 1.0; //bypass for enbadaptation format
   float DELTA         = max(0,0.00000001); //Thank you McFly !

//then, the tonemapper"s"
//A additional switch for switching between Reinhard-modified and Filmic ALU by Heji

   bool   UseFilmic   = (0.5<Params01[2].z);
    float  WhiteFactor = Params01[2].y;
   
    float  original_lum = max( dot(LUM_709, color.rgb), DELTA);
    float  lum_scaled   = original_lum * middlegray.y / middlegray.x;
           
    float  lum_filmic = max( lum_scaled - 0.004, 0.0);
           lum_filmic = lum_filmic * (lum_filmic * 6.2 + 0.5)  / (lum_filmic * (lum_filmic * 6.2 + 1.7) + 0.06);
           lum_filmic = pow(lum_filmic, 2.2);          //de-gamma-correction for gamma-corrected tonemapper
           lum_filmic = lum_filmic * WhiteFactor;    //linear scale
   
    float lum_reinhard = lum_scaled * (lum_scaled * WhiteFactor + 1.0) / (lum_scaled + 1.0);
   
    float lum_mapped   = (UseFilmic)? lum_filmic : lum_reinhard; //if filmic
   
    color.rgb = color.rgb * lum_mapped / original_lum;
   
//then do the bloom blending, this part is identical to the old Skyrim.

   float bloomfactor = Params01[2].x;
    color.rgb = color.rgb + bloom.rgb * saturate(bloomfactor - lum_mapped);
   
//And the imagespace modifiers, mostly the same as the old Skyrim,
//but it has a inactive process with Params01[6].w, seemly supposed to have a gamma ops there.

   float  saturation  = Params01[3].x;   // 0 == gray scale
    float  contrast    = Params01[3].z;   // 0 == no contrast
    float  brightness  = Params01[3].w;   // intensity
   
   
    float3 tint_color  = Params01[4].rgb; // tint color
    float  tint_weight = Params01[4].w;   // 0 == no tint

    float3 fade        = Params01[5].xyz; // fade current scene to specified color, mostly used in special effects
    float  fade_weight = Params01[5].w;   // 0 == no fade
   
    color.a   = dot(color.rgb, LUM_709);
    color.rgb = lerp(color.a, color.rgb, saturation);
    color.rgb = lerp(color.rgb, tint_color * color.a , tint_weight);
    color.rgb = lerp(middlegray.x, color.rgb * brightness, contrast);
    color.rgb = pow(saturate(color.rgb), Params01[6].w); //this line is unused??
    color.rgb = lerp(color.rgb, fade, fade_weight);
    color.a = 1.0;
   
   return color;
}

// TECHNIQUES
//Replace original post process with this one.

technique11 ORIGINALPOSTPROCESS <string UIName="Vanilla";> //do not modify this technique
{
  pass p0
  {
    SetVertexShader(CompileShader(vs_5_0, VS_Draw()));
    SetPixelShader(CompileShader(ps_5_0, PS_DrawO()));
  }
}


And here's the function:
Code:
//+++++++++++++++++++++++++++++++++++++++++++++++++++++//
//            Contains Game Post-Processing            //
//           used by the Modular Shader files          //
//-----------------------CREDITS-----------------------//
// Boris: For ENBSeries and his knowledge and codes    //
// JawZ: Author and developer of this file             //
// kingeric1992: For the initial code                  //
// L00: Adaptation and tweaks for Skyrim SE             //
//+++++++++++++++++++++++++++++++++++++++++++++++++++++//


// ------------------- //
//   GUI ANNOTATIONS   //
// ------------------- //

//in effects


// ------------------- //
//   HELPER CONSTANTS  //
// ------------------- //

// ------------------- //
//   HELPER FUNCTIONS  //
// ------------------- //

// Functions use a custom MSL helper, be sure to make proper changes if you don't use it.
// LUM_709 is float3(0.2125, 0.7154, 0.0721)

float3 Tonemap_Filmic(float3 color, float W, float A, float B, float C, float D, float E, float F)
{
    float4 res = float4(color.rgb, W);
    res        = (res * ( A * res + C * B) + D * E) / (res * ( A * res + B) + D * F);
    res       -= E / F;
    return res.rgb / res.a;
}


float4 SkyAGCC(float4 inColor, float2 inCoords)
{
   
/// TOD GUI SETTINGS. Delete if you don't tod gui this settings.

float   timeweight;
float   timevalue;

//AGsat
timeweight=0.000001;
timevalue=0.0;
   
timevalue+=TimeOfDay1.x * AGsatDawn;
timevalue+=TimeOfDay1.y * AGsatSunrise;
timevalue+=TimeOfDay1.z * AGsatDay;
timevalue+=TimeOfDay1.w * AGsatSunset;
timevalue+=TimeOfDay2.x * AGsatDusk;
timevalue+=TimeOfDay2.y * AGsatNight;

timeweight+=TimeOfDay1.x;
timeweight+=TimeOfDay1.y;
timeweight+=TimeOfDay1.z;
timeweight+=TimeOfDay1.w;
timeweight+=TimeOfDay2.x;
timeweight+=TimeOfDay2.y;
   
   float todAGsat;
   todAGsat=lerp( (timevalue / timeweight), AGsatInterior, EInteriorFactor );      
   
//AGtin
timeweight=0.000001;
timevalue=0.0;
   
timevalue+=TimeOfDay1.x * AGtinDawn;
timevalue+=TimeOfDay1.y * AGtinSunrise;
timevalue+=TimeOfDay1.z * AGtinDay;
timevalue+=TimeOfDay1.w * AGtinSunset;
timevalue+=TimeOfDay2.x * AGtinDusk;
timevalue+=TimeOfDay2.y * AGtinNight;

timeweight+=TimeOfDay1.x;
timeweight+=TimeOfDay1.y;
timeweight+=TimeOfDay1.z;
timeweight+=TimeOfDay1.w;
timeweight+=TimeOfDay2.x;
timeweight+=TimeOfDay2.y;
   
   float todAGtin;
   todAGtin=lerp( (timevalue / timeweight), AGtinInterior, EInteriorFactor );   
   
//AGctr
timeweight=0.000001;
timevalue=0.0;
   
timevalue+=TimeOfDay1.x * AGctrDawn;
timevalue+=TimeOfDay1.y * AGctrSunrise;
timevalue+=TimeOfDay1.z * AGctrDay;
timevalue+=TimeOfDay1.w * AGctrSunset;
timevalue+=TimeOfDay2.x * AGctrDusk;
timevalue+=TimeOfDay2.y * AGctrNight;

timeweight+=TimeOfDay1.x;
timeweight+=TimeOfDay1.y;
timeweight+=TimeOfDay1.z;
timeweight+=TimeOfDay1.w;
timeweight+=TimeOfDay2.x;
timeweight+=TimeOfDay2.y;
   
   float todAGctr;
   todAGctr=lerp( (timevalue / timeweight), AGctrInterior, EInteriorFactor );   
   
//AGbri
timeweight=0.000001;
timevalue=0.0;
   
timevalue+=TimeOfDay1.x * AGbriDawn;
timevalue+=TimeOfDay1.y * AGbriSunrise;
timevalue+=TimeOfDay1.z * AGbriDay;
timevalue+=TimeOfDay1.w * AGbriSunset;
timevalue+=TimeOfDay2.x * AGbriDusk;
timevalue+=TimeOfDay2.y * AGbriNight;

timeweight+=TimeOfDay1.x;
timeweight+=TimeOfDay1.y;
timeweight+=TimeOfDay1.z;
timeweight+=TimeOfDay1.w;
timeweight+=TimeOfDay2.x;
timeweight+=TimeOfDay2.y;
   
   float todAGbri;
   todAGbri=lerp( (timevalue / timeweight), AGbriInterior, EInteriorFactor );   
   
   ///END of TOD GUI
   
//It starts with loading textures:
//The UV coord of bloom texture has a scaling factor controlled by clamps and a on/off switch.

   bool   scalebloom  = (0.5<=Params01[0].x);
    float2 scaleduv    = clamp(0.0, Params01[6].zy, Params01[6].xy * inCoords.xy);
    float4 bloom       = TextureBloom.Sample(Sampler1, (scalebloom)? inCoords.xy: scaleduv); //linear sampler
    float2 middlegray  = TextureAdaptation.Sample(Sampler1, inCoords.xy).xy; //.x == current, .y == previous
    middlegray.y = 1.0; //bypass for enbadaptation format
   
//then, the tonemapper"s"
//An additional switch for switching between Reinhard-modified and Filmic ALU by Heji

   bool   UseFilmic   = (0.5<Params01[2].z);
   
// Filmic operators with GUI. If you don't GUI/tweak it then proper settings I found for almost unaltered output are (at least on my preset) :
// A=0.001 B=0.130 C=0.200 D=0.205 F=0.300 W=45.0

if (ENABLE_FilmicTonemap == true)
{
    float A = fShoulderStrength;
    float B = fLinearStrength;
    float C = fLinearAngle;
    float D = fToeStrength;
    float E = Params01[1].w;    /// Toe Numerator from FO4 datas but works fine with Skyrim SE too. Can be GUI with any variable tho.
    float F = fToeDenominator;
    float W = fLinearWhite;
   
   inColor.rgb = Tonemap_Filmic(inColor.rgb, W, A, B, C, D, E, F);
}
else
{
   float A = 0.001;
    float B = 0.130;
    float C = 0.200;
    float D = 0.205;
    float E = Params01[1].w;    /// Toe Numerator from FO4 datas but works fine with Skyrim SE too. Can be GUI with any variable tho.
    float F = 0.300;
    float W = 45.0;
   
   inColor.rgb = Tonemap_Filmic(inColor.rgb, W, A, B, C, D, E, F);
}
   

   
// Color corrections with TOD GUI. Remove all the "tod" and the math with AG# if you don't GUI it.
    float  saturation  = Params01[3].x+ todAGsat;   /// 0 == gray scale
    float3 tint        = Params01[4].rgb;        /// tint color
   float  tint_weight = Params01[4].w*todAGtin;         // 0 == no tint
    float  contrast    = Params01[3].z+todAGctr;   /// 0 == no contrast
    float  brightness  = Params01[3].w+todAGbri;   /// intensity
    float3 fade        = Params01[5].xyz;        /// fade current scene to specified color, mostly used in special effects
   float  fade_weight = Params01[5].w;         // 0 == no fade

    inColor.a   = dot(inColor.rgb, LUM_709);      /// Get luminance
    inColor.rgb = lerp(inColor.a, inColor.rgb, saturation);              /// Saturation
    inColor.rgb = lerp(inColor.rgb, inColor.a * tint.rgb, tint_weight);       /// Tint
    inColor.rgb = lerp(middlegray.x, brightness * inColor.rgb, contrast);  /// Contrast & intensity
    inColor.rgb = pow(saturate(inColor.rgb), Params01[6].w); //this line is unused?? < I think it's additional distant blur in image space but I maybe wrong
    inColor.rgb = lerp(inColor.rgb, fade, fade_weight);                   /// Fade current scene to specified color

   inColor.a = 1.0;
    inColor.rgb = saturate(inColor.rgb);

  return inColor;
}


If I made mistakes please apologize, my learning process is only based on trial/errors situations.( and I've pretty much no idea what I'm doing with the maths and the functions most of the time, I'm just glad when I see the red lines disappear and the visuals working like I want them to.)

_________________
Released ENB: PRC - PRT - Painterly' | FO4 mods: NAC | Videos: ::Virtual.Camera::


Top
 Profile  
 
PostPosted: 04 Jan 2017, 11:42 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 31 Mar 2012, 15:06
Posts: 1425
Location: France
Thank you ! :)
And please do not apologize for possible mistakes... I make SO many myself. :D

_________________
Obsidian 900D, AX1500i, Eisbaer 420, i7 6850K@4.425 Ghz, MSI X99 Raider, SLI 2x1080Ti 11G VRAM, 32G RAM@3371, 950 Pro M2, 10 Tb HDDs, W10 Pro 64
Image
K ENB Pure Light SE
K ENB Pure Light
Kountervibe ENB
Kinematic ENB


Top
 Profile  
 
PostPosted: 05 Jan 2017, 19:28 
Offline
User avatar

Joined: 30 Jan 2016, 11:26
Posts: 89
Location: France
Cool !

If you prefer a simpler AGCC without my tonemapping and other tweaks in order to really get raw input from the game, use this instead:

The function :

Code:
float4 SkySimpleAGCC(float4 inColor, float2 inCoords)
{
   #define LUM_709  float3(0.2125, 0.7154, 0.0721)
   bool   scalebloom  = (0.5<=Params01[0].x);
    float2 scaleduv    = clamp(0.0, Params01[6].zy, Params01[6].xy * inCoords.xy);
    float4 bloom       = TextureBloom.Sample(Sampler1, (scalebloom)? inCoords.xy: scaleduv); //linear sampler
    float2 middlegray  = TextureAdaptation.Sample(Sampler1, inCoords.xy).xy; //.x == current, .y == previous
    middlegray.y = 1.0; //bypass for enbadaptation format

    float  saturation  = Params01[3].x;   /// 0 == gray scale
    float3 tint        = Params01[4].rgb;        /// tint color
   float  tint_weight = Params01[4].w;         // 0 == no tint
    float  contrast    = Params01[3].z;   /// 0 == no contrast
    float  brightness  = Params01[3].w;   /// intensity
    float3 fade        = Params01[5].xyz;        /// fade current scene to specified color, mostly used in special effects
   float  fade_weight = Params01[5].w;         // 0 == no fade

    inColor.a   = dot(inColor.rgb, LUM_709);      /// Get luminance
    inColor.rgb = lerp(inColor.a, inColor.rgb, saturation);              /// Saturation
    inColor.rgb = lerp(inColor.rgb, inColor.a * tint.rgb, tint_weight);       /// Tint
    inColor.rgb = lerp(middlegray.x, brightness * inColor.rgb, contrast);  /// Contrast & intensity
    inColor.rgb = pow(saturate(inColor.rgb), Params01[6].w); //this line is unused??
    inColor.rgb = lerp(inColor.rgb, fade, fade_weight);                   /// Fade current scene to specified color

   inColor.a = 1.0;
    inColor.rgb = saturate(inColor.rgb);

  return inColor;
}


The Pixel Shader:
Code:
color = SkySimpleAGCC(color, IN.txcoord0.xy);


Technique remains the same.

_________________
Released ENB: PRC - PRT - Painterly' | FO4 mods: NAC | Videos: ::Virtual.Camera::


Top
 Profile  
 
PostPosted: 05 Jan 2017, 22:16 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 496
Location: Taiwan
I would preferred using struct for easy management through profiles and test builds.

function declaration:
Code:
struct GameCCStruct {
    bool   State;
    float  Weight;
    float4 Cinematic; // {Saturation, middlegray, Contrast, Brightness}
    float4 Tint;      // {Tint.rgb, Tint weight}
    float4 Fade;      // {Fade.rgb, Fade weight}
};

float3 GameCCFunc( float3 color, GameCCStruct i )
{
    float lum = dot( color, LumCoeff);
    color = lerp(lum, color, i.Cinematic.x);
    color = lerp(color, lum * i.Tint.rgb, i.Tint.a);
    color = lerp(i.Cinematic.y, color * i.Cinematic.w, i.Cinematic.z);
    color = lerp(color, i.Fade.rgb, i.Fade.a);
    return color;
}


//implementation
Code:
bool   GameCC_Enabled <string UIName ="GameCC Enabled";> = {false};
float  GameCC_Weight  <string UIName="GameCC Weight"; float UIMin=0.0;  float UIMax=1.0; > = {0.0};

static GameCCStruct DefaultGameCC = {
    GameCC_Enabled,
    GameCC_Weight,
    float4( Params01[3].x, TextureAdaptation.Sample(Sampler1, 0.5).x, Params01[3].zw),
    Params01[4],
    Params01[5]
};

float4 PS_Draw(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target
{
    //...
    color.rgb = lerp(color.rgb, GameCCFunc(color.rgb, DefaultGameCC), DefaultGameCC.Weight * DefaultGameCC.State);
    //...


Additionally, you can easily setup custom variable without changing the function body:
Code:
bool   GameCC_Enabled  <string UIName="GameCC Enabled";> = {false};
float  GameCC_Weight_D <string UIName="GameCC Weight Day";   float UIMin=0.0;  float UIMax=1.0; > = {0.0};
float  GameCC_Weight_N <string UIName="GameCC Weight Night"; float UIMin=0.0;  float UIMax=1.0; > = {0.0};
//...

static GameCCStruct DNIGameCC = {
    GameCC_Enabled,
    f_DNI( GameCC_Weight_D, GameCC_Weight_N, GameCC_Weight_I),
    f4_DNI( Cinematic_D, Cinematic_N,  Cinematic_I),
    f4_DNI( Tint_D,         Tint_N,          Tint_I),
    f4_DNI( Fade_D,        Fade_N,         Fade_I)
};

_________________
Intel Xeon L5639 6C12T @3.96GHz // Gigabyte ga-x58a-ud3r// MSI GTX680 4G// 24G RAM
Flickr
YouTube


Last edited by kingeric1992 on 13 Mar 2017, 23:35, edited 1 time in total.

Top
 Profile  
 
PostPosted: 09 Mar 2017, 06:38 
Offline
*master*

Joined: 20 Sep 2012, 00:20
Posts: 223
Location: the perfect system
@kingeric1992

Thanks for all the information and effects you contribute here. You have helped me numerous time in the past with my own efforts with the old Skyrim ENB (specifically day/night separation in enbeffect.fx).

I am currently working to port some old shaders from enbeffect.fx to SSE and while I know this is probably a noobish question (not a shader programmer), and I'm not even sure if it is the right place, perhaps you can help me once again?

Specifically, I am trying to map these register declarations to the new equivalents:

Code:
//skyrim shader specific externals, do not modify
   float4 _c1 : register(c1); float4 _c2 : register(c2); float4 _c3 : register(c3);
   float4 _c4 : register(c4); float4 _c5 : register(c5);


I would appreciate any insights. :)

_________________
i7 3770k @ 4.4ghz, 16gb 2133mhz RAM, gtx780 OC, Win7Ult. 64-bit.


Last edited by Phinix on 13 Mar 2017, 06:21, edited 2 times in total.

Top
 Profile  
 
PostPosted: 09 Mar 2017, 15:30 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 496
Location: Taiwan
(no mapping on _c1)
Code:
_c2 = Params01[2];
_c3 =Params01[3];
_c4 =Params01[4];
_c5 = Params01[5];

_________________
Intel Xeon L5639 6C12T @3.96GHz // Gigabyte ga-x58a-ud3r// MSI GTX680 4G// 24G RAM
Flickr
YouTube


Top
 Profile  
 
PostPosted: 10 Mar 2017, 22:35 
Offline
*master*

Joined: 20 Sep 2012, 00:20
Posts: 223
Location: the perfect system
@kingeric1992 Awesome, thanks! Also ty @l00 for posting your effect stuff. It has been a very helpful reference.

_________________
i7 3770k @ 4.4ghz, 16gb 2133mhz RAM, gtx780 OC, Win7Ult. 64-bit.


Top
 Profile  
 
PostPosted: 13 Mar 2017, 16:50 
Offline
*master*

Joined: 20 Sep 2012, 00:20
Posts: 223
Location: the perfect system
@kingeric1992

Blending in some of the original post process colors, particularly with the separation for brightness and contrast you have included, really is a great way to gain back details in the lows and highs after clipping or other effects. Kudos!

I was curious, is the best place to add this after all other color effects, including the ENB LDR corrections (gamma, etc.)?

Also,

kingeric1992 wrote:
Code:
float4 PS_Draw(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target
{
    //...
    color.rgb = lerp(color.rgb, GameCCFunc(DefaultGameCC), DefaultGameCC.Weight * DefaultGameCC.State);
    //...

Here I think you meant to also pass color.rgb, so GameCCFunc(color.rgb, DefaultGameCC) as it returns an error otherwise about being unable to resolve the function, or some such.

EDIT: For my testing I did:

Code:
   float4 color;
   float4 incolor;
   color=TextureColor.Sample(Sampler0, IN.txcoord0.xy); //hdr scene color
   incolor=color;


Before all other color effects, which I then run on color.rgb. Then at the end where this original blend section resides, I use incolor so I am working with the unmodified color. That is also what I passed to the function, so color.rgb = lerp(color.rgb, GameCCFunc(incolor.rgb, DNIGameCC), DNIGameCC.Weight * DNIGameCC.State); in my case.

Does this seem correct?

_________________
i7 3770k @ 4.4ghz, 16gb 2133mhz RAM, gtx780 OC, Win7Ult. 64-bit.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group