Jump to content

HDR Rendering Vice City


MAD BOSS

Recommended Posts

I've found this file as an adition to enb series. It's a pixel shader post-processing file, but it has a lot of unknown data for me. So, if anyone could explain me the lines I could edit?

 

 

For me, it just seems too dark and oversatureted:

 

user posted imageuser posted image

 

 

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//ENBSeries: [email protected], boris-vorontsov.narod.ru

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

/*

THIS IS HLSL (HIGH LEVEL SHADER LANGUAGE) FILE FOR EXECUTING ADDITIONAL

HARDWARE EFFECTS. MAKE THE COPY BEFORE CHANGING IT!

*/

 

//keyboard controled variables

float tempF1;

float tempF2;

float tempF3;

float tempF4;

float tempF5;

float tempF6;

float tempF7;

float tempF8;

float tempF9;

float tempF0;

 

 

//global variables, already set before executing this code

float ScreenSize; //width of the display resolution (1024 f.e.)

float ScreenScaleY; //screen proportions (1.333 for 1024/768)

float4 ScreenBrightness;//rgba(0..1) color of the screen with time dependent inertia

float ScreenBrightnessAdaptation;//(-10..10) for bloom it controls how much to dark in the night or when scene is dark (user defined constant factor)

float bloomPower;//(0..10) actually used for bloom, but may be useful here (user defined constant factor)

float useBloom;//(0 or 1) if bloom enabled by user

 

 

 

 

//textures

texture2D texColor;

texture2D texBloom;

 

sampler2D SamplerColor = sampler_state

{

Texture  = <texColor>;

MinFilter = LINEAR;

MagFilter = LINEAR;

MipFilter = LINEAR;//NONE;

AddressU  = Clamp;

AddressV  = Clamp;

SRGBTexture=FALSE;

};

 

sampler2D SamplerBloom = sampler_state

{

Texture  = <texBloom>;

MinFilter = LINEAR;

MagFilter = LINEAR;

MipFilter = NONE;//NONE;

AddressU  = Clamp;

AddressV  = Clamp;

SRGBTexture=FALSE;

};

 

struct VS_OUTPUT_POST {

float4 vpos  : POSITION;

float2 txcoord : TEXCOORD0;

};

 

struct VS_INPUT_POST {

float3 pos  : POSITION;

float2 txcoord : TEXCOORD0;

};

 

 

 

 

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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;

}

 

 

 

 

float4 PS_PostProcess(VS_OUTPUT_POST In) : COLOR

{

 

float2 offset[4]=

{

  float2(-1.0,-1.0),

  float2(-1.0, 1.0),

  float2( 1.0, 1.0),

  float2( 1.0,-1.0)

 

};

float4 res=0.0;

float4 coord=0.0;

coord.xy=In.txcoord.xy;

float4 origcolor=tex2D(SamplerColor, coord.xy);

float origgray=max(origcolor.r, max(origcolor.g, origcolor.b));

res+=origcolor;

float range=0.6*tempF9/ScreenSize;

for (int i=0; i<4; i++)

{

 

  coord.xy=In.txcoord+offset*range;

  float4 color;

  float gray;

  color=tex2D(SamplerColor, coord.xy);

  float4 colordiff=abs(origcolor-color);

  gray=dot(colordiff.rgb,0.333);

  float lerpfact=saturate(4.0*abs(gray)*color.a);//saturate

  res+=lerp(origcolor, color, lerpfact);

}

res=res*0.15;

 

 

 

 

//res=origcolor;

 

coord.xy=In.txcoord.xy;

coord.w=2.5*tempF1;

float4 envcol1=tex2Dbias(SamplerColor, coord);

coord.w=3.5*tempF2;

float4 envcol2=tex2Dbias(SamplerColor, coord);

float4 envcol3=tex2D(SamplerBloom, coord.xy);

float4 bloom=envcol3;

 

 

float4 envcol=(envcol1+envcol2+envcol3)*0.777;

 

 

//envcol=tempF5*pow(envcol,tempF4);

 

//envcol=envcol*tempF7/(1.0+envcol*tempF8);

 

//envcol=dot(envcol.xyz,0.333);

//envcol=max(envcol.x, max(envcol.y, envcol.z));

float4 tempcol;//=max(envcol.x, max(envcol.y, envcol.z));

//envcol=lerp(tempcol, envcol, tempF3);

 

//tempcol.xyz=saturate(res.xyz-envcol.xyz);

//float diff=dot(tempcol.xyz, 0.333);

 

//float srcgray=dot(res.xyz,0.333);

//envcol.xyz=res.xyz-(tempF7*envcol.xyz)*(1.0-saturate(srcgray));

 

envcol=tempF5*pow(envcol,tempF4);

res=lerp(res, res*envcol, tempF6);

//res=res*tempF7/(1.0+res*tempF8);

//res+=tempF7*pow(bloom,4.0*tempF8);

 

 

//desaturate

float middlegray=(res.r+res.g+res.b)*0.333;

float3 diffcolor=res.rgb-middlegray;

res.rgb-=diffcolor*0.4*tempF0;

 

if (tempF3>1.1) res=origcolor;

 

res.a=1.0;

return res;

}

 

 

 

/*

 

float4 PS_PostProcess(VS_OUTPUT_POST In) : COLOR

{

 

float2 offset[4]=

{

  float2(-1.0,-1.0),

  float2(-1.0, 1.0),

  float2( 1.0, 1.0),

  float2( 1.0,-1.0)

};

float4 res=0.0;

float4 coord=0.0;

coord.xy=In.txcoord.xy;

float4 origcolor=tex2Dlod(SamplerColor, coord);

float origgray=max(origcolor.r, max(origcolor.g, origcolor.b));

res+=origcolor;

float range=tempF5*0.001;// /ScreenSize.x

for (int i=0; i<4; i++)

{

  coord.xy=In.txcoord+offset*range;

  float4 color;

  float gray;

  color=tex2Dlod(SamplerColor, coord);

  float4 colordiff=abs(origcolor-color);

  gray=max(colordiff.r, max(colordiff.g, colordiff.b));

  float lerpfact=saturate(tempF6*abs(gray));//saturate

  res+=lerp(origcolor, color, lerpfact);

}

res=res/5.0;

 

res.a=1.0;

return res;

}

*/

 

 

 

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

technique PostProcess

{

    pass P0

    {

VertexShader = compile vs_2_0 VS_PostProcess();

PixelShader  = compile ps_2_0 PS_PostProcess();

 

FogEnable=TRUE;

ALPHATESTENABLE=TRUE;

SEPARATEALPHABLENDENABLE=FALSE;

AlphaBlendEnable=FALSE;

FogEnable=TRUE;

SRGBWRITEENABLE=FALSE;

}

}

 

Link to comment
Share on other sites

Ryosuke's NV Google mod for SA used custom HLSL files as far as i remember but for some unknown reason it didnt work on my computer... It d be fine if there was more support about custom effect.txt in ENB documentation, maybe not explanation of HLSL cuz its simply not so simple as we d want to, but i d prefer some example effect.txt files with some cool shader effects coded in or sth..

Edited by MW_29
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.