Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- // ENBSeries Fallout 4 hlsl DX11 format, sample file of bloom
- // visit http://enbdev.com for updates
- // Author: Boris Vorontsov
- // It's works with hdr input and output
- // Bloom texture is always forced to 1024*1024 resolution
- //
- // With some additions from Natural Bloom.
- // Credits to MaxTheUniqueGamer, JawZ, Wolrajh,
- // and several others on the ENB forums.
- //
- // With gaussian-like "Kawase blur" bloom. v1.1
- // Ported by roxahris. Original algorithms by Filip S. and Masaki Kawase.
- // Additional credits are below near the code.
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //+++++++++++++++++++++++++++++
- //internal parameters, modify or add new
- //+++++++++++++++++++++++++++++
- /*
- //example parameters with annotations for in-game editor
- float ExampleScalar
- <
- string UIName="Example scalar";
- string UIWidget="spinner";
- float UIMin=0.0;
- float UIMax=1000.0;
- > = {1.0};
- float3 ExampleColor
- <
- string UIName = "Example color";
- string UIWidget = "color";
- > = {0.0, 1.0, 0.0};
- float4 ExampleVector
- <
- string UIName="Example vector";
- string UIWidget="vector";
- > = {0.0, 1.0, 0.0, 0.0};
- int ExampleQuality
- <
- string UIName="Example quality";
- string UIWidget="quality";
- int UIMin=0;
- int UIMax=3;
- > = {1};
- Texture2D ExampleTexture
- <
- string UIName = "Example texture";
- string ResourceName = "test.bmp";
- >;
- SamplerState ExampleSampler
- {
- Filter = MIN_MAG_MIP_LINEAR;
- AddressU = Clamp;
- AddressV = Clamp;
- };
- */
- //#define RuntimeScale
- #ifdef RuntimeScale
- float scale <
- string UIName="ENB Bloom: Scale";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=32.0;
- float UIStep=0.01;
- > = {4.0};
- #endif
- //+++++++++++++++++++++++++++++
- //external enb parameters, do not modify
- //+++++++++++++++++++++++++++++
- //x = generic timer in range 0..1, period of 16777216 ms (4.6 hours), y = average fps, w = frame time elapsed (in seconds)
- float4 Timer;
- //x = Width, y = 1/Width, z = aspect, w = 1/aspect, aspect is Width/Height
- float4 ScreenSize;
- //+++++++++++++++++++++++++++++
- //external enb debugging parameters for shader programmers, do not modify
- //+++++++++++++++++++++++++++++
- //keyboard controlled temporary variables. Press and hold key 1,2,3...8 together with PageUp or PageDown to modify. By default all set to 1.0
- float4 tempF1; //0,1,2,3
- float4 tempF2; //5,6,7,8
- float4 tempF3; //9,0
- // xy = cursor position in range 0..1 of screen;
- // z = is shader editor window active;
- // w = mouse buttons with values 0..7 as follows:
- // 0 = none
- // 1 = left
- // 2 = right
- // 3 = left+right
- // 4 = middle
- // 5 = left+middle
- // 6 = right+middle
- // 7 = left+right+middle (or rather cat is sitting on your mouse)
- float4 tempInfo1;
- // xy = cursor position of previous left mouse button click
- // zw = cursor position of previous right mouse button click
- float4 tempInfo2;
- //+++++++++++++++++++++++++++++
- //mod parameters, do not modify
- //+++++++++++++++++++++++++++++
- Texture2D TextureDownsampled; //color R16B16G16A16 64 bit or R11G11B10 32 bit hdr format. 1024*1024 size
- Texture2D TextureColor; //color which is output of previous technique (except when drawed to temporary render target), R16B16G16A16 64 bit hdr format. 1024*1024 size
- Texture2D TextureOriginal; //color R16B16G16A16 64 bit or R11G11B10 32 bit hdr format, screen size. PLEASE AVOID USING IT BECAUSE OF ALIASING ARTIFACTS, UNLESS YOU FIX THEM
- Texture2D TextureDepth; //scene depth R32F 32 bit hdr format, screen size. PLEASE AVOID USING IT BECAUSE OF ALIASING ARTIFACTS, UNLESS YOU FIX THEM
- Texture2D TextureAperture; //this frame aperture 1*1 R32F hdr red channel only. computed in PS_Aperture of enbdepthoffield.fx
- //temporary textures which can be set as render target for techniques via annotations like <string RenderTarget="RenderTargetRGBA32";>
- Texture2D RenderTarget1024; //R16B16G16A16F 64 bit hdr format, 1024*1024 size
- Texture2D RenderTarget512; //R16B16G16A16F 64 bit hdr format, 512*512 size
- Texture2D RenderTarget256; //R16B16G16A16F 64 bit hdr format, 256*256 size
- Texture2D RenderTarget128; //R16B16G16A16F 64 bit hdr format, 128*128 size
- Texture2D RenderTarget64; //R16B16G16A16F 64 bit hdr format, 64*64 size
- Texture2D RenderTarget32; //R16B16G16A16F 64 bit hdr format, 32*32 size
- Texture2D RenderTarget16; //R16B16G16A16F 64 bit hdr format, 16*16 size
- Texture2D RenderTargetRGBA32; //R8G8B8A8 32 bit ldr format, screen size
- Texture2D RenderTargetRGBA64F; //R16B16G16A16F 64 bit hdr format, screen size
- SamplerState Sampler0
- {
- Filter = MIN_MAG_MIP_POINT;
- AddressU = Clamp;
- AddressV = Clamp;
- };
- SamplerState Sampler1
- {
- Filter = MIN_MAG_MIP_LINEAR;
- AddressU = Clamp;
- AddressV = Clamp;
- };
- //+++++++++++++++++++++++++++++
- //
- //+++++++++++++++++++++++++++++
- struct VS_INPUT_POST
- {
- float3 pos : POSITION;
- float2 txcoord : TEXCOORD0;
- };
- struct VS_OUTPUT_POST
- {
- float4 pos : SV_POSITION;
- float2 txcoord0 : TEXCOORD0;
- };
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
- {
- VS_OUTPUT_POST OUT;
- float4 pos;
- pos.xyz=IN.pos.xyz;
- pos.w=1.0;
- OUT.pos=pos;
- OUT.txcoord0.xy=IN.txcoord.xy;
- return OUT;
- }
- float linearDepth(float d, float n, float f)
- {
- return (2.0 * n)/(f + n - d * (f - n));
- }
- // SHADERS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //
- float3 FuncBlur(Texture2D inputtex, float2 uvsrc, float srcsize, float destsize)
- {
- #ifndef RuntimeScale
- const float scale=8.0; //7.0; //14.0; //blurring range, samples count (performance) is factor of scale*scale
- #endif
- float2 invtargetsize=scale/srcsize;
- invtargetsize.y*=ScreenSize.z; //correct by aspect ratio
- float2 fstepcount;
- fstepcount=srcsize;
- fstepcount*=invtargetsize;
- #if 0
- fstepcount=min(fstepcount, 32.0); // Steps upper limit
- fstepcount=max(fstepcount, 1.0); // Steps lower limit
- #elif 0
- fstepcount=min(fstepcount, 16.0);
- fstepcount=max(fstepcount, 1.0);
- #else
- fstepcount=min(fstepcount, 48.0);
- fstepcount=max(fstepcount, 1.0);
- #endif
- int stepcountX=(int)(fstepcount.x+0.4999);
- int stepcountY=(int)(fstepcount.y+0.4999);
- fstepcount=1.0/fstepcount;
- float4 curr=0.0;
- curr.w=0.000001;
- float2 pos;
- float2 halfstep=0.5*fstepcount.xy;
- pos.x=-0.5+halfstep.x;
- invtargetsize *= 2.0;
- for (int x=0; x<stepcountX; x++)
- {
- pos.y=-0.5+halfstep.y;
- for (int y=0; y<stepcountY; y++)
- {
- float2 coord=pos.xy * invtargetsize + uvsrc.xy;
- float3 tempcurr=inputtex.Sample(Sampler1, coord.xy).xyz;
- float tempweight;
- float2 dpos=pos.xy*2.0;
- float rangefactor=dot(dpos.xy, dpos.xy);
- //loosing many pixels here, don't program such unefficient cycle yourself!
- tempweight=saturate(1001.0 - 1000.0*rangefactor);//arithmetic version to cut circle from square
- tempweight*=saturate(1.0 - rangefactor); //softness, without it bloom looks like bokeh dof
- curr.xyz+=tempcurr.xyz * tempweight;
- curr.w+=tempweight;
- pos.y+=fstepcount.y;
- }
- pos.x+=fstepcount.x;
- }
- curr.xyz/=curr.w;
- return curr.xyz;
- }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //example 1. draw in single pass directly to bloom texture of 1024*1024 size
- float4 PS_ExampleBloom1(VS_OUTPUT_POST IN, float4 v0 : SV_Position0,
- uniform Texture2D inputtex, uniform float srcsize, uniform float destsize) : SV_Target
- {
- float4 res;
- res.xyz=FuncBlur(inputtex, IN.txcoord0.xy, srcsize, destsize);
- res=max(res, 0.0);
- res=min(res, 16384.0);
- res.w=1.0;
- return res;
- }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //example 2. draw in several passes to different render targets
- float4 PS_Resize(VS_OUTPUT_POST IN, float4 v0 : SV_Position0,
- uniform Texture2D inputtex, uniform float srcsize, uniform float destsize) : SV_Target
- {
- float4 res;
- res.xyz=FuncBlur(inputtex, IN.txcoord0.xy, srcsize, destsize);
- res=max(res, 0.0);
- res=min(res, 16384.0);
- res.w=1.0;
- return res;
- }
- float4 PS_ResizeFirst(VS_OUTPUT_POST IN, float4 v0 : SV_Position0,
- uniform Texture2D inputtex, uniform float srcsize, uniform float destsize) : SV_Target
- {
- float4 res;
- res.xyz=FuncBlur(inputtex, IN.txcoord0.xy, srcsize, destsize);
- res=max(res, 0.0);
- res=min(res, 16384.0);
- res.w=1.0;
- return res;
- }
- float4 PS_BloomMix(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target
- {
- float4 res;
- #if 0
- res.xyz=RenderTarget1024.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget512.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget256.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget128.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget64.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget32.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz /= 6;
- #else
- res.xyz=RenderTarget1024.Sample(Sampler1, IN.txcoord0.xy)*0.5;
- res.xyz+=RenderTarget512.Sample(Sampler1, IN.txcoord0.xy)*0.8*0.75;
- res.xyz+=RenderTarget256.Sample(Sampler1, IN.txcoord0.xy)*0.6;
- res.xyz+=RenderTarget128.Sample(Sampler1, IN.txcoord0.xy)*0.45;
- res.xyz+=RenderTarget64.Sample(Sampler1, IN.txcoord0.xy) *0.32;
- res.xyz+=RenderTarget32.Sample(Sampler1, IN.txcoord0.xy) *0.23;
- res.xyz /= 2.2;
- #endif
- res=max(res, 0.0);
- res=min(res, 16384.0);
- res.w=1.0;
- return res;
- }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- // Kawase blur bloom.
- // This is supposedly a very fast approximation of a gaussian blur.
- // Source: https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms
- float3 KawaseBlurFilter( Texture2D tex, float2 texCoord, float2 pixelSize, float iteration )
- {
- float2 texCoordSample;
- float2 halfPixelSize = pixelSize / 2.0f;
- float2 dUV = ( pixelSize.xy * float2( iteration, iteration ) ) + halfPixelSize.xy;
- float3 cOut;
- // Sample top left pixel
- texCoordSample.x = texCoord.x - dUV.x;
- texCoordSample.y = texCoord.y + dUV.y;
- cOut = tex.Sample(Sampler1, texCoordSample ).xyz;
- // Sample top right pixel
- texCoordSample.x = texCoord.x + dUV.x;
- texCoordSample.y = texCoord.y + dUV.y;
- cOut += tex.Sample(Sampler1, texCoordSample ).xyz;
- // Sample bottom right pixel
- texCoordSample.x = texCoord.x + dUV.x;
- texCoordSample.y = texCoord.y - dUV.y;
- cOut += tex.Sample(Sampler1, texCoordSample ).xyz;
- // Sample bottom left pixel
- texCoordSample.x = texCoord.x - dUV.x;
- texCoordSample.y = texCoord.y - dUV.y;
- cOut += tex.Sample(Sampler1, texCoordSample ).xyz;
- // Average
- cOut *= 0.25f;
- return cOut;
- }
- float4 PS_KawaseBloom(VS_OUTPUT_POST IN, float4 v0 : SV_Position0,
- uniform Texture2D inputtex, uniform float destsize, uniform float iteration) : SV_Target
- {
- float4 res;
- //float2 pxSize = (1/destsize)*float2(1, ScreenSize.z); // Visibly blocky
- float2 pxSize = (1/(destsize*2))*float2(1, ScreenSize.z);
- res.xyz=KawaseBlurFilter(inputtex, IN.txcoord0.xy, pxSize, iteration);
- #if 0 // Double blur. This removes artifacing in the raw bloom texture.
- // However, it costs more than ENB's bloom and does like 60 passes.
- // The aliasing is only noticeable at 100% bloom anyway.
- res.xyz+=KawaseBlurFilter(inputtex, IN.txcoord0.xy, pxSize, iteration+1);
- res.xyz/=2;
- #endif
- res=max(res, 0.0);
- res=min(res, 16384.0);
- res.w=1.0;
- return res;
- }
- float4 PS_KawaseMix(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target
- {
- float4 res;
- res.xyz=RenderTarget1024.Sample(Sampler1, IN.txcoord0.xy);
- res=max(res, 0.0);
- res=min(res, 16384.0);
- res.w=1.0;
- return res;
- }
- float4 PS_KawaseMix2(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target
- {
- float4 res=0;
- #if 0
- res.xyz=RenderTarget1024.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget512.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget256.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget128.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget64.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz+=RenderTarget32.Sample(Sampler1, IN.txcoord0.xy);
- res.xyz /= 6;
- #else
- res.xyz=RenderTarget1024.Sample(Sampler1, IN.txcoord0.xy)*0.5;
- res.xyz+=RenderTarget512.Sample(Sampler1, IN.txcoord0.xy)*0.8*0.75;
- res.xyz+=RenderTarget256.Sample(Sampler1, IN.txcoord0.xy)*0.6;
- res.xyz+=RenderTarget128.Sample(Sampler1, IN.txcoord0.xy)*0.45;
- res.xyz+=RenderTarget64.Sample(Sampler1, IN.txcoord0.xy) *0.32;
- res.xyz+=RenderTarget32.Sample(Sampler1, IN.txcoord0.xy) *0.23;
- res.xyz /= 2.2;
- #endif
- res=max(res, 0.0);
- res=min(res, 16384.0);
- res.w=1.0;
- return res;
- }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- // Techniques are drawn one after another and they use the result of
- // the previous technique as input color to the next one. The number
- // of techniques is limited to 255. If UIName is specified, then it
- // is a base technique which may have extra techniques with indexing
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- technique11 KawaseBloomPass <string UIName="Kawase blur bloom (5 passes)"; string RenderTarget="RenderTarget1024";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureDownsampled, 1024.0, 0)));
- }
- }
- technique11 KawaseBloomPass1
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(RenderTarget1024, 1024.0, 1)));
- }
- }
- technique11 KawaseBloomPass2
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 1024.0, 2)));
- }
- }
- technique11 KawaseBloomPass3
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 1024.0, 2)));
- }
- }
- technique11 KawaseBloomPass4 <string RenderTarget="RenderTarget1024";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 1024.0, 3)));
- }
- }
- technique11 KawaseBloomPass5
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseMix()));
- }
- }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- technique11 MKawaseBloomPass <string UIName="Kawase blur bloom (25 passes)"; string RenderTarget="RenderTarget1024";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureDownsampled, 1024.0, 0)));
- }
- }
- technique11 MKawaseBloomPass1 <string RenderTarget="RenderTarget512";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(RenderTarget1024, 512.0, 1)));
- }
- }
- technique11 MKawaseBloomPass2 <string RenderTarget="RenderTarget256";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(RenderTarget512, 256.0, 1)));
- }
- }
- technique11 MKawaseBloomPass3 <string RenderTarget="RenderTarget128";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(RenderTarget256, 128.0, 1)));
- }
- }
- technique11 MKawaseBloomPass4 <string RenderTarget="RenderTarget64";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(RenderTarget128, 64.0, 1)));
- }
- }
- technique11 MKawaseBloomPass5 <string RenderTarget="RenderTarget32";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(RenderTarget64, 32.0, 1)));
- }
- }
- // Passes 1024
- technique11 MKawaseBloomPass6
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(RenderTarget1024, 1024.0, 1)));
- }
- }
- technique11 MKawaseBloomPass7
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 1024.0, 2)));
- }
- }
- technique11 MKawaseBloomPass8
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 1024.0, 2)));
- }
- }
- technique11 MKawaseBloomPass9 <string RenderTarget="RenderTarget1024";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 1024.0, 3)));
- }
- }
- // Passes 512
- technique11 MKawaseBloomPass10
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 512.0, 2)));
- }
- }
- technique11 MKawaseBloomPass11
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 512.0, 2)));
- }
- }
- technique11 MKawaseBloomPass12 <string RenderTarget="RenderTarget512";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 512.0, 3)));
- }
- }
- // Passes 256
- technique11 MKawaseBloomPass13
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 256.0, 2)));
- }
- }
- technique11 MKawaseBloomPass14
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 256.0, 2)));
- }
- }
- technique11 MKawaseBloomPass15 <string RenderTarget="RenderTarget256";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 256.0, 3)));
- }
- }
- // Passes 128
- technique11 MKawaseBloomPass16
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 128.0, 2)));
- }
- }
- technique11 MKawaseBloomPass17
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 128.0, 2)));
- }
- }
- technique11 MKawaseBloomPass18 <string RenderTarget="RenderTarget128";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 128.0, 3)));
- }
- }
- // Passes 64
- technique11 MKawaseBloomPass19
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 64.0, 2)));
- }
- }
- technique11 MKawaseBloomPass20
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 64.0, 2)));
- }
- }
- technique11 MKawaseBloomPass21 <string RenderTarget="RenderTarget64";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 64.0, 3)));
- }
- }
- // Passes 32
- technique11 MKawaseBloomPass22
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 32.0, 2)));
- }
- }
- technique11 MKawaseBloomPass23
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 32.0, 2)));
- }
- }
- technique11 MKawaseBloomPass24 <string RenderTarget="RenderTarget32";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseBloom(TextureColor, 32.0, 3)));
- }
- }
- // End
- technique11 MKawaseBloomPass25
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_KawaseMix2()));
- }
- }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //bloom example 1, draw in single pass, very performance heavy and low blurring range
- technique11 SinglePassBloom <string UIName="Single pass bloom";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_ExampleBloom1(TextureDownsampled, 1024.0, 1024.0)));
- }
- }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //bloom example 2, draw using several techniques and several render targets
- technique11 MultiPassBloom <string UIName="Multipass bloom"; string RenderTarget="RenderTarget1024";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_ResizeFirst(TextureDownsampled, 1024.0, 1024.0)));
- }
- }
- technique11 MultiPassBloom1 <string RenderTarget="RenderTarget512";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_Resize(RenderTarget1024, 1024.0, 512.0)));
- }
- }
- technique11 MultiPassBloom2 <string RenderTarget="RenderTarget256";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_Resize(RenderTarget512, 512.0, 256.0)));
- }
- }
- technique11 MultiPassBloom3 <string RenderTarget="RenderTarget128";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_Resize(RenderTarget256, 256.0, 128.0)));
- }
- }
- technique11 MultiPassBloom4 <string RenderTarget="RenderTarget64";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_Resize(RenderTarget128, 128.0, 64.0)));
- }
- }
- technique11 MultiPassBloom5 <string RenderTarget="RenderTarget32";>
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_Resize(RenderTarget64, 64.0, 32.0)));
- }
- }
- //in last pass output to bloom texture
- technique11 MultiPassBloom6
- {
- pass p0
- {
- SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
- SetPixelShader(CompileShader(ps_5_0, PS_BloomMix()));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement