Quantcast

Jump to content

» «
Photo

[IV|SA|BETA] My Sharpen shader

4 replies to this topic
Frozenflake
  • Frozenflake

    Knowledge is Power

  • Members
  • Joined: 01 Aug 2014
  • None

#1

Posted 01 August 2014 - 04:38 PM Edited by Frozenflake, 01 August 2014 - 05:14 PM.

I'm doing my own sharpen shader based on the Matso's code. Test and then post their photos with the result below. :)

Frozenflake Sharpen Shader 'F-Sharp' effect.txt

 

///////////////////////////////////////////////////////////////////////

// ENBSeries effect file
// Frozenflake Sharpen Shader 'F-Sharp'

// Made by: frozenflake
// Copyright: Boris Vorontsov/Matso/frozenflake
// Using Sharpen code from PROJECT M.A.T.S.O (Thanks to Matso).
// Adapted, modified & ported to ENB Shader by frozenflake.
///////////////////////////////////////////////////////////////////////

 

// Set values of the sharpening amount
#define fSharpScale 0.032

// Set your screen resolution size
float2 fvTexelSize = float2(1.0 / 1920.0, 1.0 / 1080.0);    
//float2 fvTexelSize = float2(1.0 / 2560.0, 1.0 / 1440.0);
//float2 fvTexelSize = float2(1.0 / 3840.0, 1.0 / 2160.0);
//float2 fvTexelSize = float2(1.0 / 2880.0, 1.0 / 1620.0);


#define E_SHADER_3_0

///////////////////////////////////////////////////////////////////////
// Textures
///////////////////////////////////////////////////////////////////////
texture2D texColor;

///////////////////////////////////////////////////////////////////////
// Sampler Inputs
///////////////////////////////////////////////////////////////////////

sampler2D InputSampler = sampler_state
{
Texture = (texColor);
MinFilter = Point;
MagFilter = Point;
MipFilter = Point;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};


struct VS_OUTPUT_POST {
float4 vpos : POSITION;
float2 txcoord : TEXCOORD0;
};

struct VS_INPUT_POST {
float3 pos : POSITION;
float2 txcoord : TEXCOORD0;
};

float pixelWidth;
float pixelHeight;

///////////////////////////////////////////////////////////////////////
// Vertex Shader Input
///////////////////////////////////////////////////////////////////////

VS_OUTPUT_POST VS_PostProcess(VS_INPUT_POST IN)
{
VS_OUTPUT_POST OUT;

float4 pos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);

OUT.vpos=pos;
OUT.txcoord.xy=IN.txcoord.xy;

return OUT;
}

///////////////////////////////////////////////////////////////////////
// Pixel Shader
///////////////////////////////////////////////////////////////////////

float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 Color = 9.0 * tex2D(InputSampler, uv);
    
Color -= tex2D(InputSampler, uv + float2(-fvTexelSize.x, fvTexelSize.y) * fSharpScale);
Color -= tex2D(InputSampler, uv + float2(0.0, fvTexelSize.y) * fSharpScale);
Color -= tex2D(InputSampler, uv + float2(fvTexelSize.x, fvTexelSize.y) * fSharpScale);
Color -= tex2D(InputSampler, uv + float2(fvTexelSize.x, 0.0) * fSharpScale);
Color -= tex2D(InputSampler, uv + float2(fvTexelSize.x, -fvTexelSize.y) * fSharpScale);
Color -= tex2D(InputSampler, uv + float2(0.0, -fvTexelSize.y) * fSharpScale);
Color -= tex2D(InputSampler, uv + float2(-fvTexelSize.x, -fvTexelSize.y) * fSharpScale);
Color -= tex2D(InputSampler, uv + float2(-fvTexelSize.x, 0.0) * fSharpScale);
    
Color.a = 1.0;
return Color;
}

///////////////////////////////////////////////////////////////////////
// Compiler
///////////////////////////////////////////////////////////////////////
technique PostProcess
{
pass P0
{
#ifdef E_SHADER_3_0
VertexShader = compile vs_3_0 VS_PostProcess();
PixelShader = compile ps_3_0 main();
#else
VertexShader = compile vs_2_0 VS_PostProcess();
PixelShader = compile ps_2_0 main();
#endif

ZEnable=FALSE;
CullMode=NONE;
ALPHATESTENABLE=FALSE;
SEPARATEALPHABLENDENABLE=FALSE;
AlphaBlendEnable=FALSE;
FogEnable=FALSE;
SRGBWRITEENABLE=FALSE;
}
}
 

  • PacketOVerload_x64Bit likes this

RoyalPredator
  • RoyalPredator

    Player Hater

  • Members
  • Joined: 13 Nov 2013

#2

Posted 15 August 2014 - 04:50 PM

Yeah and if I copypaste it it just f*cks up the whole game? 


Frozenflake
  • Frozenflake

    Knowledge is Power

  • Members
  • Joined: 01 Aug 2014
  • None

#3

Posted 17 August 2014 - 01:12 AM Edited by Frozenflake, 17 August 2014 - 12:36 PM.

Yeah and if I copypaste it it just f*cks up the whole game? 

 

I believe that this doesn't happen, since the code is intact, without modifications (I forgot to remove "modified" of the description).
The code only was ported for a HLSL shader and nothing more. Only was placed the 1920x1080 resolution.
Also I have a modified version from Sharpen Shader Test 2 by DKT70 and maybe I'll post here my paint jobs and other mods.
 


PacketOVerload_x64Bit
  • PacketOVerload_x64Bit

    ENB Whore

  • Members
  • Joined: 13 Mar 2010
  • Canada
  • Contribution Award [Mods]

#4

Posted 19 August 2014 - 10:47 PM

Can you show some screenshots before and after the sharpen shader is used?


Frozenflake
  • Frozenflake

    Knowledge is Power

  • Members
  • Joined: 01 Aug 2014
  • None

#5

Posted 20 August 2014 - 12:16 AM

Can you show some screenshots before and after the sharpen shader is used?

 

My current low-end PC does not allow me to test in-game.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users