FANDOM


The bloom effect adds a bright, yellowish / orangish haze around objects when looking toward the sun. It also multiplies the effect of "blindness" when going in and out of shadows. (eg: when you go under a tree the surrounding area gets super bright to simulate your eyes looking from shadow out into light).

While it may look nice for photographs, it can be an annoyance at best and handicap at worst during races as you get blinded at the most inconvenient times (like flying out of a forest at 70mph on your motorcycle).

While the below code disable the yellowish-orangish bloom effect, it doesn't get rid of the "looking from shadows out into light" effect totally. But, it does reduce it dramatically.

  1. Go to
    • (Steam Version): <Steam install>\steamapps\common\fuel\shaders
    • (Retail Version) (HD): \Program Files\Codemasters\FUEL\shaders
  2. Make a copy of the fx.phl file, and rename the original to whatever helps you identify it as the original (eg: fx.phl.ORIG)
  3. Right-click on your copy, and "Open" with a text editor (eg: Notepad)
  4. Overwrite the contents of the file with the code below (copy/paste it in)
  5. Save the file
  6. Rename it to fx.phl

Code:

#include "hlsl_math.h"

// Luminance conversion vector
// (commenting out consts & vars that are no longer needed after edits below)
static const float3 LUMINANCE_VECTOR  = float3(0.3f, 0.59f, 0.11f);
//static const float3 BLACKWHITE_VECTOR  = float3(0.2125f, 0.7154f, 0.0721f);

// Sampling offsets and weights for filter kernels
const float3 gSampleOffsetWeight[16];  // xy <=> offset, z <=> weight
const float4 gToneMapping;
//const float4 gBloom;
//const float4 gBlueShift;
//const float4 gTintLerp;

sampler2D	sAdaptedLuminance;
sampler2D	s0 : register(s0);
sampler2D	s1 : register(s1);
//sampler2D	s2 : register(s2);
//sampler2D	s3 : register(s3);
//sampler2D	s4 : register(s4);
//sampler2D	s5 : register(s5);
//sampler2D	s6 : register(s6);

//#define _gToneGrayLevel		gToneMapping.x
//#define _gToneWhiteLevel	gToneMapping.y
#define _gToneMinExposure	gToneMapping.z
#define _gToneMaxExposure	gToneMapping.w
#define	SCREENLUMINANCE		gHDRSettings.y
#define	DTIME_HDR			gHDRSettings.x

// Luminance computation
//-------------------------------------------------------
// (we're on pc, not console, so disable console-specific code)
//#if defined( _X360 ) || defined( _PS3 )
//	#define _PRESHRINKED_TARGET
//#endif

float4 ph_lumlogavg(in float2 vScreenPosition : TEXCOORD0) : COLOR0
{
//	#ifdef _PRESHRINKED_TARGET
//		float3 	vSample 	= UnpackHDRSample( tex2D(s0, vScreenPosition) );
//		float 	Lum 		= dot(vSample, LUMINANCE_VECTOR);
//		float 	fLumSum 	= log( max(Lum,0.001f) );		// Avoid log(0)
//	#else
		float3 vSample 		= 0.0f;
		float  fLumSum 		= 0.0f;
		for(int iSample 	= 0; iSample < 4; iSample++)
		{
			// Compute the sum of log(luminance) throughout the sample points
			vSample 		= tex2D(s1, vScreenPosition+gSampleOffsetWeight[iSample].xy).rgb;
			float Lum 		= dot(vSample, LUMINANCE_VECTOR);
			fLumSum		   += log( max(Lum,0.001f) );		// Avoid log(0)
		}
		// Divide the sum to complete the average
		fLumSum 	   /= 4;
//	#endif
	
	return float4(fLumSum.xxx, 1.0f);
}

float4 ph_lumavg(in float2 vScreenPosition : TEXCOORD0) : COLOR0
{ // (made vSample add all 4 parts in 1 shot during var declaration)
	float 	vSample 	= tex2D(s0, vScreenPosition + gSampleOffsetWeight[0].xy).r
						+ tex2D(s0, vScreenPosition + gSampleOffsetWeight[1].xy).r
						+ tex2D(s0, vScreenPosition + gSampleOffsetWeight[2].xy).r
						+ tex2D(s0, vScreenPosition + gSampleOffsetWeight[3].xy).r;
			vSample	   /= 4;
	return float4(vSample,vSample,vSample,1);
}

float4	ph_lumadaptation() : COLOR0
{
	float 	currentLum = tex2D(s0,float2(0.5,0.5)).x;
			currentLum = 1.5*exp(currentLum)/SCREENLUMINANCE;
			currentLum = max(currentLum,1/_gToneMaxExposure);
			currentLum = min(currentLum,1/_gToneMinExposure);
	float 	adaptedLum = 1/tex2D(s1,float2(0.5,0.5)).x;
			adaptedLum = exp((log(adaptedLum)-log(currentLum))*DTIME_HDR+log(currentLum));
// (made all of this keep using the "adaptedLum" var instead of "newadapt" var)
	adaptedLum= 1/adaptedLum;
	if (!((adaptedLum>0.01)&&(adaptedLum<100)))
		adaptedLum=1/currentLum;
	if (((adaptedLum<0.01)||(adaptedLum>100)))
		adaptedLum=1/currentLum;
	return adaptedLum;
}

