OyamaOyama wrote:Saberus
Are you just working with the right shader ?
I know it sounds like a noob question , apologizes if so.
Lenz related codes have been ported to enblens from enbbloom some time ago.
Yeah i know about the lenz shader ;p
But this bloom code is not working from ENB 0.166 and external lenz shader was introduced in ENB 0.223, so Boris has cut something or change variables, but let's say i'm gonna move lenz parameters from bloom to lenz shader so exactly what lines should i remove from bloom and put in lenz ?
This is the new code compared to standard .251 bloom file:
Code: Select all
float TBloomContrast=10.0;//tweak this
float maxb=max(bloom.x, max(bloom.y, bloom.z));
float tempnorb=(maxb/(1.0+maxb));
tempnorb=pow(tempnorb, TBloomContrast);
bloom.xyz*=tempnorb;
float3 lenz=0;
float2 lenzuv=0.0;
//deepness, curvature, inverse size
const float3 offset[4]=
{
float3(1.6, 4.0, 1.0),
float3(0.7, 0.25, 2.0),
float3(0.3, 1.5, 0.5),
float3(-0.5, 1.0, 1.0)
};
//color filter per reflection
const float3 factors[4]=
{
float3(1.0, 1.0, 1.0),
float3(1.0, 1.0, 1.0),
float3(1.0, 1.0, 1.0),
float3(1.0, 1.0, 1.0)
};
//lenzuv.xy=0.5-lenzuv.xy;
//distfact=0.5-lenzuv.xy-0.5;
if (LenzParameters.x>0.00001)
{
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;//v1
// lenzuv.xy=In.txcoord0.xy-lenzuv.xy;//v2
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
// templenz=factors[i] * (1.0-dot(distfact,distfact));
float maxlenz=max(templenz.x, max(templenz.y, templenz.z));
/* float3 tempnor=(templenz.xyz/maxlenz);
tempnor=pow(tempnor, tempF1.z);
templenz.xyz=tempnor.xyz*maxlenz;
*/
float maxlenz=max(templenz.x, max(templenz.y, templenz.z));
float tempnor=(maxlenz/(1.0+maxlenz));
tempnor=pow(tempnor, LenzParameters.y);
templenz.xyz*=tempnor;
// templenz*=maxlenz*maxlenz;
lenz+=templenz;
// lenz.xyz=max(lenz.xyz, templenz.xyz*0.99);
}
lenz.xyz*=0.25*LenzParameters.x;
bloom.xyz+=lenz.xyz;
// bloom.w=dot(lenz.xyz, 0.333);
bloom.w=max(lenz.xyz, max(lenz.y, lenz.z));
}