Page 1 of 1

Add a lens flare

Posted: 28 Aug 2013, 20:30
by muro808
I am making my custom, private enb, but i would like to know how to add lens flares.
I used the god rays only enb on skyrim nexus as a start, but i enable bloom and adjusted the camerafx in enbseries.ini, but i still have no lens flares...
Any way to enable this? (not the sunsprite lens flares)

Re: Add a lens flare

Posted: 29 Aug 2013, 17:37
by insomnia_jt
Be sure this is in your enbbloom.fx.

Code: Select all

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
	if (LenzParameters.x > 0.00001)    //If this is modified like 10.00001 lenz wont show up
	{
		for (int i = 0; i < 4; i++)
		{
			float2 distfact = (In.txcoord0.xy - 0.5);
			lenzuv.xy = offset[i].x * distfact;
			lenzuv.xy *= pow(2.0 * length(float2(distfact.x * ScreenSize.z, distfact.y)), offset[i].y);
			lenzuv.xy *= offset[i].z;
			lenzuv.xy = 0.5 - lenzuv.xy;
			
			float3 templenz = tex2D(SamplerBloom2, lenzuv.xy);
			templenz = templenz * factors[i];
			distfact = (lenzuv.xy-0.5);
			distfact *= 2.0;
			templenz *= saturate(1.0 - dot(distfact, distfact));//limit by uv 0..1
			
			float maxlenz = max(templenz.x, max(templenz.y, templenz.z));
			float tempnor = (maxlenz / (1.0 + maxlenz));
			tempnor = pow(tempnor, LenzParameters.y);
			templenz.xyz *= tempnor;
			
			lenz += templenz;
		}
		lenz.xyz *= 0.25 * LenzParameters.x;

		bloom.xyz += lenz.xyz;
		bloom.w = max(lenz.xyz, max(lenz.y, lenz.z));
	}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
	return bloom;
}