float4	ph_lumadaptationinit() : COLOR0
{
// (merged exp into variable declaration calculation)
	float 	currentLum = exp(tex2D(s0,float2(0.5,0.5)).x);
//			currentLum = exp(currentLum);
	return SCREENLUMINANCE/currentLum;
}

//	Bloom
//-------------------------------------------------------
// (disable bloom def's and functions)
//#define BLOOM_LUMSCALE	gBloom.x	// 1.f
//#define BLOOM_BIAS		gBloom.y	// 1.f
//#define BLOOM_SCALE		gBloom.z	// 0.01f
//#define STAR_AMOUNT		gBloom.w	// 2.f

float4	ph_hdrbloominit(in float2 vScreenPosition : TEXCOORD0) : COLOR0
{
//	half3 	vSample = 4*UnpackHDRSample( tex2D(s0, vScreenPosition) );
//			vSample = (vSample * BLOOM_LUMSCALE * (0.3f/SCREENLUMINANCE) * tex2D(s1,float2(0.5f,0.5f)).x - BLOOM_BIAS)*BLOOM_SCALE;
//			vSample = max( 0.0f, vSample );
//	return float4(vSample,1.f);
	return float4(0,0,0,0);
}

float4	ph_hdrbloom(in float2 vScreenPosition : TEXCOORD0) : COLOR0
{
//	float3 vSample = 0.0f;
//	for(int iSample = 0; iSample < 11; iSample++)
//		vSample += gSampleOffsetWeight[iSample].z*tex2D(s0,vScreenPosition+gSampleOffsetWeight[iSample].xy).rgb;
//	return float4(vSample,1.f);
	return float4(0,0,0,0);
}

// Final pass - Tone mapping
//-------------------------------------------------------
//static const float cDodging = 0.f; // (disabled, b/c it's 0, so worthless)

// Adapt luminance of the scene
float4 ph_tonemapping(in float2 vScreenPosition : TEXCOORD0) : COLOR0
{
	float2	new_vScreenPosition	= vScreenPosition;
	float4  vSample 			= tex2D(s0,new_vScreenPosition);
			vSample.rgb 		= UnpackHDRSample( vSample );
	float   fAdaptedLum 		= tex2D(s1,float2(0.5f,0.5f)).x;

// (disable bloom calcs)
	// SEB: Le bloom sur pc est décale. Il daut ajouter 2 pixel pour le centrer???
//	float2	bloomsource			= vScreenPosition+float2(1.f/128,1.f/128.f);
//	half3	vBloom0 			= h3tex2D(s2, bloomsource).rgb;
//	half3	vBloom1 			= h3tex2D(s3, bloomsource).rgb;
//	half3	vBloom2 			= h3tex2D(s4, bloomsource).rgb;

	// Blue shift (disabled, experimented, and doesn't seem to do anything)
//	float3 	blackandwhite 		= dot(vSample.rgb,BLACKWHITE_VECTOR);
//	float3 	blue 				= gBlueShift.xyz*blackandwhite;
//	float3 	blueAmount 			= 1 - min(1,gBlueShift.w*blackandwhite);
//	float3 	blueAmount 			= pow(1 - min(1,gBlueShift.w*blackandwhite),2); // square the blueAmount directly
//			blueAmount 			= blueAmount*blueAmount;
//			vSample.rgb 		= lerp(vSample.rgb,blue,blueAmount);

			
	// Dodging and lum adaptation (disabled cDodging, since it was just adding 0)
			vSample.rgb 		= vSample.rgb * fAdaptedLum; // + cDodging;

	// Blend with bloom (disabled)
//			vSample.rgb 		= vSample.rgb + vBloom0 + STAR_AMOUNT * (vBloom1+vBloom2);

	// Map the high range of color values into a range appropriate for display
	float3	vx1					= vSample.rgb;
	float3	vx2					= vx1*vx1;
	float3	vx3					= vx2*vx1;
	float3	vx4					= vx2*vx2;
	float3	val					= vx1+vx2+vx3+vx4;
			vSample.rgb			= val/(1+val);

	// Lerp between tintcolor and color buffer (disabled, gets rid of yellow sepia in pause/menu)
//	float  	brightness			= dot(vSample.rgb,BLACKWHITE_VECTOR);
//	float3 	tintcolor			= brightness*gTintLerp.rgb;
//			vSample.rgb 		= lerp(vSample.rgb,tintcolor.rgb,gTintLerp.a);

	return float4(vSample.rgb,1);
}

/* Shrinking & Vignetting functions aren't used, so deleted */

Note: This can also be done by downloading / installing the FUEL: REFUELED mod


Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.