//++++++++++++++++++++++++++++++ // Very simple DOF by icelaglace // This is for CryENB only at the moment //++++++++++++++++++++++++++++++ // 1.25 is by default, you can increase at your own risk. :) float bokehSizeMult = 1.25; // then all that sh*t is not meant to be tweakable. #define PI 3.1415 float4 ScreenSize; texture2D texColor; sampler2D SamplerColor = sampler_state { Texture = ; MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = NONE;//NONE; AddressU = Clamp; AddressV = Clamp; SRGBTexture=FALSE; MaxMipLevel=0; MipMapLodBias=0; }; struct VS_OUTPUT_POST{float4 vpos:POSITION;float2 txcoord:TEXCOORD0;};struct VS_OUTPUT_DOF{float4 vpos:POSITION;float2 txcoord:TEXCOORD0;float focaldepth:TEXCOORD1;};struct VS_INPUT_POST{float3 pos:POSITION;float2 txcoord:TEXCOORD0;}; VS_OUTPUT_POST D(VS_INPUT_POST t){VS_OUTPUT_POST f;float4 y=float4(t.pos.x,t.pos.y,t.pos.z,1.);f.vpos=y;f.txcoord.xy=t.txcoord.xy;return f;}float t(float y){return 1.f-1.f/y;}float D(){float f=0,y=.05;for(int r=0;r<6;r++){float S=(float)r;S*=PI*2/6;float2 s=float2(cos(S),sin(S));s.y*=ScreenSize.z;s*=y;float z=t(tex2Dlod(SamplerColor,float4(s+float2(.5,.5),0,0)).w);f+=z;}return f/6;}VS_OUTPUT_DOF s(VS_INPUT_POST t){VS_OUTPUT_DOF f;float4 y=float4(t.pos.x,t.pos.y,t.pos.z,1.);f.vpos=y;f.txcoord.xy=t.txcoord.xy;f.focaldepth=D();return f;}float2 D(float r,float z,float S){float f=6.28318*(1./z)*(S+r);return float2(sin(f),cos(f));}float4 fu(VS_OUTPUT_DOF z,float2 f:VPOS):COLOR{float2 y=z.txcoord.xy;float4 S=tex2D(SamplerColor,y);float s=t(S.w),r=z.focaldepth,V=abs(s-r);V=sqrt(V);if(s