Skip to content

Commit

Permalink
Downgrade PS/VS feature levels (and some other things)
Browse files Browse the repository at this point in the history
  • Loading branch information
xan1242 committed Mar 23, 2022
1 parent 1014c3d commit a5f6714
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 134 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ The hook basically takes the appropriate values from the game memory (in `pVisua

This includes the speed of the camera, amount of NOS and the camera's X direction.



As for the rain, included is a hook to a function which controls some parameters in the shader during `Rain::Render`. By setting a custom technique in the shader called "raindrop" we can control the shader only on the rain and not the other particles.

This is done by calling `eEffect::SetCurrentPass`.
Expand All @@ -54,15 +52,10 @@ We can safely assume that Black Box was mostly developing with NVIDIA GPUs on th

You can download a release package in the Releases tab and try it for yourself.

Minimum requirement is that your GPU now supports pixel shader 3.0 and vertex shader 2.0 (which is practically any GPU in the last 10 years).

The release package is compiled with VS2022, so you'll need the redistributables installed.


The release package is compiled with VS2022, so you'll need the redistributables installed.

As for what it looks like, if you've seen the 360 version, you've seen the PC version too.


![Streakflares](Screenshots/ss1.png)


79 changes: 31 additions & 48 deletions Shaders/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@
/////////////////////////////////////////////////////////////////////////////////////////
float4x4 cmWorldViewProj : WorldViewProj; //WORLDVIEWPROJECTION ;
//float4x4 WorldViewProj : REG_cmWorldViewProj; //WORLDVIEWPROJECTION ;
float4 cvScreenOffset : REG_cvScreenOffset; //SCREENOFFSET;
float4 cvVertexPowerBrightness : REG_cvVertexPowerBrightness;
float4 cvScreenOffset : cvScreenOffset; //SCREENOFFSET;
float4 cvVertexPowerBrightness : cvVertexPowerBrightness;

float4 world_position( float4 screen_pos )
{
float4 p = mul(screen_pos, cmWorldViewProj);
p.xy += cvScreenOffset.xy * p.w;
float4 p = mul(screen_pos, cmWorldViewProj);
p.xy += cvScreenOffset.xy * p.w;
return p;
}

float4 screen_position( float4 screen_pos )
{
screen_pos.xy += cvScreenOffset.xy;
screen_pos.xy += cvScreenOffset.xy;
return screen_pos;
}

float4 CalcVertexColour(float4 colour)
{
float4 result = pow(colour, cvVertexPowerBrightness.x) * cvVertexPowerBrightness.y;
result.w = colour.w;
return result;
float4 result = pow(colour, cvVertexPowerBrightness.x) * cvVertexPowerBrightness.y;
result.w = colour.w;
return result;
}

float3 ScaleHeadLightIntensity(float3 colour)
{
float3 result = colour * cvVertexPowerBrightness.z;
return result;
float3 result = colour * cvVertexPowerBrightness.z;
return result;
}


Expand All @@ -53,32 +53,15 @@ float3 ScaleHeadLightIntensity(float3 colour)
// Convert to a log or psudeo-log colour space to save high dynamic range data
/////////////////////////////////////////////////////////////////////////////////////////
#define kCompressCoeff ( 1.0f )
//float3 CompressColourSpace(float3 colour)
//{
// return colour / (kCompressCoeff+colour);
//}

float3 CompressColourSpace(float3 c)
float3 CompressColourSpace(float3 colour)
{
// filmic response, without implicit gamma
// GammaCompress() is active, and does a sqrt() after this response curve
return (1-(pow(1-(c*.5),2)));
/*
float3 c0, c1;
c0 = max(c*.75,1);
c1 = min(1,c*.75);
c1 = 1-pow(c1,2);
return (c0-c1)*1.3333;
*/

//return (c*.5);//(c*0.5);//saturate((c/(c+0.1812))*1.0906);
return colour / (kCompressCoeff+colour);
}

float3 DeCompressColourSpace(float3 colour)
{
float3 clr = max( 0.01, kCompressCoeff-colour );
return colour / clr;
float3 clr = max( 0.01, kCompressCoeff-colour );
return colour / clr;
}


Expand All @@ -92,36 +75,36 @@ float3 DeCompressColourSpace(float3 colour)

float4 EncodeRGBE8( in float3 rgb )
{
float4 vEncoded;
float4 vEncoded;

// Determine the largest color component
float maxComponent = max( max(rgb.r, rgb.g), rgb.b );
// Round to the nearest integer exponent
float fExp = ceil( log2(maxComponent) );
float maxComponent = max( max(rgb.r, rgb.g), rgb.b );
// Round to the nearest integer exponent
float fExp = ceil( log2(maxComponent) );

// Divide the components by the shared exponent
vEncoded.rgb = rgb / exp2(fExp);
// Store the shared exponent in the alpha channel
vEncoded.a = (fExp + 128) / 255;
vEncoded.rgb = rgb / exp2(fExp);
// Store the shared exponent in the alpha channel
vEncoded.a = (fExp + 128) / 255;

return vEncoded;
return vEncoded;
}

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

float3 DecodeRGBE8( in float4 rgbe )
{
float3 vDecoded;
float3 vDecoded;

// Retrieve the shared exponent
float fExp = rgbe.a * 255 - 128;
// Multiply through the color components
vDecoded = rgbe.rgb * exp2(fExp);
return vDecoded;
float fExp = rgbe.a * 255 - 128;
// Multiply through the color components
vDecoded = rgbe.rgb * exp2(fExp);
return vDecoded;
}

/////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading

0 comments on commit a5f6714

Please sign in to comment.