Marty McFly Tonemaps ported to v3.x

  • Posts: 57
3 years 4 months ago - 3 years 4 months ago #1 by XIIICaesar
I've successfully ported the HPD filmic game tonemap by Marty McFly to ReShade v3.x. I'm also going to pos tthis in the port request thread as well for people.
/**
 * Haarm-Peter Duiker (HPD) Tonemap
 * Original by Marty McFly
 * Ported by XIIICaesar
 */

#include "ReShade.fxh"

float3 HaarmPeterDuikerPass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
	float3 x = tex2D(ReShade::BackBuffer, texcoord).rgb;
	x = max((float3)0.0f, x - 0.004f);
    	return pow(abs((x * (6.2f * x + 0.5f)) / (x * (6.2f * x + 1.7f) + 0.06)), 2.2f);
}

technique HPD
{
	pass
	{
		VertexShader = PostProcessVS;
		PixelShader = HaarmPeterDuikerPass;
	}
}

Please Log in or Create an account to join the conversation.

  • Posts: 3666
3 years 4 months ago #2 by crosire
Cleaned up the code and removed the uncessary parts. Hope you don't mind =).

Please Log in or Create an account to join the conversation.

  • Posts: 57
3 years 4 months ago - 3 years 4 months ago #3 by XIIICaesar

crosire wrote: Cleaned up the code and removed the uncessary parts. Hope you don't mind =).

Not at all dude. Never did shaders before. Just used ReShade and a lot of graphics editing with GIMP/PS :lol: . I'm actually surprised I got them working. Insomnia's idea over in the port request thread was tedious to do but worked. Also, below is FILMICCURVE.

I don't need the LumCoeff parts do I crosire? Nevermind. I cross-referenced them and figured it out. I gotta hit the bed but for those interested I know people's been asking about the other tonemaps Marty did as well in the request thread. I could attempt to port them later this evening sleep and everything I've planned for the day. I know Skyrim & Spherical were 2 in particular. No promises though. Oh, also, crosire do I need to commit these or whatever its called to your github or? Never done shaders so don't know how you do it...

Please Log in or Create an account to join the conversation.

  • Posts: 3666
3 years 4 months ago #4 by crosire
The LumCoeff define isn't used anywhere in the code, so nope, not needed.
Also, it's better to use the "code" BBCode rather than "spoiler" so whitespaces are preserved.

Please Log in or Create an account to join the conversation.

  • Posts: 57
3 years 4 months ago - 3 years 4 months ago #5 by XIIICaesar
/**
 * Filmic Curve (Unchartered 2) Tonemap
 * Original by Marty McFly
 * Ported by XIIICaesar
 */

#include "ReShade.fxh"

float3 FilmicCurvePass(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
	float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
	
	float3 x = color.rgb;
	//float x = color;
	
	const float A = 0.665f;
	const float B = 0.09f;
	const float C = 0.004f;
	const float D = 0.445f;
	const float E = 0.26f;
	const float F = 0.025f;
	const float G = 0.16f;//0.145f;
	const float H = 1.1844f;//1.15f;

    // gamma space or not?
	return (((x*(A*x+B)+C)/(x*(D*x+E)+F))-G) / H;
	
	return color;
}

technique FilmicCurve
{
	pass
	{
		VertexShader = PostProcessVS;
		PixelShader = FilmicCurvePass;
	}
}
I tried editing the last post to code after cleaning it up but couldn't figure it out :blink: . Sorry for multiposts.

Please Log in or Create an account to join the conversation.