summaryrefslogtreecommitdiffstats
path: root/Studio/Content/Effect Library
diff options
context:
space:
mode:
Diffstat (limited to 'Studio/Content/Effect Library')
-rw-r--r--Studio/Content/Effect Library/AdditiveColorGradient.effect32
-rw-r--r--Studio/Content/Effect Library/BaseEffect.effect30
-rw-r--r--Studio/Content/Effect Library/Bloom.effect200
-rw-r--r--Studio/Content/Effect Library/Blur.effect47
-rw-r--r--Studio/Content/Effect Library/Brush Strokes.effect38
-rw-r--r--Studio/Content/Effect Library/ChromaticAberration.effect56
-rw-r--r--Studio/Content/Effect Library/ColorMaster.effect38
-rw-r--r--Studio/Content/Effect Library/Corona.effect97
-rw-r--r--Studio/Content/Effect Library/Depth Of Field Bokeh.effect302
-rw-r--r--Studio/Content/Effect Library/Depth Of Field HQ Blur.effect67
-rw-r--r--Studio/Content/Effect Library/Desaturate.effect35
-rw-r--r--Studio/Content/Effect Library/Distortion Ripple.effect50
-rw-r--r--Studio/Content/Effect Library/Distortion Sphere.effect46
-rw-r--r--Studio/Content/Effect Library/Distortion Spiral.effect51
-rw-r--r--Studio/Content/Effect Library/Edge Detect.effect81
-rw-r--r--Studio/Content/Effect Library/Emboss.effect41
-rw-r--r--Studio/Content/Effect Library/FXAA.effect51
-rw-r--r--Studio/Content/Effect Library/FrameFlipper.effect41
-rw-r--r--Studio/Content/Effect Library/FullScreenTextureOverlay.effect27
-rw-r--r--Studio/Content/Effect Library/Gaussian Blur.effect48
-rw-r--r--Studio/Content/Effect Library/HDRBloomTonemap.effect282
-rw-r--r--Studio/Content/Effect Library/LightTable.effect233
-rw-r--r--Studio/Content/Effect Library/Motion Blur.effect76
-rw-r--r--Studio/Content/Effect Library/SCurveTonemap.effect117
-rw-r--r--Studio/Content/Effect Library/SMAA1X.effect149
-rw-r--r--Studio/Content/Effect Library/Screen Space AO.effect90
-rw-r--r--Studio/Content/Effect Library/Sepia.effect64
-rw-r--r--Studio/Content/Effect Library/Stylize - Scatter.effect47
-rw-r--r--Studio/Content/Effect Library/Tilt Shift.effect111
-rw-r--r--Studio/Content/Effect Library/VignetteEffect.effect39
-rw-r--r--Studio/Content/Effect Library/maps/effects/AreaTex-yflipped.ddsbin0 -> 179328 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/AreaTex-yflipped.pngbin0 -> 26679 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/CircleBokeh.pngbin0 -> 1718 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/HexagonalBokeh.pngbin0 -> 910 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/SearchTex-yflipped.pngbin0 -> 180 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/brushnoise.ddsbin0 -> 65664 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/brushnoise.pngbin0 -> 61885 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/noise.ddsbin0 -> 4224 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/noise.pngbin0 -> 3251 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/noise3.ddsbin0 -> 349652 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/noise3.pngbin0 -> 9288 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/noiseUniform.ddsbin0 -> 262272 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/noiseUniform.pngbin0 -> 262990 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/ps_cloudlet.pngbin0 -> 2807 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/ps_glowDisc.pngbin0 -> 2329 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/ps_glowSphere.pngbin0 -> 2382 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/ps_rectangle.pngbin0 -> 1285 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/ps_sphere.ddsbin0 -> 16512 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/ps_sphere.pngbin0 -> 789 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/ps_star.pngbin0 -> 6760 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/snownoise.ddsbin0 -> 1048704 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/snownoise.pngbin0 -> 50015 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/starBokeh.pngbin0 -> 1326 bytes
-rw-r--r--Studio/Content/Effect Library/maps/effects/white.pngbin0 -> 189 bytes
54 files changed, 2586 insertions, 0 deletions
diff --git a/Studio/Content/Effect Library/AdditiveColorGradient.effect b/Studio/Content/Effect Library/AdditiveColorGradient.effect
new file mode 100644
index 0000000..7131963
--- /dev/null
+++ b/Studio/Content/Effect Library/AdditiveColorGradient.effect
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property formalName="Top Color" name="top_color" type="Color" default="0.65 0.35 0.15" description="Top color of the gradient."/>
+ <Property formalName="Bottom Color" name="bottom_color" type="Color" default="0.05 0.35 0.75" description="Bottom color of the gradient."/>
+ </MetaData>
+ <Shaders>
+ <Shared></Shared>
+ <VertexShaderShared></VertexShaderShared>
+ <FragmentShaderShared></FragmentShaderShared>
+ <Shader name="main">
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+
+void frag()
+{
+ vec4 origColor = texture2D_0(TexCoord);
+ vec2 uv = TexCoord.xy;
+
+ vec4 gradient = vec4(mix(vec4(bottom_color.rgb, 1.0), vec4(top_color.rgb, 1.0), uv.y));
+
+ gl_FragColor = origColor + gradient;
+}
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/BaseEffect.effect b/Studio/Content/Effect Library/BaseEffect.effect
new file mode 100644
index 0000000..f0f5340
--- /dev/null
+++ b/Studio/Content/Effect Library/BaseEffect.effect
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ </MetaData>
+ <Shaders>
+ <Shared></Shared>
+ <VertexShaderShared></VertexShaderShared>
+ <FragmentShaderShared></FragmentShaderShared>
+ <Shader name="main">
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+
+void frag()
+{
+ // save original fragments to a variable
+ vec4 original = texture2D_0(TexCoord);
+
+ //output the unmodified original fragments;
+ gl_FragColor = original;
+}
+
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/Bloom.effect b/Studio/Content/Effect Library/Bloom.effect
new file mode 100644
index 0000000..97f9c12
--- /dev/null
+++ b/Studio/Content/Effect Library/Bloom.effect
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="Threshold" formalName="Threshold of the luminocity pass" description="Objects brighter than this will\nbe part of the filter" min=".1" max=".98" default=".8" />
+ <Property name="PoissonRotation" hidden="True" default="0"/>
+ <Property name="PoissonDistance" hidden="True" default="4"/>
+ <Property name="Downsample2" filter="linear" clamp="clamp" type="Texture" />
+ <Property name="Downsample4" filter="linear" clamp="clamp" type="Texture" />
+ <Property name="Downsample8" filter="linear" clamp="clamp" type="Texture" />
+ <Property name="Downsample16" filter="linear" clamp="clamp" type="Texture" />
+ <Property name="DepthSampler" type="Texture" filter="nearest" clamp="clamp"/>
+ </MetaData>
+ <Shaders>
+ <Shared>
+#include "blur.glsllib"
+varying float range;
+ </Shared>
+ <Shader name="CLEARPASS">
+ <VertexShader>
+// Range of possible values that we care about.
+void vert ()
+{
+
+}
+ </VertexShader>
+ <FragmentShader>
+void frag() // Luminosity pass with exponential color channel decay based on the threshold above.
+{
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="STENCILPASS">
+ <VertexShader>
+// Range of possible values that we care about.
+void vert ()
+{
+
+}
+ </VertexShader>
+ <FragmentShader>
+void frag() // Luminosity pass with exponential color channel decay based on the threshold above.
+{
+ gl_FragColor = texture2D_0(TexCoord);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="LUMINOSITY">
+ <VertexShader>
+// No op
+void vert ()
+{
+
+}
+ </VertexShader>
+ <FragmentShader>
+void frag() // Luminosity pass with exponential color channel decay based on the threshold above.
+{
+ vec4 color = texture2D_0(TexCoord);
+ float luminosity = dot(color.rgb, vec3(0.299, 0.587, 0.114));
+ float decay = min( 1.0, max( 0.0, (luminosity - Threshold) / range ) );
+ decay = decay * decay;
+ gl_FragColor = vec4( color.rgb * decay, color.a );
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BLUR">
+ <VertexShader>
+
+vec2 ToRotatedPoissonTexCoord( vec3 poisson, vec2 inputTex, vec2 inc, mat2 rotation )
+{
+ vec2 rotatedPoisson = rotation * vec2( poisson.xy );
+ return vec2( inputTex.x + rotatedPoisson.x * inc.x, inputTex.y + rotatedPoisson.y * inc.y );
+}
+
+void SetupPoissonBlurCoordsRotation(float inBlurAmount, vec2 inTexInfo, float inRotationRadians )
+{
+ float incX = inBlurAmount / inTexInfo.x;
+ float incY = inBlurAmount / inTexInfo.y;
+ float rotCos = cos( inRotationRadians );
+ float rotSin = sin( inRotationRadians );
+ mat2 rotMatrix = mat2( rotCos, rotSin, -rotSin, rotCos );
+ vec2 incVec = vec2( incX, incY );
+
+ TexCoord0 = ToRotatedPoissonTexCoord( poisson0, TexCoord, incVec, rotMatrix );
+ TexCoord1 = ToRotatedPoissonTexCoord( poisson1, TexCoord, incVec, rotMatrix );
+ TexCoord2 = ToRotatedPoissonTexCoord( poisson2, TexCoord, incVec, rotMatrix );
+ TexCoord3 = ToRotatedPoissonTexCoord( poisson3, TexCoord, incVec, rotMatrix );
+ TexCoord4 = ToRotatedPoissonTexCoord( poisson4, TexCoord, incVec, rotMatrix );
+ TexCoord5 = ToRotatedPoissonTexCoord( poisson5, TexCoord, incVec, rotMatrix );
+ TexCoord6 = ToRotatedPoissonTexCoord( poisson6, TexCoord, incVec, rotMatrix );
+ TexCoord7 = ToRotatedPoissonTexCoord( poisson7, TexCoord, incVec, rotMatrix );
+}
+
+void vert ()
+{
+ SetupPoissonBlurCoordsRotation( PoissonDistance, Texture0Info.xy, PoissonRotation);
+}
+ </VertexShader>
+ <FragmentShader>
+vec4 PoissonBlur(sampler2D inSampler )
+{
+ float mult0 = (1.0 - poisson0.z);
+ float mult1 = (1.0 - poisson1.z);
+ float mult2 = (1.0 - poisson2.z);
+ float mult3 = (1.0 - poisson3.z);
+ float mult4 = (1.0 - poisson4.z);
+ float mult5 = (1.0 - poisson5.z);
+ float mult6 = (1.0 - poisson6.z);
+ float mult7 = (1.0 - poisson7.z);
+
+ float multTotal = mult0 + mult1 + mult2 + mult3 + mult4 + mult5 + mult6 + mult7;
+ float multMultiplier = ( multTotal > 0.0 ? 1.0 / multTotal : 0.0 );
+
+ vec4 outColor = GetTextureValue( inSampler, TexCoord0, 1.0 ) * (mult0 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord1, 1.0 ) * (mult1 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord2, 1.0 ) * (mult2 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord3, 1.0 ) * (mult3 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord4, 1.0 ) * (mult4 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord5, 1.0 ) * (mult5 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord6, 1.0 ) * (mult6 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord7, 1.0 ) * (mult7 * multMultiplier);
+ return outColor;
+}
+
+void frag()
+{
+ //Passing in 1.0 means the value will not get alpha-multiplied again
+ gl_FragColor = PoissonBlur( Texture0 );
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="COMBINER">
+ <FragmentShader>
+
+void frag()
+{
+ vec4 sourceColor = texture2D_0(TexCoord);
+
+
+ vec3 summation = texture2D_Downsample2(TexCoord).xyz
+ + texture2D_Downsample4(TexCoord).xyz
+ + texture2D_Downsample8(TexCoord).xyz
+ + texture2D_Downsample16(TexCoord).xyz;
+ gl_FragColor = vec4( clamp( sourceColor.x + summation.x, 0.0, sourceColor.a )
+ , clamp( sourceColor.y + summation.y, 0.0, sourceColor.a )
+ , clamp( sourceColor.z + summation.z, 0.0, sourceColor.a )
+ , sourceColor.a );
+
+ /*
+
+ gl_FragColor = vec4( texture2D_Downsample2(TexCoord).xyz
+ , sourceColor.a );
+ */
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Buffer name="luminosity_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" lifetime="frame"/>
+ <Buffer name="luminosity_buffer2" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".5" lifetime="frame"/>
+ <Buffer name="downsample_buffer2" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".5" lifetime="frame"/>
+ <Buffer name="downsample_buffer4" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".25" lifetime="frame"/>
+ <Buffer name="downsample_buffer8" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".125" lifetime="frame"/>
+ <Buffer name="downsample_buffer16" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".0625" lifetime="frame"/>
+ <Pass shader="CLEARPASS" input="[source]" output="luminosity_buffer">
+ <RenderState name="Stencil" value="false"/>
+ </Pass>
+ <Pass shader="STENCILPASS" input="[source]" output="luminosity_buffer">
+ <RenderState name="Stencil" value="true"/>
+ </Pass>
+ <Pass shader="LUMINOSITY" input="luminosity_buffer" output="luminosity_buffer2">
+ <RenderState name="Stencil" value="false"/>
+ </Pass>
+ <Pass shader="BLUR" input="luminosity_buffer2" output="downsample_buffer2">
+ <SetParam name="PoissonDistance" value="4"/>
+ <SetParam name="PoissonRotation" value="0"/>
+ </Pass>
+ <Pass shader="BLUR" input="luminosity_buffer2" output="downsample_buffer4">
+ <SetParam name="PoissonDistance" value="4"/>
+ <SetParam name="PoissonRotation" value="0.62831"/>
+ </Pass>
+ <Pass shader="BLUR" input="luminosity_buffer2" output="downsample_buffer8">
+ <SetParam name="PoissonDistance" value="6"/>
+ <SetParam name="PoissonRotation" value="1.25663"/>
+ </Pass>
+ <Pass shader="BLUR" input="luminosity_buffer2" output="downsample_buffer16">
+ <SetParam name="PoissonDistance" value="10"/>
+ <SetParam name="PoissonRotation" value="1.88495"/>
+ </Pass>
+ <Pass shader="COMBINER" input="[source]">
+ <BufferInput param="Downsample2" value="downsample_buffer2"/>
+ <BufferInput param="Downsample4" value="downsample_buffer4"/>
+ <BufferInput param="Downsample8" value="downsample_buffer8"/>
+ <BufferInput param="Downsample16" value="downsample_buffer16"/>
+ <RenderState name="Stencil" value="false"/>
+ </Pass>
+ </Passes>
+</Effect>
+
diff --git a/Studio/Content/Effect Library/Blur.effect b/Studio/Content/Effect Library/Blur.effect
new file mode 100644
index 0000000..2b9b988
--- /dev/null
+++ b/Studio/Content/Effect Library/Blur.effect
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="amount" formalName="Blur Amount" min="0" max="0.10" default="0.01" description="Amount of Blur"/>
+ </MetaData>
+ <Shaders>
+ <Shared></Shared>
+ <VertexShaderShared></VertexShaderShared>
+ <FragmentShaderShared></FragmentShaderShared>
+ <Shader name="main">
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+void frag()
+{
+
+ vec4 c1 = texture2D_0(vec2(TexCoord.x - amount, TexCoord.y - amount));
+ vec4 c2 = texture2D_0(vec2(TexCoord.x + amount, TexCoord.y - amount));
+ vec4 c3 = texture2D_0(vec2(TexCoord.x - amount, TexCoord.y + amount));
+ vec4 c4 = texture2D_0(vec2(TexCoord.x + amount, TexCoord.y + amount));
+
+ vec4 f1 = vec4(mix(c1, c2, 0.5));
+ vec4 f2 = vec4(mix(c3, c4, 0.5));
+
+ vec4 c5 = texture2D_0(vec2(TexCoord.x - (amount * 2.0), TexCoord.y));
+ vec4 c6 = texture2D_0(vec2(TexCoord.x, TexCoord.y - (amount * 2.0)));
+ vec4 c7 = texture2D_0(vec2(TexCoord.x, TexCoord.y + (amount * 2.0)));
+ vec4 c8 = texture2D_0(vec2(TexCoord.x + (amount * 2.0), TexCoord.y));
+
+ vec4 f3 = vec4(mix(c5, c6, 0.5));
+ vec4 f4 = vec4(mix(c7, c8, 0.5));
+
+ vec4 r1 = vec4(mix(f1, f2, 0.5));
+ vec4 r2 = vec4(mix(f3, f4, 0.5));
+
+ gl_FragColor = vec4(mix(r1, r2, 0.5));
+
+
+}
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/Brush Strokes.effect b/Studio/Content/Effect Library/Brush Strokes.effect
new file mode 100644
index 0000000..e6e0e1e
--- /dev/null
+++ b/Studio/Content/Effect Library/Brush Strokes.effect
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <!--Simulates an artistic painting of the image-->
+ <Property name="NoiseSamp" formalName="Noise" filter="linear" clamp="repeat" type="Texture" default="./maps/effects/brushnoise.png" description="Texture to be used for the brush texture"/>
+ <Property name="brushAngle" formalName="Brush Angle" default="45" description="Amount to rotate the noise texture."/>
+ <Property name="brushLen" formalName="Stroke Length" min="0" max="3" default="1" description="How far to offset the image/'brush'."/>
+ <Property name="brushSize" formalName="Stroke Size" min="10" max="200" default="100" description="Scale the brush.\nSmaller values yield larger sizes."/>
+ </MetaData>
+ <Shaders>
+ <Shader>
+ <FragmentShader>
+void frag (void)
+{
+ if ( flagNoiseSamp != 0 ) {
+ float alpha = radians(brushAngle);
+ float cosAlpha = cos(alpha);
+ float sinAlpha = sin(alpha);
+ mat2 rotMat = mat2(cosAlpha, sinAlpha, -sinAlpha, cosAlpha);
+
+ vec2 uv0 = TexCoord / brushSize * 1000.0;
+ uv0 = (uv0.yx * rotMat).yx;
+
+ vec2 uv1 = texture2D_NoiseSamp(fract(uv0)).xy - 0.5;
+ uv1*= vec2(1.0, 0.01);
+ uv1*= rotMat;
+ vec2 uv2 = TexCoord + uv1 * 0.1 * brushLen;
+
+ vec2 halfPixelSize = 0.5 / Texture0Info.xy;
+ colorOutput(texture2D_0(clamp(uv2, halfPixelSize, 1.0-halfPixelSize)));
+ }
+ else
+ colorOutput(texture2D_0(TexCoord));
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+</Effect>
diff --git a/Studio/Content/Effect Library/ChromaticAberration.effect b/Studio/Content/Effect Library/ChromaticAberration.effect
new file mode 100644
index 0000000..6b553e7
--- /dev/null
+++ b/Studio/Content/Effect Library/ChromaticAberration.effect
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="Dispersion" formalName="Aberration Amount" description="Amount of Chromatic Aberration" default="0"/>
+ <Property name="FocusDepth" formalName="Focus Depth" description="Dispersion will scale in relation\nto distance from this depth" default="0"/>
+ <Property name="MaskSampler" formalName="Effect Mask" description="Grayscale texture to control where and how\nstrong on screen the aberration effect occurs" type="Texture" filter="linear" clamp="clamp" default="./maps/effects/white.png" />
+ <Property name="DepthDebug" formalName="Debug Dispersion Amount" type="Boolean" description="Allows you to see effect of controls.\nBlack objects will disperse less and\nwhite will disperse more" default="False"/>
+ <Property name="DepthSampler" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="SourceSampler" type="Texture" filter="linear" clamp="clamp"/>
+ </MetaData>
+ <Shaders>
+ <Shader Name="DISPERSE">
+ <FragmentShader>
+#include "depthpass.glsllib"
+
+uniform vec2 CameraClipRange;
+
+void frag()
+{
+ vec4 depthSample = texture(DepthSampler, TexCoord);
+ float depthVal = getDepthValue( depthSample, CameraClipRange );
+ float rawDepth = depthValueToLinearDistance( depthVal, CameraClipRange );
+
+ float depthScale = abs(CameraClipRange.y - CameraClipRange.x);
+ float depthDisp = abs(rawDepth - FocusDepth) / depthScale;
+ float finalDisperse = Dispersion * depthDisp;
+ float effectAmt = texture(MaskSampler, TexCoord).x;
+
+ if ( DepthDebug )
+ {
+ gl_FragColor.rgb = vec3( depthDisp * effectAmt );
+ return;
+ }
+
+ gl_FragColor = texture(SourceSampler, TexCoord);
+
+ ivec2 texSize = textureSize( SourceSampler, 0 );
+ vec2 dispDir = normalize( TexCoord.xy - vec2(0.5) );
+ dispDir /= 2.0 * vec2( texSize );
+ vec3 mixColor;
+ mixColor = gl_FragColor.rgb;
+ mixColor.r = texture(SourceSampler, TexCoord+dispDir*finalDisperse).r;
+ mixColor.b = texture(SourceSampler, TexCoord-dispDir*finalDisperse).b;
+
+ gl_FragColor.rgb = mix( gl_FragColor.rgb, mixColor, effectAmt );
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="DISPERSE">
+ <BufferInput value="[source]" param="SourceSampler" />
+ <DepthInput param="DepthSampler"/>
+ </Pass>
+ </Passes>
+</Effect>
diff --git a/Studio/Content/Effect Library/ColorMaster.effect b/Studio/Content/Effect Library/ColorMaster.effect
new file mode 100644
index 0000000..20e5b4d
--- /dev/null
+++ b/Studio/Content/Effect Library/ColorMaster.effect
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="red" formalName="Red Amount" min="0" max="2.0" default="1.0" description="Amount of Red"/>
+ <Property name="green" formalName="Green Amount" min="0" max="2.0" default="1.0" description="Amount of Green"/>
+ <Property name="blue" formalName="Blue Amount" min="0" max="2.0" default="1.0" description="Amount of Blue"/>
+ <Property name="strength_gray" formalName="Saturation" min="-1" max="1" default="0.0" description="Strength of Color"/>
+ </MetaData>
+ <Shaders>
+ <Shared></Shared>
+ <VertexShaderShared></VertexShaderShared>
+ <FragmentShaderShared></FragmentShaderShared>
+ <Shader name="main">
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+
+vec4 desaturate(vec3 color, float strength)
+{
+ vec3 lum = vec3(0.299, 0.587, 0.114);
+ // lum values based on: ITU-R BT.601
+ vec3 gray = vec3(dot(lum, color));
+ return vec4(mix(color, gray, -strength), 1.0);
+}
+void frag()
+{
+ vec4 sourceColor = texture2D_0(TexCoord);
+ vec4 basecolor = vec4(sourceColor.r*red,sourceColor.g*green,sourceColor.b*blue,sourceColor.a);
+ gl_FragColor = desaturate(basecolor.rgb,strength_gray);
+}
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/Corona.effect b/Studio/Content/Effect Library/Corona.effect
new file mode 100644
index 0000000..fb50812
--- /dev/null
+++ b/Studio/Content/Effect Library/Corona.effect
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <!--Creates a corona around a sprite.-->
+ <Property name="HBlurBias" formalName="Horizontal Blur" min="0" max="10" default="2" description="Amount of corona horizontally."/>
+ <Property name="VBlurBias" formalName="Vertical Blur" min="0" max="10" default="2" description="Amount of corona vertically."/>
+ <Property name="Trailfade" formalName="Fade Amount" min="0" max="1" default="0.8" description="0=no glow\n0.5=fade quickly\n1.0=persistent trails"/>
+ <Property name="GlowSampler" filter="nearest" clamp="clamp" type="Texture" />
+ <Property name="GlowCol" formalName="Glow Color" type="Color" default="1 0.6 0.0" description="The color to use for the glow."/>
+ <Property name="NoiseSamp" formalName="Noise" filter="linear" clamp="repeat" default="./maps/effects/noise.png" type="Texture" description="Texture to be used for the noise texture"/>
+ <Property name="NoiseScale" formalName="Noise Density" min="0" max="10" default="2" description="The density of the noise in corona.\nThe higher the value, the denser\nand smaller the noise;\nthe lower the value, the bigger the\nnoise scale."/>
+ <Property name="NoiseBright" formalName="Noise Brightness" min="0" max="5" default="4" description="Brightness of the noise."/>
+ <Property name="NoiseRatio" formalName="Noise Amount" min="0" max="1" default=".15" description="Magnitude of the noise."/>
+ <Property name="CrawlLen" formalName="Crawl Length" min="0" max="1" default=".3" description="Length of the corona trail in animation."/>
+ <Property name="CrawlAngle" formalName="Crawl Angle" default="0" description="Angle of the corona trail in animation."/>
+ <Property name="Sprite" filter="nearest" clamp="clamp" type="Texture" />
+ </MetaData>
+ <Shaders>
+ <Shared>
+#include "blur.glsllib"
+uniform float AppFrame; // frame number since app starts
+uniform float FPS;
+ </Shared>
+ <Shader name="CORONA_HBLUR">
+ <Shared>
+varying vec2 crawl; // corona crawl direction and magnitude
+ </Shared>
+ <VertexShader>
+void vert ()
+{
+ SetupHorizontalGaussianBlur(Texture0Info.x, HBlurBias, TexCoord);
+ // compute crawl
+ float alpha = radians(CrawlAngle + 180.0);
+ crawl = vec2(CrawlLen * sin(alpha), CrawlLen * cos(alpha));
+}
+ </VertexShader>
+ <FragmentShader>
+void frag()
+{
+ //Passing in 1.0 means the value will not get alpha-multiplied again
+ float OutCol = GaussianAlphaBlur( GlowSampler, 1.0 );
+ OutCol *= Trailfade; // fade away glow color
+ OutCol += texture2D_0( TexCoord ).a; // add glow color in the original tex area
+
+ vec2 nuv = NoiseScale * TexCoord3 + AppFrame / FPS * crawl;
+ vec4 noise = texture2D_NoiseSamp(fract(nuv));
+ float ns = (1.0 - NoiseRatio) + NoiseRatio * NoiseBright * noise.x;
+ OutCol *= ns;
+ gl_FragColor = vec4( OutCol );
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="CORONA_VBLUR">
+ <VertexShader>
+void vert ()
+{
+ SetupVerticalGaussianBlur( Texture0Info.y, VBlurBias, TexCoord );
+}
+ </VertexShader>
+ <FragmentShader>
+void frag() // PS_Blur_Vertical_9tap
+{
+ float OutCol = GaussianAlphaBlur( Texture0, Texture0Info.z );
+ gl_FragColor = OutCol * vec4(GlowCol.rgb, 1.0);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="CORONA_BLEND">
+ <VertexShader>
+void vert()
+{
+}
+ </VertexShader>
+ <FragmentShader>
+void frag ()
+{
+ vec4 src = texture2D_0( TexCoord );
+ vec4 dst = texture2D_Sprite(TexCoord);
+ colorOutput( src * (1.0 - dst.a) + dst );
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Buffer name="glow_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" size="0.55" lifetime="scene"/>
+ <Buffer name="temp_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" size="0.55" lifetime="frame"/>
+
+ <Pass shader="CORONA_HBLUR" input="[source]" output="temp_buffer">
+ <BufferInput param="GlowSampler" value="glow_buffer"/>
+ </Pass>
+ <Pass shader="CORONA_VBLUR" input="temp_buffer" output="glow_buffer"/>
+
+ <Pass shader="CORONA_BLEND" input="glow_buffer">
+ <BufferInput param="Sprite" value="[source]"/>
+ </Pass>
+ </Passes>
+</Effect>
diff --git a/Studio/Content/Effect Library/Depth Of Field Bokeh.effect b/Studio/Content/Effect Library/Depth Of Field Bokeh.effect
new file mode 100644
index 0000000..c715258
--- /dev/null
+++ b/Studio/Content/Effect Library/Depth Of Field Bokeh.effect
@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="FocusDistance" formalName="Focus Distance" description="Objects exactly distance +- &quot;In Focus Width&quot;\nfrom the camera will be in focus" default="600"/>
+ <Property name="FocusWidth" formalName="Depth of Field" description="Objects within this range of Focus\nDistance will be in focus" default="20"/>
+ <Property name="MaxBokehRadius" formalName="Max Bokeh Radius" description="Maximum radius of a Bokeh sprite" default="15"/>
+ <Property name="MaxCoCRadius" formalName="Max CoC Radius" description="Maximum radius of a CoC" default="15"/>
+ <Property name="MinBokehThreshold" formalName="Min Bokeh Threshold" description="Minimum luminance difference for\nBokeh detection" default="1.0"/>
+ <Property name="MaxBokehThreshold" formalName="Max Bokeh Threshold" description="Maximum luminance difference for\nBokeh detection" default="1000.0"/>
+ <Property name="MinCoCThreshold" formalName="Min CoC Threshold" description="Minimum CoC radius for Bokeh detection" default="3.0"/>
+ <Property name="DepthDebug" formalName="Debug Focus Rendering" type="Boolean" description="Allows you to see exactly how the Focus\nvariables work. Black objects are\nin focus, white are blurred" default="False"/>
+ <Property name="BokehShapeSampler" formalName="Bokeh shape" filter="linear" clamp="repeat" default="./maps/effects/HexagonalBokeh.png" type="Texture" description="Texture to be used for the bokeh shape"/>
+ <Property name="DepthSampler" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="SourceSampler" type="Texture" filter="linear" clamp="clamp"/>
+ <Property name="BokehDetectSampler" type="Image2D" format="rgba32f" binding="1"/>
+ <Property name="BokehColorSampler" type="Image2D" format="rgba32f" binding="2"/>
+ <Property name="BokehSampler" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="BokehPositionSampler" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="BokehBufferSampler" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="MergedBufferSampler" type="Texture" filter="linear" clamp="clamp"/>
+ <Property name="BokehCounter" type="Buffer" format="uvec4" usage="storage" binding="1" align="std140"/>
+
+ </MetaData>
+ <Shaders>
+ <Shared>
+#include "blur.glsllib"
+const float BlurAmount = 4.0;
+ </Shared>
+ <Shader name="CLEAR">
+ <VertexShader>
+void vert()
+{
+
+}
+ </VertexShader>
+ <FragmentShader>
+void frag() // Simple averaging box blur.
+{
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BOKEH_DETECT">
+ <VertexShader>
+
+void vert()
+{
+
+}
+
+ </VertexShader>
+ <FragmentShader>
+
+void frag() // Mix the input blur and the depth texture with the sprite
+{
+ vec4 sourceColor = textureLod(Texture0, TexCoord, 0.0);
+
+ float depthTap = getDepthValue( texture2D(DepthSampler, TexCoord), CameraClipRange );
+ float linearDepth = depthValueToLinearDistance( depthTap, CameraClipRange );
+ float FocusStart = FocusDistance - FocusWidth;
+ float FocusEnd = FocusDistance + FocusWidth;
+ float blur = clamp( abs(linearDepth - FocusDistance) / (FocusEnd-FocusStart), 0.00, 1.0);
+ //float blur = GetDepthMultiplier( TexCoord, DepthSampler, FocusDistance, FocusWidth, FocusWidth );
+ gl_FragColor = vec4( linearDepth, blur, 0.0, 1.0);
+
+ // use a 3x3 filter to compute luminance difference
+ vec3 avgColor = vec3(0);
+ avgColor += textureLodOffset(Texture0, TexCoord, 0.0, ivec2(1, 0)).xyz;
+ avgColor += textureLodOffset(Texture0, TexCoord, 0.0, ivec2(0, 1)).xyz;
+ avgColor += textureLodOffset(Texture0, TexCoord, 0.0, ivec2(-1, 0)).xyz;
+ avgColor += textureLodOffset(Texture0, TexCoord, 0.0, ivec2(0, -1)).xyz;
+ avgColor += textureLodOffset(Texture0, TexCoord, 0.0, ivec2(1, 1)).xyz;
+ avgColor += textureLodOffset(Texture0, TexCoord, 0.0, ivec2(1, -1)).xyz;
+ avgColor += textureLodOffset(Texture0, TexCoord, 0.0, ivec2(-1, -1)).xyz;
+ avgColor += textureLodOffset(Texture0, TexCoord, 0.0, ivec2(-1, 1)).xyz;
+ avgColor /= 8.0;
+
+ float currentLum = dot(vec3(0.2126, 0.7152, 0.0722), sourceColor.xyz);
+ float averageLum = dot(vec3(0.2126, 0.7152, 0.0722), avgColor);
+ //float currentLum = dot(vec3(1.0), sourceColor.xyz);
+ //float averageLum = dot(vec3(1.0), avgColor);
+ float lumDiff = max(currentLum - averageLum, 0.0);
+
+ float cocSize = blur * MaxCoCRadius;
+
+ if( lumDiff > MinBokehThreshold &amp;&amp; lumDiff &lt; MaxBokehThreshold &amp;&amp; cocSize > MinCoCThreshold )
+ {
+ ivec2 sourceSize, storeCoord;
+ sourceSize = ivec2(textureSize(Texture0, 0).xy);
+
+ uint add = uint(1);
+ int current = int(atomicAdd( BokehCounter_data[0].y, add));
+
+ storeCoord.y = int(floor(float(current/sourceSize.x)));
+ storeCoord.x = current - storeCoord.y*sourceSize.x;
+
+ imageStore(BokehDetectSampler, ivec2(storeCoord.xy), vec4(TexCoord.x * float(sourceSize.x), TexCoord.y * float(sourceSize.y), linearDepth, blur));
+
+ vec3 bokehColor = sourceColor.xyz / (cocSize);
+ imageStore(BokehColorSampler, ivec2(storeCoord.xy), vec4(bokehColor, 1.0));
+ }
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BOKEH_RENDER">
+ <VertexShader>
+out vec4 varColor;
+out float varRadius;
+out float varDepth;
+
+void vert()
+{
+ ivec2 bufSize, coord;
+ bufSize = textureSize(BokehPositionSampler,0).xy;
+ coord.y = int(floor(float(gl_InstanceID / bufSize.x)));
+ coord.x = gl_InstanceID - coord.y * bufSize.x;
+
+ varColor = texelFetch(BokehSampler, coord, 0);
+ vec4 pos = texelFetch(BokehPositionSampler, coord, 0);
+
+ varRadius = pos.w * MaxBokehRadius;
+ varDepth = pos.z;
+
+ // convert to NDC -1, 1 range
+ //pos.xy /= DestSize;
+ //pos.xy = pos.xy * 2.0 - 1.0;
+
+ vec4 pos1 = vec4( (attr_pos.xy + pos.xy) / DestSize.xy , 0.0, 1.0 );
+ gl_Position = pos1;
+}
+
+ </VertexShader>
+ <GeometryShader>
+#include "viewProperties.glsllib"
+
+in float varRadius[];
+in float varDepth[];
+in vec4 varColor[];
+out vec4 geColor;
+out float geDepth;
+out vec2 geUVPos;
+
+layout (points) in;
+layout (triangle_strip, max_vertices = 4) out;
+
+void main()
+{
+ gl_Layer = 0;
+ geColor = varColor[0];
+ geDepth = varDepth[0];
+ vec2 rcpSize = 1.0 / DestSize;
+
+ //emit triangle at pos.
+ vec2 offsetx = vec2(rcpSize.x * varRadius[0], 0.0);
+ vec2 offsety = vec2(0.0, rcpSize.y * varRadius[0]);
+ vec2 offsets = vec2(-1.0, -1.0); // Screen offset
+
+ // Expand point into a quad
+ gl_Position = vec4(offsets + 2.0*(gl_in[0].gl_Position.xy - offsetx - offsety),0.0 ,1.0);
+ geUVPos = vec2(0,0);
+ EmitVertex();
+ gl_Position = vec4(offsets + 2.0*(gl_in[0].gl_Position.xy + offsetx - offsety),0.0 ,1.0);
+ geUVPos = vec2(1,0);
+ EmitVertex();
+ gl_Position = vec4(offsets + 2.0*(gl_in[0].gl_Position.xy - offsetx + offsety),0.0 ,1.0);
+ geUVPos = vec2(0,1);
+ EmitVertex();
+ gl_Position = vec4(offsets + 2.0*(gl_in[0].gl_Position.xy + offsetx + offsety),0.0 ,1.0);
+ geUVPos = vec2(1,1);
+ EmitVertex();
+
+ EndPrimitive();
+}
+ </GeometryShader>
+ <FragmentShader>
+in vec4 geColor;
+in vec2 geUVPos;
+in float geDepth;
+
+void frag()
+{
+ float alpha = textureLod(BokehShapeSampler, geUVPos, 0.0 ).r;
+ vec2 bd = textureLod(Texture0, gl_FragCoord.xy/vec2(textureSize(Texture0, 0)), 0.0 ).xy;
+ float blur = bd.x;
+ float depth = bd.y;
+
+ float weight = clamp(depth - geDepth + 1.0, 0.0, 1.0);
+ weight = clamp( weight + blur, 0.0, 1.0);
+
+ gl_FragColor = vec4( geColor.xyz * alpha * weight, alpha * weight);
+}
+ </FragmentShader>
+ </Shader>
+
+<Shader name="MERGE">
+ <VertexShader>
+
+void vert()
+{
+ // reset bokeh counter
+ BokehCounter_data[0].y = uint(0);
+}
+ </VertexShader>
+ <FragmentShader>
+
+void frag() // Mix the input blur and the depth texture with the sprite
+{
+ vec4 sourceCol = texture2D( SourceSampler, TexCoord );
+
+ ivec2 storeCoord;
+ ivec2 sourceSize = textureSize(BokehBufferSampler, 0).xy;
+ storeCoord = ivec2(float(sourceSize.x) * TexCoord.x, float(sourceSize.y) * TexCoord.y);
+ vec4 bokehCol = texelFetch( BokehBufferSampler, storeCoord, 0 );
+ gl_FragColor = vec4( bokehCol.xyz + sourceCol.xyz, sourceCol.a );
+}
+ </FragmentShader>
+ </Shader>
+<Shader name="DOWNSAMPLE">
+ <VertexShader>
+void vert()
+{
+ SetupBoxBlurCoords(vec2(Texture0Info.xy));
+}
+ </VertexShader>
+ <FragmentShader>
+void frag() // Simple averaging box blur.
+{
+ gl_FragColor = BoxDepthBlur(DepthSampler, Texture0, Texture0Info.z, FocusDistance, FocusWidth, FocusWidth);
+}
+ </FragmentShader>
+ </Shader>
+<Shader name="BLUR">
+ <VertexShader>
+
+void vert()
+{
+ SetupPoissonBlurCoords( BlurAmount, DestSize.xy );
+}
+
+ </VertexShader>
+ <FragmentShader>
+
+void frag() // Mix the input blur and the depth texture with the sprite
+{
+ float centerMultiplier = GetDepthMultiplier( TexCoord, DepthSampler, FocusDistance, FocusWidth, FocusWidth );
+ if ( DepthDebug )
+ {
+ gl_FragColor = vec4( centerMultiplier,centerMultiplier,centerMultiplier, 1.0 );
+ }
+ else
+ {
+ vec4 blurColor = PoissonDepthBlur(Texture0, Texture0Info.z, DepthSampler, FocusDistance, FocusWidth, FocusWidth );
+ gl_FragColor = mix( texture2D(MergedBufferSampler,TexCoord), blurColor, centerMultiplier );
+ }
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+
+ <Passes>
+ <Buffer name="depthblur_buffer" type="fp16" format="rg" filter="nearest" wrap="clamp" size="1.0" lifetime="frame"/>
+ <Buffer name="bokeh_buffer" type="ubyte" format="rgba" filter="nearest" wrap="clamp" size="1.0" lifetime="scene"/>
+ <Buffer name="merged_buffer" type="ubyte" format="source" filter="nearest" wrap="clamp" size="1.0" lifetime="frame"/>
+ <Image name="bokeh_detect_image" type="fp16" format="rgba" filter="nearest" wrap="clamp" size="1.0" lifetime="scene" access="readwrite"/>
+ <Image name="bokeh_color_image" type="fp16" format="rgba" filter="nearest" wrap="clamp" size="1.0" lifetime="scene" access="readwrite"/>
+ <DataBuffer name="DrawIndirectBuffer" type="indirect" wrapName="BokehCounter" wrapType="storage" format="uint" size="4" lifetime="frame"/>
+ <Buffer name="downsample_buffer" type="ubyte" format="source" filter="linear" wrap="clamp" size=".5" lifetime="frame"/>
+
+ <Pass shader="CLEAR" input="[source]" output="bokeh_buffer">
+ </Pass>
+
+ <Pass shader="BOKEH_DETECT" input="[source]" output="depthblur_buffer">
+ <DepthInput param="DepthSampler"/>
+ <ImageInput value="bokeh_color_image" param="BokehColorSampler" usage="image"/>
+ <ImageInput value="bokeh_detect_image" param="BokehDetectSampler" usage="image"/>
+ <DataBufferInput param="BokehCounter" usage="storage"/>
+ </Pass>
+
+ <Pass shader="BOKEH_RENDER" input="depthblur_buffer" output="bokeh_buffer">
+ <ImageInput value="bokeh_color_image" param="BokehSampler" usage="texture" sync="true"/>
+ <ImageInput value="bokeh_detect_image" param="BokehPositionSampler" usage="texture" sync="true"/>
+ <DataBufferInput param="DrawIndirectBuffer" usage="indirect"/>
+ <Blending source="SrcAlpha" dest="One"/>
+ </Pass>
+
+ <Pass shader="MERGE" input="bokeh_buffer" output="merged_buffer">
+ <BufferInput value="[source]" param="SourceSampler" />
+ <BufferInput value="bokeh_buffer" param="BokehBufferSampler" />
+ <DataBufferInput param="BokehCounter" usage="storage"/>
+ </Pass>
+
+ <Pass shader="DOWNSAMPLE" input="merged_buffer" output="downsample_buffer">
+ <DepthInput param="DepthSampler"/>
+ </Pass>
+
+ <Pass shader="BLUR" input="downsample_buffer" output="[dest]" format="source">
+ <BufferInput value="merged_buffer" param="MergedBufferSampler" />
+ <DepthInput param="DepthSampler"/>
+ </Pass>
+ </Passes>
+</Effect>
+
diff --git a/Studio/Content/Effect Library/Depth Of Field HQ Blur.effect b/Studio/Content/Effect Library/Depth Of Field HQ Blur.effect
new file mode 100644
index 0000000..6649bf7
--- /dev/null
+++ b/Studio/Content/Effect Library/Depth Of Field HQ Blur.effect
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="FocusDistance" formalName="Focus Distance" description="Objects exactly distance +- &quot;In Focus Width&quot;\nfrom the camera will be in focus" default="600"/>
+ <Property name="FocusWidth" formalName="Depth of Field" description="Objects within this range of Focus\nDistance will be in focus" default="20"/>
+ <Property name="DepthDebug" formalName="Debug Focus Rendering" type="Boolean" description="Allows you to see exactly how the Focus\nvariables work. Black objects are in\nfocus, white are blurred" default="False"/>
+ <Property name="DepthSampler" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="SourceSampler" type="Texture" filter="linear" clamp="clamp"/>
+ </MetaData>
+ <Shaders>
+ <Shared>
+#include "blur.glsllib"
+const float BlurAmount = 4.0;
+ </Shared>
+ <Shader name="DOWNSAMPLE">
+ <VertexShader>
+void vert()
+{
+ SetupBoxBlurCoords(vec2(Texture0Info.xy));
+}
+ </VertexShader>
+ <FragmentShader>
+void frag() // Simple averaging box blur.
+{
+ gl_FragColor = BoxDepthBlur(DepthSampler, Texture0, Texture0Info.z, FocusDistance, FocusWidth, FocusWidth);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BLUR">
+ <VertexShader>
+
+void vert()
+{
+ SetupPoissonBlurCoords( BlurAmount, DestSize.xy );
+}
+
+ </VertexShader>
+ <FragmentShader>
+
+void frag() // Mix the input blur and the depth texture with the sprite
+{
+ float centerMultiplier = GetDepthMultiplier( TexCoord, DepthSampler, FocusDistance, FocusWidth, FocusWidth );
+ if ( DepthDebug )
+ {
+ gl_FragColor = vec4( centerMultiplier,centerMultiplier,centerMultiplier, 1.0 );
+ }
+ else
+ {
+ vec4 blurColor = PoissonDepthBlur(Texture0, Texture0Info.z, DepthSampler, FocusDistance, FocusWidth, FocusWidth );
+ gl_FragColor = mix( texture2D_SourceSampler(TexCoord), blurColor, centerMultiplier );
+ }
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Buffer name="downsample_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".5" lifetime="frame"/>
+ <Pass shader="DOWNSAMPLE" input="[source]" output="downsample_buffer">
+ <DepthInput param="DepthSampler"/>
+ </Pass>
+ <Pass shader="BLUR" input="downsample_buffer">
+ <BufferInput value="[source]" param="SourceSampler" />
+ <DepthInput param="DepthSampler"/>
+ </Pass>
+ </Passes>
+</Effect>
+
diff --git a/Studio/Content/Effect Library/Desaturate.effect b/Studio/Content/Effect Library/Desaturate.effect
new file mode 100644
index 0000000..02c3119
--- /dev/null
+++ b/Studio/Content/Effect Library/Desaturate.effect
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="strenght_gray" formalName="Effect Strenght" min="0" max="1" default="1.0" description="Strenght of the Grayscale"/>
+ </MetaData>
+ <Shaders>
+ <Shared></Shared>
+ <VertexShaderShared></VertexShaderShared>
+ <FragmentShaderShared></FragmentShaderShared>
+ <Shader name="main">
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+
+vec4 desaturate(vec3 color, float strenght)
+{
+ vec3 lum = vec3(0.299, 0.587, 0.114);
+ // lum values based on: ITU-R BT.601
+ vec3 gray = vec3(dot(lum, color));
+ return vec4(mix(color, gray, strenght), 1.0);
+}
+void frag()
+{
+ vec4 origColor = texture2D_0(TexCoord);
+
+ gl_FragColor = desaturate(origColor.rgb,strenght_gray);
+}
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/Distortion Ripple.effect b/Studio/Content/Effect Library/Distortion Ripple.effect
new file mode 100644
index 0000000..0929be1
--- /dev/null
+++ b/Studio/Content/Effect Library/Distortion Ripple.effect
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <!--Distorts the image in a ripple way.-->
+ <Property name="radius" formalName="Radius" min="0" max="100" default="100.0" description="Adjusts the spread between ripples."/>
+ <Property name="center" formalName="Center" type="Float2" default="0.5 0.5" description="Adjusts the focus point of the distortion."/>
+ <Property name="ripples" formalName="Wave Width" min="2" max="100" default="95.0" description="Adjusts the number of ripples."/>
+ <Property name="height" formalName="Wave Height" min="0" max="100" default="25.0" description="Adjusts the distortion amount."/>
+ <Property name="phase" formalName="Ripple Phase" default="0.0" description="The offset of each wave. Animate this\nproperty to see the waves move."/>
+ </MetaData>
+ <Shaders>
+ <Shared>
+varying vec2 center_vec;
+float PI2 = radians(360.0);
+ </Shared>
+ <Shader>
+ <VertexShader>
+void vert ()
+{
+ center_vec = TexCoord - center;
+ //Multiply by x/y ratio so we see a sphere on the screen
+ //instead of an ellipse.
+ center_vec.y *= Texture0Info.y / Texture0Info.x;
+}
+ </VertexShader>
+ <FragmentShader>
+<![CDATA[
+void frag()
+{
+ float dist_to_center = length(center_vec) * 100.0 / radius;;
+
+ vec2 texc;
+ if(dist_to_center > 1.0) {
+ texc = TexCoord;
+ } else {
+ float r = PI2 * (1.0 - dist_to_center);
+ float distortion = sin(r * (100.0-ripples) + radians(phase));
+ texc = TexCoord - ( TexCoord - center ) * distortion * height / 800.0;
+ }
+
+ if ( texc.x < 0.0 || texc.x > 1.0 || texc.y < 0.0 || texc.y > 1.0 )
+ gl_FragColor = vec4(0.0);
+ else
+ colorOutput(texture2D_0(texc));
+}
+]]>
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+</Effect>
diff --git a/Studio/Content/Effect Library/Distortion Sphere.effect b/Studio/Content/Effect Library/Distortion Sphere.effect
new file mode 100644
index 0000000..3ed1e70
--- /dev/null
+++ b/Studio/Content/Effect Library/Distortion Sphere.effect
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <!--Distorts the image in a spherical way.-->
+ <Property name="radius" formalName="Radius" min="0" max="1" default=".3" description="Adjusts the distorted area."/>
+ <Property name="height" formalName="Height" min="-1" max="1" default=".3" description="Adjusts the distortion amount."/>
+ <Property name="center" formalName="Center" type="Float2" default="0.5 0.5" description="Adjusts the focus point of the distortion."/>
+ </MetaData>
+ <Shaders>
+ <Shared>
+varying vec2 center_vec;
+ </Shared>
+ <Shader>
+ <VertexShader>
+void vert ()
+{
+ center_vec = TexCoord - center;
+ //Multiply by x/y ratio so we see a sphere on the screen
+ //instead of an ellipse.
+ center_vec.y *= Texture0Info.y / Texture0Info.x;
+}
+ </VertexShader>
+ <FragmentShader>
+<![CDATA[
+void frag()
+{
+ float dist_to_center = length(center_vec) / radius;;
+
+ vec2 texc;
+ if(dist_to_center > 1.0) {
+ texc = TexCoord;
+ } else {
+ float distortion = 1.0 - dist_to_center * dist_to_center;
+ texc = TexCoord - (TexCoord - center) * distortion * height;
+ }
+
+ if ( texc.x < 0.0 || texc.x > 1.0 || texc.y < 0.0 || texc.y > 1.0 )
+ gl_FragColor = vec4(0.0);
+ else
+ colorOutput(texture2D_0(texc));
+}
+]]>
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+</Effect> \ No newline at end of file
diff --git a/Studio/Content/Effect Library/Distortion Spiral.effect b/Studio/Content/Effect Library/Distortion Spiral.effect
new file mode 100644
index 0000000..a5a9697
--- /dev/null
+++ b/Studio/Content/Effect Library/Distortion Spiral.effect
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <!--Distorts the image in a spiraling way.-->
+ <Property name="radius" formalName="Radius" min="0" max="1" default=".3" description="Adjusts the distorted area."/>
+ <Property name="spiral" formalName="Spiral" min="-10" max="10" default="1.0" description="Adjusts the spiraling amount."/>
+ <Property name="center" formalName="Center" type="Float2" default="0.5 0.5" description="Adjusts the focus point of the distortion."/>
+ </MetaData>
+ <Shaders>
+ <Shared>
+varying vec2 center_vec;
+float PI2 = radians(360.0);
+ </Shared>
+ <Shader>
+ <VertexShader>
+void vert ()
+{
+ center_vec = TexCoord - center;
+ //Multiply by x/y ratio so we see a sphere on the screen
+ //instead of an ellipse.
+ center_vec.y *= Texture0Info.y / Texture0Info.x;
+}
+ </VertexShader>
+ <FragmentShader>
+<![CDATA[
+void frag()
+{
+ float dist_to_center = length(center_vec) / radius;;
+
+ vec2 texc;
+ if(dist_to_center > 1.0) {
+ texc = TexCoord;
+ } else {
+ float rotation_amount = (1.0 - dist_to_center) * (1.0 - dist_to_center);
+ float r = PI2 * rotation_amount * spiral / 4.0;
+ float cos_r = cos(r);
+ float sin_r = sin(r);
+ mat2 rotation = mat2(cos_r, sin_r, -sin_r, cos_r);
+ texc = center + rotation * (TexCoord - center);
+ }
+
+ if ( texc.x < 0.0 || texc.x > 1.0 || texc.y < 0.0 || texc.y > 1.0 )
+ gl_FragColor = vec4(0.0);
+ else
+ colorOutput(texture2D_0(texc));
+}
+]]>
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+</Effect> \ No newline at end of file
diff --git a/Studio/Content/Effect Library/Edge Detect.effect b/Studio/Content/Effect Library/Edge Detect.effect
new file mode 100644
index 0000000..2b200d0
--- /dev/null
+++ b/Studio/Content/Effect Library/Edge Detect.effect
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <!--Smooth, unchanging areas of the image are turned black, while areas of the image with sharp color changes are brightened to highlight the 'edges' in the image.-->
+ <Property name="amount" formalName="Amount" min="0" max="1" default="1" description="0 = no effect\n1 = maximum effect"/>
+ </MetaData>
+ <Shaders>
+ <Shared>
+////////////////////////////////////////////////////////////
+// vert / frag shaders.
+
+varying vec4 TexCoordBLL; //Bottom Left and Bottom Tap
+varying vec4 TexCoordTLT; //Top Left and Top Tap
+varying vec4 TexCoordTRR; //Upper Right and Right Tap
+varying vec4 TexCoordBRB; //Bottom Right and Bottom Tap
+ </Shared>
+ <Shader>
+ <VertexShader>
+void vert()
+{
+ //Pass Through the Texture Taps
+ float deltax = 1.0/Texture0Info.x;
+ float deltay = 1.0/Texture0Info.y;
+
+ //Bottom Left
+ TexCoordBLL.x = TexCoord.s - deltax;
+ TexCoordBLL.y = TexCoord.t - deltay;
+
+ //Left
+ TexCoordBLL.z = TexCoord.s - deltax;
+ TexCoordBLL.w = TexCoord.t;
+
+ //Top Left
+ TexCoordTLT.x = TexCoord.s - deltax;
+ TexCoordTLT.y = TexCoord.t + deltay;
+
+ //Top
+ TexCoordTLT.z = TexCoord.s;
+ TexCoordTLT.w = TexCoord.t + deltay;
+
+ //Upper Right
+ TexCoordTRR.x = TexCoord.s + deltax;
+ TexCoordTRR.y = TexCoord.t + deltay;
+
+ //Right
+ TexCoordTRR.z = TexCoord.s + deltax;
+ TexCoordTRR.w = TexCoord.t;
+
+ //Bottom Right
+ TexCoordBRB.x = TexCoord.s + deltax;
+ TexCoordBRB.y = TexCoord.t - deltay;
+
+ //Bottom
+ TexCoordBRB.z = TexCoord.s;
+ TexCoordBRB.w = TexCoord.t - deltay;
+}
+ </VertexShader>
+ <FragmentShader>
+void frag (void)
+{
+ vec4 centerTap = texture2D_0(TexCoord);
+ vec4 edgeTap = texture2D_0(TexCoordBLL.xy) +
+ texture2D_0(TexCoordBLL.zw) +
+ texture2D_0(TexCoordTLT.xy) +
+ texture2D_0(TexCoordTLT.zw) +
+ texture2D_0(TexCoordTRR.xy) +
+ texture2D_0(TexCoordTRR.zw) +
+ texture2D_0(TexCoordBRB.xy) +
+ texture2D_0(TexCoordBRB.zw);
+ vec3 edgeDetect = 8.0*(centerTap.rgb + -0.125*edgeTap.rgb);
+ edgeDetect = clamp(edgeDetect, 0.0, centerTap.a);
+
+ colorOutput(vec4(mix(centerTap.rgb, edgeDetect, amount), centerTap.a));
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+</Effect>
+
+
+
diff --git a/Studio/Content/Effect Library/Emboss.effect b/Studio/Content/Effect Library/Emboss.effect
new file mode 100644
index 0000000..876db3a
--- /dev/null
+++ b/Studio/Content/Effect Library/Emboss.effect
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="amount" formalName="Amount" min="0" max="0.01" default="0.003" description="Amount"/>
+ </MetaData>
+ <Shaders>
+ <Shared></Shared>
+ <VertexShaderShared></VertexShaderShared>
+ <FragmentShaderShared></FragmentShaderShared>
+ <Shader name="main">
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+
+void frag()
+{
+ vec4 origColor = texture2D_0(TexCoord);
+
+ float step_w = amount;
+ float step_h = amount;
+
+ vec4 t1 = texture2D_0(vec2(TexCoord.x - step_w, TexCoord.y - step_h));
+ vec4 t2 = texture2D_0(vec2(TexCoord.x, TexCoord.y - step_h));
+ vec4 t3 = texture2D_0(vec2(TexCoord.x - step_w, TexCoord.y));
+ vec4 t4 = texture2D_0(TexCoord);
+
+ vec3 rr = -4.0 * t1.rgb - 4.0 * t2.rgb - 4.0 * t3.rgb + 12.0 * t4.rgb;
+ float y = (rr.r + rr.g + rr.b) / 3.0;
+
+ vec4 result = vec4(vec3(y, y, y) + 0.3, origColor.a);
+
+ gl_FragColor = result;
+}
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/FXAA.effect b/Studio/Content/Effect Library/FXAA.effect
new file mode 100644
index 0000000..0434a38
--- /dev/null
+++ b/Studio/Content/Effect Library/FXAA.effect
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="Sprite" filter="nearest" clamp="clamp" type="Texture" />
+ </MetaData>
+ <Shaders>
+ <Shader name="RGBL">
+ <FragmentShader>
+void frag() // Create RGBL buffer
+{
+ vec4 color = texture2D_0(TexCoord);
+ color.a = dot(color.rgb, vec3(0.299, 0.587, 0.114));
+ gl_FragColor = color;
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BLUR">
+ <FragmentShader>
+#define FXAA_VERION 311
+#define FXAA_PC 1
+#define FXAA_GLSL_130 1
+#define FXAA_LINEAR 1
+#if FXAA_VERION >= 311
+#include "Fxaa3_11.glsllib"
+#else
+#include "Fxaa3_8.glsllib"
+#endif
+
+void frag() // Mix the input blur and the depth texture with the sprite
+{
+ float sprightA = texture2D_Sprite( TexCoord ).a;
+#if FXAA_VERION >= 311
+ vec4 aaPix = FxaaPixelShader( TexCoord, vec4(0.0,0.0,0.0,0.0), Texture0, Texture0, Texture0, vec2(1.0 / DestSize.x, 1.0 / DestSize.y),
+ vec4(0,0,0,0), vec4(0,0,0,0), vec4(0,0,0,0), 0.75, 0.166, 0.0833, 8.0, 0.125, 0.05, vec4(0,0,0,0) );
+#else
+ vec4 aaPix = FxaaPixelShader( TexCoord, vec4(0.0,0.0,0.0,0.0), Texture0, vec2(1.0 / DestSize.x, 1.0 / DestSize.y), vec4(0,0,0,0) );
+#endif
+ gl_FragColor = vec4(aaPix.rgb, sprightA );
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Buffer name="rgbl_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" lifetime="frame"/>
+ <Pass shader="RGBL" input="[source]" output="rgbl_buffer"/>
+ <Pass shader="BLUR" input="rgbl_buffer">
+ <BufferInput param="Sprite" value="[source]"/>
+ </Pass>
+ </Passes>
+</Effect>
+
diff --git a/Studio/Content/Effect Library/FrameFlipper.effect b/Studio/Content/Effect Library/FrameFlipper.effect
new file mode 100644
index 0000000..6529e6c
--- /dev/null
+++ b/Studio/Content/Effect Library/FrameFlipper.effect
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="horflip" formalName="Flip Horizontally" type="Boolean" description="Flip Frame horizontally" default="False"/>
+ <Property name="verflip" formalName="Flip Vertically" type="Boolean" description="Flip Frame vertically" default="False"/>
+ </MetaData>
+ <Shaders>
+ <Shared></Shared>
+ <VertexShaderShared></VertexShaderShared>
+ <FragmentShaderShared></FragmentShaderShared>
+ <Shader name="main">
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+void frag()
+{
+ float yflippedCoord = 1.0 - TexCoord.y;
+ float xflippedCoord = 1.0 - TexCoord.x;
+ vec2 flippedCoord = TexCoord;
+
+ if(horflip || verflip){
+ if(horflip){
+ flippedCoord.x = xflippedCoord;
+ }
+ if(verflip){
+ flippedCoord.y = yflippedCoord;
+ }
+ }
+
+ vec4 origColor = texture2D_0(flippedCoord);
+
+ gl_FragColor = origColor;
+}
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/FullScreenTextureOverlay.effect b/Studio/Content/Effect Library/FullScreenTextureOverlay.effect
new file mode 100644
index 0000000..42be3f3
--- /dev/null
+++ b/Studio/Content/Effect Library/FullScreenTextureOverlay.effect
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="Overlay" formalName="Overlay Texture" description="Overlay texture" type="Texture" clamp="repeat" />
+ <Property name="overlay_repeat" formalName="Repeat" min="0" max="50" default="1" description="Times to repeat the image over screen."/>
+ </MetaData>
+ <Shaders>
+ <Shared></Shared>
+ <FragmentShaderShared></FragmentShaderShared>
+ <Shader name="main">
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+
+void frag()
+{
+ vec4 smp = texture(Overlay, TexCoord.xy*overlay_repeat);
+ gl_FragColor = smp;
+}
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/Gaussian Blur.effect b/Studio/Content/Effect Library/Gaussian Blur.effect
new file mode 100644
index 0000000..958d9fe
--- /dev/null
+++ b/Studio/Content/Effect Library/Gaussian Blur.effect
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <!--Quickly blurs by an adjustable amount. Gaussian refers to the bell-shaped curve that is generated when the shader applies a weighted average to the pixels. The Gaussian Blur filter adds low-frequency detail and can produce a hazy effect.-->
+ <Property name="BlurBias" formalName="Blurriness" min="0" max="10" default="2" description="0 = no blur\n10 = maximum blur" />
+ </MetaData>
+ <Shaders>
+ <Shared>
+#include "blur.glsllib"
+ </Shared>
+ <Shader name="HBLUR">
+ <VertexShader>
+void vert()
+{
+ SetupHorizontalGaussianBlur(Texture0Info.x, BlurBias, TexCoord);
+}
+ </VertexShader>
+ <FragmentShader>
+void frag()
+{
+ gl_FragColor = GaussianBlur(Texture0, Texture0Info.z);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="VBLUR">
+ <VertexShader>
+void vert()
+{
+ SetupVerticalGaussianBlur(Texture0Info.y, BlurBias, TexCoord);
+}
+ </VertexShader>
+ <FragmentShader>
+
+void frag() // PS_Blur_Vertical_9tap
+{
+ vec4 fragColor = GaussianBlur(Texture0, Texture0Info.z);
+ colorOutput(fragColor);
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Buffer name="temp_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" size="1.0" lifetime="frame"/>
+ <Pass name="1" shader="HBLUR" input="[source]" output="temp_buffer"/>
+ <Pass name="2" shader="VBLUR" input="temp_buffer"/>
+ </Passes>
+</Effect>
+
diff --git a/Studio/Content/Effect Library/HDRBloomTonemap.effect b/Studio/Content/Effect Library/HDRBloomTonemap.effect
new file mode 100644
index 0000000..4424393
--- /dev/null
+++ b/Studio/Content/Effect Library/HDRBloomTonemap.effect
@@ -0,0 +1,282 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="GammaValue" formalName="Gamma" default="2.2" min="0.1" max="4"/>
+ <Property name="Exposure" min="-9" max="9" default="0"/>
+
+ <Property name="BloomThreshold" formalName="Bloom Threshold" description="Objects brighter than this will\ngenerate a bloom" default="1.0" />
+ <Property name="BlurFalloff" formalName="Bloom Falloff" description="Size of the bloom. Smaller\nnumber means larger bloom." default="0" min="0" max="10"/>
+
+ <Property name="TonemappingLerp" formalName="Effect Amount" description="Adjust between no change and\nfull effect." default="1" min="0" max="1" hidden="True"/>
+
+ <!--
+ <Property name="Key" formalName="Luminance Key" min="0" max="1" default="0.04"/>
+ <Property name="expLum" formalName="Exposure Luminance" default="2.0"/>
+ <Property name="TonemappingLod" formalName="Tonemapping adaptation rate" default="10" min="0" max="20"/>
+ -->
+ <Property name="ChannelThreshold" formalName="Channel Threshold" hidden="True" description="Channel threshold" default="1.0" />
+ <Property name="PoissonRotation" hidden="True" default="0"/>
+ <Property name="PoissonDistance" hidden="True" default="4"/>
+ <Property name="Downsample2" filter="linear" clamp="clamp" type="Texture" />
+ <Property name="Downsample4" filter="linear" clamp="clamp" type="Texture" />
+
+ </MetaData>
+ <Shaders>
+ <Shared>
+#include "blur.glsllib"
+#include "luminance.glsllib"
+float get_blur_falloff() { return exp2( -BlurFalloff ); }
+float get_exposure() { return exp2( Exposure ); }
+ </Shared>
+ <Shader name="LUMINOSITY">
+ <VertexShader>
+vec2 ToRotatedPoissonTexCoord( vec3 poisson, vec2 inputTex, vec2 inc, mat2 rotation )
+{
+ vec2 rotatedPoisson = rotation * vec2( poisson.xy );
+ return vec2( inputTex.x + rotatedPoisson.x * inc.x, inputTex.y + rotatedPoisson.y * inc.y );
+}
+
+void SetupPoissonBlurCoordsRotation(float inBlurAmount, vec2 inTexInfo, float inRotationRadians )
+{
+ float incX = inBlurAmount / inTexInfo.x;
+ float incY = inBlurAmount / inTexInfo.y;
+ float rotCos = cos( inRotationRadians );
+ float rotSin = sin( inRotationRadians );
+ mat2 rotMatrix = mat2( rotCos, rotSin, -rotSin, rotCos );
+ vec2 incVec = vec2( incX, incY );
+
+ TexCoord0 = ToRotatedPoissonTexCoord( poisson0, TexCoord, incVec, rotMatrix );
+ TexCoord1 = ToRotatedPoissonTexCoord( poisson1, TexCoord, incVec, rotMatrix );
+ TexCoord2 = ToRotatedPoissonTexCoord( poisson2, TexCoord, incVec, rotMatrix );
+ TexCoord3 = ToRotatedPoissonTexCoord( poisson3, TexCoord, incVec, rotMatrix );
+ TexCoord4 = ToRotatedPoissonTexCoord( poisson4, TexCoord, incVec, rotMatrix );
+ TexCoord5 = ToRotatedPoissonTexCoord( poisson5, TexCoord, incVec, rotMatrix );
+ TexCoord6 = ToRotatedPoissonTexCoord( poisson6, TexCoord, incVec, rotMatrix );
+ TexCoord7 = ToRotatedPoissonTexCoord( poisson7, TexCoord, incVec, rotMatrix );
+}
+// No op
+void vert ()
+{
+ SetupPoissonBlurCoordsRotation( 5.0 * get_blur_falloff(), Texture0Info.xy, 0.0);
+}
+ </VertexShader>
+ <FragmentShader>
+
+float cutoff( float color )
+{
+ return color >= BloomThreshold ? color : 0.0;
+}
+vec4 cutoffColor( sampler2D inSampler, vec2 texCoord )
+{
+ vec4 color = GetTextureValue(inSampler, texCoord, 1.0);
+ vec3 exposed_color = color.xyz * get_exposure();
+ vec3 cutoff_color = vec3( cutoff( color.x ), cutoff( color.y ), cutoff( color.z ) );
+ float pixelMult = dot( cutoff_color, cutoff_color ) > 0.0 ? 1.0 : 0.0;
+ return vec4( exposed_color.xyz, color.a ) * pixelMult;
+}
+
+vec4 PoissonBlur(sampler2D inSampler )
+{
+ //flatten out the poisson for this step, we really just want to smear.
+ float mult0 = 1.0;
+ float mult1 = mult0;
+ float mult2 = mult0;
+ float mult3 = mult2;
+ float mult4 = mult2;
+ float mult5 = mult2;
+ float mult6 = mult2;
+ float mult7 = mult2;
+
+ float multTotal = mult0 + mult1 + mult2 + mult3 + mult4 + mult5 + mult6 + mult7;
+ float multMultiplier = ( multTotal > 0.0 ? 1.0 / multTotal : 0.0 );
+
+ vec4 outColor = cutoffColor( inSampler, TexCoord0 ) * (mult0 * multMultiplier);
+ outColor += cutoffColor( inSampler, TexCoord1 ) * (mult1 * multMultiplier);
+ outColor += cutoffColor( inSampler, TexCoord2 ) * (mult2 * multMultiplier);
+ outColor += cutoffColor( inSampler, TexCoord3 ) * (mult3 * multMultiplier);
+ outColor += cutoffColor( inSampler, TexCoord4 ) * (mult4 * multMultiplier);
+ outColor += cutoffColor( inSampler, TexCoord5 ) * (mult5 * multMultiplier);
+ outColor += cutoffColor( inSampler, TexCoord6 ) * (mult6 * multMultiplier);
+ outColor += cutoffColor( inSampler, TexCoord7 ) * (mult7 * multMultiplier);
+ return outColor;
+}
+
+void frag() // Luminosity pass with exponential color channel decay based on the threshold above.
+{
+ gl_FragColor = PoissonBlur( Texture0 );
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BLUR">
+ <VertexShader>
+
+vec2 ToRotatedPoissonTexCoord( vec3 poisson, vec2 inputTex, vec2 inc, mat2 rotation )
+{
+ vec2 rotatedPoisson = rotation * vec2( poisson.xy );
+ return vec2( inputTex.x + rotatedPoisson.x * inc.x, inputTex.y + rotatedPoisson.y * inc.y );
+}
+
+void SetupPoissonBlurCoordsRotation(float inBlurAmount, vec2 inTexInfo, float inRotationRadians )
+{
+ float incX = inBlurAmount / inTexInfo.x;
+ float incY = inBlurAmount / inTexInfo.y;
+ float rotCos = cos( inRotationRadians );
+ float rotSin = sin( inRotationRadians );
+ mat2 rotMatrix = mat2( rotCos, rotSin, -rotSin, rotCos );
+ vec2 incVec = vec2( incX, incY );
+
+ TexCoord0 = ToRotatedPoissonTexCoord( poisson0, TexCoord, incVec, rotMatrix );
+ TexCoord1 = ToRotatedPoissonTexCoord( poisson1, TexCoord, incVec, rotMatrix );
+ TexCoord2 = ToRotatedPoissonTexCoord( poisson2, TexCoord, incVec, rotMatrix );
+ TexCoord3 = ToRotatedPoissonTexCoord( poisson3, TexCoord, incVec, rotMatrix );
+ TexCoord4 = ToRotatedPoissonTexCoord( poisson4, TexCoord, incVec, rotMatrix );
+ TexCoord5 = ToRotatedPoissonTexCoord( poisson5, TexCoord, incVec, rotMatrix );
+ TexCoord6 = ToRotatedPoissonTexCoord( poisson6, TexCoord, incVec, rotMatrix );
+ TexCoord7 = ToRotatedPoissonTexCoord( poisson7, TexCoord, incVec, rotMatrix );
+}
+
+void vert ()
+{
+ SetupPoissonBlurCoordsRotation( PoissonDistance, Texture0Info.xy, PoissonRotation);
+}
+ </VertexShader>
+ <FragmentShader>
+vec4 PoissonBlur(sampler2D inSampler )
+{
+ float mult0 = (1.0 - poisson0.z);
+ float mult1 = (1.0 - poisson1.z);
+ float mult2 = (1.0 - poisson2.z);
+ float mult3 = (1.0 - poisson3.z);
+ float mult4 = (1.0 - poisson4.z);
+ float mult5 = (1.0 - poisson5.z);
+ float mult6 = (1.0 - poisson6.z);
+ float mult7 = (1.0 - poisson7.z);
+
+ float multTotal = mult0 + mult1 + mult2 + mult3 + mult4 + mult5 + mult6 + mult7;
+ float multMultiplier = ( multTotal > 0.0 ? 1.0 / multTotal : 0.0 ) * get_blur_falloff();
+
+ vec4 outColor = GetTextureValue( inSampler, TexCoord0, 1.0 ) * (mult0 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord1, 1.0 ) * (mult1 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord2, 1.0 ) * (mult2 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord3, 1.0 ) * (mult3 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord4, 1.0 ) * (mult4 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord5, 1.0 ) * (mult5 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord6, 1.0 ) * (mult6 * multMultiplier);
+ outColor += GetTextureValue( inSampler, TexCoord7, 1.0 ) * (mult7 * multMultiplier);
+ return outColor;
+}
+
+void frag()
+{
+ //Passing in 1.0 means the value will not get alpha-multiplied again
+ gl_FragColor = PoissonBlur( Texture0 );
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="COMBINER">
+ <FragmentShader>
+ /*
+
+float GetAdaptedLuminance( sampler2D inSampler )
+{
+
+ vec3 col = textureLod( inSampler, TexCoord, TonemappingLod).rgb;
+ return luminance( col );
+}
+
+vec3 GetTonemappedReinhard( sampler2D inSampler, vec3 inSource, vec3 inBlurred )
+{
+ // adapted luminance value
+ float adpLm = GetAdaptedLuminance( inSampler );
+ // luminance of current color
+ float curLm = luminance( inSource.rgb );
+ // relative luminance
+ float relLm = Key/adpLm;
+ // displayable value D
+ float D = (relLm * (1.0 + relLm/(expLum*expLum)) / (1.0 + relLm));
+ // tone map result
+ vec3 color = inBlurred.xyz * relLm;
+ //vec3 gamaColor = pow(color, vec3(1.0/2.2));
+
+ //return gamaColor;
+ return vec3(relLm, relLm, relLm );
+}
+
+vec3 GetTonemappedReinhardSimple( vec3 inSource, vec3 inBlurred )
+{
+ vec3 texColor = inBlurred * 1.0; // Hardcoded Exposure Adjustment
+ texColor = texColor/(1.0 + texColor);
+ vec3 retColor = pow( texColor, vec3(1.0/2.2) );
+ return retColor;
+}
+*/
+
+void frag()
+{
+ vec4 sourceColor = texture2D_0(TexCoord);
+
+
+ vec4 summation = texture2D_Downsample2(TexCoord)
+ + texture2D_Downsample4(TexCoord);
+
+ vec3 bloom_result = sourceColor.xyz * get_exposure() + summation.xyz;
+
+ //Threshold defines the white point for the image which shouldn't be adaptive.
+ vec3 thresholded = clamp( bloom_result.xyz, 0.0, ChannelThreshold ) / ChannelThreshold;
+
+ vec3 tonemapped = pow( thresholded, vec3( 1.0 / GammaValue ) );
+
+ vec3 final_color = mix( thresholded, tonemapped, TonemappingLerp );
+
+ float resultAlpha = max( summation.a, sourceColor.a );
+
+ gl_FragColor = vec4( final_color, resultAlpha );
+
+ /*
+ gl_FragColor = vec4( texture2D_Downsample2(TexCoord).xyz
+ , 1.0 );
+ */
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="Passthrough">
+ <VertexShader>
+void vert ()
+{
+}
+ </VertexShader>
+ <FragmentShader>
+void frag()
+{
+ //Passing in 1.0 means the value will not get alpha-multiplied again
+ gl_FragColor = GetTextureValue( Texture0, TexCoord, 1.0 );
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Buffer name="luminosity_buffer2" format="source" filter="linear" wrap="clamp" size=".5" lifetime="scene"/>
+ <Buffer name="downsample_buffer2" format="source" filter="linear" wrap="clamp" size=".5" lifetime="scene"/>
+ <Buffer name="downsample_buffer4" format="source" filter="linear" wrap="clamp" size=".25" lifetime="scene"/>
+ <Pass shader="LUMINOSITY" input="[source]" output='downsample_buffer2' >
+ </Pass>
+ <Pass shader="LUMINOSITY" input="downsample_buffer2" output='luminosity_buffer2' >
+ </Pass>
+ <!--<Pass shader='Passthrough' input='luminosity_buffer2' />-->
+
+ <Pass shader="BLUR" input="luminosity_buffer2" output="downsample_buffer2">
+ <SetParam name="PoissonDistance" value="4"/>
+ <SetParam name="PoissonRotation" value="0"/>
+ </Pass>
+ <Pass shader="BLUR" input="luminosity_buffer2" output="downsample_buffer4">
+ <SetParam name="PoissonDistance" value="4"/>
+ <SetParam name="PoissonRotation" value="0.62831"/>
+ </Pass>
+ <Pass shader="COMBINER" input="[source]">
+ <BufferInput param="Downsample2" value="downsample_buffer2"/>
+ <BufferInput param="Downsample4" value="downsample_buffer4"/>
+ <RenderState name="Stencil" value="false"/>
+ </Pass>
+ </Passes>
+</Effect>
+
diff --git a/Studio/Content/Effect Library/LightTable.effect b/Studio/Content/Effect Library/LightTable.effect
new file mode 100644
index 0000000..91f5913
--- /dev/null
+++ b/Studio/Content/Effect Library/LightTable.effect
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="SurfDist" formalName="Distance to Surface" description="Distance from camera to the paper surface" default="100"/>
+ <Property name="BlurDist" formalName="Distance to Full Blur" description="Distance from the paper surface that\ncorresponds to fully blurred" default="100"/>
+ <Property name="MaxBlur" formalName="Max Blur Radius" description="Blur radius defined as 'full blur'" min="1" max="100" default="50"/>
+ <Property name="OverlayDif" formalName="Diffuse Texture" description="Texture overlay color for the paper surface" type="Texture" clamp="repeat" />
+ <Property name="OverlayTrn" formalName="Translucent Texture" description="Texture overlay translucency for the\npaper surface" type="Texture" clamp="repeat" />
+ <Property name="OverlayNrm" formalName="Normal Texture" description="Texture overlay normal for the paper\nsurface" type="Texture" clamp="repeat" />
+ <Property name="OverlayScale" formalName="Texture Scale" description="Texture overlay scaling factor" type="Float2" default="1 1"/>
+ <Property name="OverlayRot" formalName="Texture Rotation" description="Texture overlay rotation angle" default="0" min="0" max="360"/>
+ <Property name="OverlayTrans" formalName="Translucency blocking" description="How much translucency through the overlay" default="2.0"/>
+ <Property name="LightCol" formalName="Light Color" description="Color of the backlight" type="Color" default="1 1 1"/>
+ <Property name="LightBrt" formalName="Light Brightness" description="Brightness of the backlight" default="1.0"/>
+ <Property name="LightExp" formalName="Light Exposure" descriptoin="Pre-emptive exposure operation to prevent\nblowout" default="1.0"/>
+
+ <Property name="DimplePos" formalName="Dimple Position" description="On-screen position of a depth\n'pressure dimple'" type="Float2" default="0 0"/>
+ <Property name="DimpleDepth" formalName="Dimple Pressure" description="How deep the 'pressure dimple' goes" default="0"/>
+ <Property name="DimpleSize" formalName="Dimple Size" description="How big the pressure dimple is in\nonscreen pixels" default="1" min="1" max="1000"/>
+
+ <!-- Internal buffers plus a few extra options -->
+ <Property name="DepthSampler" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="DistBuffer" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="BlurBuffer" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="SrcSampler" type="Texture" filter="linear" clamp="clamp"/>
+ <Property name="HalfSampler" type="Texture" filter="linear" clamp="clamp"/>
+ <Property name="BlurDebug" formalName="Debug Blur Amt" type="Boolean" default="False"/>
+ <Property name="DepthDebug" formalName="Debug Depth Map" type="Boolean" default="False"/>
+ </MetaData>
+<Shaders>
+ <Shared>
+#include "depthpass.glsllib"
+
+uniform vec2 CameraClipRange;
+ </Shared>
+ <Shader name="DOWNSAMPALPHA">
+ <FragmentShader>
+void frag()
+{
+ // Simple averaging blur, but makes sure to include the alpha channel from the blur weights
+ // Only need to do this once to actually set the alphas in the blur buffers.
+ vec4 smp0 = textureOffset(Texture0, TexCoord.xy, ivec2(-1,-1));
+ vec4 smp1 = textureOffset(Texture0, TexCoord.xy, ivec2(0,-1));
+ vec4 smp2 = textureOffset(Texture0, TexCoord.xy, ivec2(-1,0));
+ vec4 smp3 = texture(Texture0, TexCoord.xy);
+
+ smp0.w *= textureOffset(DistBuffer, TexCoord.xy, ivec2(-1,-1)).w;
+ smp1.w *= textureOffset(DistBuffer, TexCoord.xy, ivec2(0,-1)).w;
+ smp2.w *= textureOffset(DistBuffer, TexCoord.xy, ivec2(-1,0)).w;
+ smp3.w *= texture(DistBuffer, TexCoord.xy).w;
+
+ gl_FragColor = 0.25 * (smp0 + smp1 + smp2 + smp3);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="DOWNSAMPLE">
+ <FragmentShader>
+void frag() // Simple averaging blur.
+{
+ vec4 smp0 = textureOffset(Texture0, TexCoord.xy, ivec2(-1,-1));
+ vec4 smp1 = textureOffset(Texture0, TexCoord.xy, ivec2(0,-1));
+ vec4 smp2 = textureOffset(Texture0, TexCoord.xy, ivec2(-1,0));
+ vec4 smp3 = texture(Texture0, TexCoord.xy);
+
+ gl_FragColor = 0.25 * (smp0 + smp1 + smp2 + smp3);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="FINDBLURAMT">
+ <FragmentShader>
+void frag()
+{
+ float planeDepth = SurfDist;
+
+ vec2 dvec = gl_FragCoord.xy - vec2(DimplePos);
+ float dimple = dot(dvec, dvec) / (DimpleSize * DimpleSize);
+ planeDepth += exp2(-dimple) * DimpleDepth;
+
+ vec4 depthSample = texture(DepthSampler, TexCoord);
+ float depthVal = getDepthValue( depthSample, CameraClipRange );
+ float rawDepth = depthValueToLinearDistance( depthVal, CameraClipRange );
+
+ if (DepthDebug)
+ {
+ gl_FragColor = vec4( (rawDepth - CameraClipRange.x) / (CameraClipRange.y - CameraClipRange.x) );
+ return;
+ }
+
+ float blurAmt = smoothstep(0.0, 1.0, (rawDepth - planeDepth) / BlurDist);
+ gl_FragColor = vec4(blurAmt, blurAmt, blurAmt, 1.0 - blurAmt);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BLURX">
+ <FragmentShader>
+void frag()
+{
+ vec4 smp = texture(DistBuffer, TexCoord.xy);
+ float sigma = clamp(smp.x * MaxBlur * 0.25, 1.0, 25.0);
+ int smpCount = int(ceil( sigma ));
+ vec4 value = texture(BlurBuffer, TexCoord.xy);
+ float wtsum = 1.0;
+ for (int i = 1; i &lt;= smpCount; ++i)
+ {
+ // Base 2 Gaussian blur
+ float wt = float(i) / (sigma * 0.5);
+ wt = exp2( -wt*wt );
+ value += wt * textureOffset(BlurBuffer, TexCoord.xy, ivec2(-i,0));
+ value += wt * textureOffset(BlurBuffer, TexCoord.xy, ivec2(i,0));
+ wtsum += wt * 2.0;
+ }
+
+ gl_FragColor = value / wtsum;
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BLURY">
+ <FragmentShader>
+void frag()
+{
+ vec4 smp = texture(DistBuffer, TexCoord.xy);
+
+ float sigma = clamp(smp.x * MaxBlur * 0.25, 1.0, 25.0);
+ int smpCount = int(ceil( sigma ));
+ vec4 value = texture(BlurBuffer, TexCoord.xy);
+ value.w *= smp.w;
+ float wtsum = 1.0;
+ for (int i = 1; i &lt;= smpCount; ++i)
+ {
+ // Base 2 Gaussian blur
+ float wt = float(i) / (sigma * 0.5);
+ wt = exp2( -wt*wt );
+ value += wt * textureOffset(BlurBuffer, TexCoord.xy, ivec2(0,-i));
+ value += wt * textureOffset(BlurBuffer, TexCoord.xy, ivec2(0,i));
+ wtsum += wt * 2.0;
+ }
+
+ gl_FragColor = value / wtsum;
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="COMBINE">
+ <FragmentShader>
+void frag()
+{
+ float blurFac = texture(DistBuffer, TexCoord.xy).x;
+ float lod = log2(MaxBlur * blurFac);
+ float fac0 = clamp(lod, 0.0, 1.0);
+ float fac1 = clamp(lod-1.0, 0.0, 1.0);
+
+ if (BlurDebug || DepthDebug)
+ {
+ gl_FragColor = vec4(blurFac);
+ return;
+ }
+
+ vec4 result = texture(SrcSampler, TexCoord.xy);
+ vec4 lvl1 = texture(HalfSampler, TexCoord.xy);
+ vec4 fullBlr = texture(BlurBuffer, TexCoord.xy);
+
+ // Basically this says that if the blur factor is really small (less than 2 pixels)
+ // we favor the full resolution. If it's between 2 and 4 pixels, we favor the half-res
+ // version (which is like one mip level down)... anything beyond that, we use the bottom
+ // level which actually has the proper local blur.
+ result = mix(mix(result, lvl1, fac0), fullBlr, fac1);
+
+ // Transform the texture (assuming rotation about the center of the texture)
+ float cosX = cos(OverlayRot * 0.01745329251);
+ float sinX = sin(OverlayRot * 0.01745329251);
+ mat3x3 texMat = mat3x3( 1.0, 0.0, -0.5, 0.0, 1.0, -0.5, 0.0, 0.0, 1.0 );
+ texMat *= mat3x3( cosX, -sinX, 0.0, sinX, cosX, 0.0, 0.0, 0.0, 1.0);
+ texMat *= mat3x3( 1.0, 0.0, 0.5, 0.0, 1.0, 0.5, 0.0, 0.0, 1.0 );
+ texMat *= mat3x3( OverlayScale.x, 0.0, 0.0, 0.0, OverlayScale.y, 0.0, 0.0, 0.0, 1.0);
+ vec3 texForm = texMat * vec3(TexCoord.xy, 1.0);
+ vec4 overSmp = texture(OverlayDif, texForm.xy);
+ float overTrn = 1.0 - texture(OverlayTrn, texForm.xy).x;
+ float nDotL = (texture(OverlayNrm, texForm.xy).z - 0.5) * 2.0;
+
+ // Want to see how much of a "difference" there is between the light
+ // color and the object color.
+ // We are basically acting as if the objects on the layer are occluders
+ // so the alpha as a result of blurring is like a transparency.
+ // The behavior is that the brighter the light is, the more of a "gap" there is
+ vec3 backlight = LightCol.rgb * LightBrt;
+
+ // Assume that the color map I'm using already tells us what N.dot.L is (for now)
+ float translucency = exp2( -overTrn * OverlayTrans );
+
+// vec3 colorDelta = backlight - result.rgb;
+// float deltaC = dot(colorDelta, colorDelta) * (1.0 - result.w) * LightBrt / LightExp;
+// result.rgb -= result.rgb * smoothstep(deltaC, 1.0, result.w);
+
+// gl_FragColor = vec4( result.rgb, 1.0 );
+// return;
+
+ backlight *= mix(vec3(1.0), result.rgb, result.w);
+ backlight *= nDotL * translucency * overSmp.rgb;
+
+ backlight = vec3(1.0) - exp2(-6.28*backlight/LightExp);
+
+ gl_FragColor = vec4(backlight, 1.0);
+}
+ </FragmentShader>
+ </Shader>
+</Shaders>
+<Passes>
+ <Buffer name="halfBuffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".5" lifetime="frame"/>
+ <Buffer name="qtrBuffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".25" lifetime="frame"/>
+ <Buffer name="tempqtr" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".25" lifetime="frame"/>
+ <Buffer name="blurweights" type="ubyte" format="rgba" filter="linear" wrap="clamp" size="1" lifetime="frame"/>
+ <Pass shader="FINDBLURAMT" output="blurweights">
+ <DepthInput param="DepthSampler"/>
+ </Pass>
+ <Pass shader="DOWNSAMPALPHA" input="[source]" output="halfBuffer">
+ <BufferInput param="DistBuffer" value="blurweights" />
+ </Pass>
+ <Pass shader="DOWNSAMPLE" input="halfBuffer" output="qtrBuffer"/>
+ <Pass shader="BLURX" output="tempqtr">
+ <BufferInput param="BlurBuffer" value="qtrBuffer" />
+ <BufferInput param="DistBuffer" value="blurweights" />
+ </Pass>
+ <Pass shader="BLURY" output="qtrBuffer">
+ <BufferInput param="BlurBuffer" value="tempqtr" />
+ <BufferInput param="DistBuffer" value="blurweights" />
+ </Pass>
+ <Pass shader="COMBINE">
+ <BufferInput param="SrcSampler" value="[source]" />
+ <BufferInput param="HalfSampler" value="halfBuffer" />
+ <BufferInput param="BlurBuffer" value="qtrBuffer" />
+ <BufferInput param="DistBuffer" value="blurweights" />
+ </Pass>
+</Passes>
+</Effect>
diff --git a/Studio/Content/Effect Library/Motion Blur.effect b/Studio/Content/Effect Library/Motion Blur.effect
new file mode 100644
index 0000000..6d8d4cf
--- /dev/null
+++ b/Studio/Content/Effect Library/Motion Blur.effect
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <!--Create an apparent streaking for rapidly moving objects in the layer.-->
+ <Property name="fadeAmount" formalName="Fade Amount" min="0" max="1" default=".05" description="0 = object trails persist\n1.0 = object trails fade out\nimmediately (no trail)" />
+ <Property name="GlowSampler" type="Texture" filter="nearest" clamp="clamp" />
+ <Property name="Sprite" type="Texture" filter="nearest" clamp="clamp" />
+ </MetaData>
+ <Shaders>
+ <Shared>
+#include "blur.glsllib"
+ </Shared>
+
+ <Shader name="HBLUR">
+ <VertexShader>
+void vert()
+{
+ SetupHorizontalGaussianBlur3Tap( Texture0Info.x, 1.0, TexCoord );
+}
+ </VertexShader>
+ <FragmentShader>
+void frag()
+{
+ vec4 src = texture2D_0(TexCoord);
+
+ float Trailfade = 1.0 - fadeAmount;
+ vec4 OutCol = GaussianBlur3TapPremultiplied( GlowSampler ) * Trailfade;
+
+ // change the color so that it looks different. saturate it a bit.
+ float srcSum = dot(vec3(1.0), src.rgb);
+ src.rgb = src.rgb * 0.7 + vec3(srcSum,srcSum,srcSum) * 0.3;
+ gl_FragColor.rgb = (1.0 - src.a) * OutCol.rgb + src.rgb;
+ gl_FragColor.a = src.a + OutCol.a;
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="VBLUR">
+ <VertexShader>
+void vert()
+{
+ SetupVerticalGaussianBlur3Tap( Texture0Info.y, 1.0, TexCoord );
+}
+ </VertexShader>
+ <FragmentShader>
+void frag() // PS_Blur_Vertical
+{
+ vec4 OutCol = GaussianBlur3TapPremultiplied( Texture0 );
+ gl_FragColor = OutCol;
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BLEND">
+ <FragmentShader>
+void frag()
+{
+ vec4 src = texture2D_0(TexCoord);
+ vec4 dst = texture2D_Sprite(TexCoord);
+
+ colorOutput(src * (1.0-dst.a) + dst);
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Buffer name="glow_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".25" lifetime="scene"/>
+ <Buffer name="temp_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".25" lifetime="frame"/>
+
+ <Pass name="1" shader="HBLUR" input="[source]" output="temp_buffer">
+ <BufferInput param="GlowSampler" value="glow_buffer"/>
+ </Pass>
+ <Pass name="2" shader="VBLUR" input="temp_buffer" output="glow_buffer"/>
+ <Pass name="pass3_Composite" shader="BLEND" input="glow_buffer">
+ <BufferInput param="Sprite" value="[source]"/>
+ </Pass>
+ </Passes>
+</Effect>
diff --git a/Studio/Content/Effect Library/SCurveTonemap.effect b/Studio/Content/Effect Library/SCurveTonemap.effect
new file mode 100644
index 0000000..fc0259b
--- /dev/null
+++ b/Studio/Content/Effect Library/SCurveTonemap.effect
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="Shoulder" formalName="Shoulder Slope" type="Float" default="1" min="0" max="3"/>
+ <Property name="ShoulderWt" formalName="Shoulder Emphasis" type="Float" default="0" min="-1" max="1"/>
+ <Property name="Toe" formalName="Toe Slope" type="Float" default="1" min="0" max="3"/>
+ <Property name="ToeWt" formalName="Toe Emphasis" type="Float" default="0" min="-1" max="1"/>
+ <Property name="Contrast" formalName="Contrast Boost" type="Float" default="0" min="-1" max="2"/>
+ <Property name="Saturation" formalName="Saturation Level" type="Float" default="1" min="0" max="2"/>
+ <Property name="GammaValue" formalName="Gamma" type="Float" default="2.2" min="0.1" max="8"/>
+ <Property name="UseExposure" formalName="Use Exposure" type="Boolean" default="False"/>
+ <Property name="WhiteVal" formalName="White Point" type="Float" default="1.0" min="0.01" max="128.0">
+ <ShowIfEqual property="UseExposure" value="False"/>
+ </Property>
+ <Property name="ExposeVal" formalName="Exposure Value" type="Float" default="1.0" min="0.01" max="16.0">
+ <ShowIfEqual property="UseExposure" value="True"/>
+ </Property>
+ </MetaData>
+ <Shaders>
+ <Shared>
+#include "luminance.glsllib"
+
+float remapLum( float inLum, float whitePt )
+{
+ return clamp( inLum / whitePt, 0.0, 1.0 );
+}
+
+float exposeLum( float inLum, float exposure )
+{
+ return 1.0 - exp2( -inLum / exposure );
+}
+
+vec3 gammaCorrect( vec3 inColor, float gammaExp )
+{
+ return pow( inColor, vec3( 1.0 / gammaExp ) );
+}
+
+vec3 adjSaturation( vec3 inRGB, float satFactor )
+{
+ // Must be done in linear space (before gamma correction)
+ float P = sqrt( luminance( inRGB * inRGB ) );
+ vec3 outCol;
+ outCol = (inRGB - vec3(P)) * satFactor;
+ outCol += vec3(P);
+ return outCol;
+}
+
+ </Shared>
+<Shader name="TONEMAP">
+<FragmentShader>
+float curveCompute( float inLum, float slope0, float slope1 )
+{
+ float a1 = slope0;
+ float a2 = 3.0 - 2.0 * slope0 - slope1;
+ float a3 = slope1 + slope0 - 2.0;
+
+ // Cubic curve fit. This results in a curve that is 0 where inColor is 0
+ // equals 1 when inColor is 1, and the derivative at 0 is slope0 and the
+ // derivative at 1 is slope1
+ return ((((a3 * inLum) + a2)*inLum) + a1)*inLum;
+}
+
+float toeEmphasize( float inParam )
+{
+ float a1 = 1.0 - ToeWt;
+ float a2 = 2.0 * ToeWt;
+ float a3 = -ToeWt;
+
+ return ((((a3 * inParam) + a2) * inParam) + a1) * inParam;
+}
+
+float shoulderEmphasize( float inParam )
+{
+ float a1 = 1.0;
+ float a2 = ShoulderWt;
+ float a3 = -ShoulderWt;
+
+ return ((((a3 * inParam) + a2) * inParam) + a1) * inParam;
+}
+
+void frag()
+{
+ // k = shadow slope, m = midtone slope, n = highlight slope
+ float k = Toe;
+ float m = 1.0 + Contrast;
+ float n = Shoulder;
+
+ //vec4 sourceColor = texture(SourceSampler, TexCoord);
+ vec4 sourceColor = texture(Texture0, TexCoord);
+ vec3 sourceSep = RGBToYPbPr(sourceColor.rgb);
+
+ float lum = sourceSep.r;
+
+ if (UseExposure)
+ lum = exposeLum( lum, ExposeVal );
+ else
+ lum = remapLum( lum, WhiteVal );
+
+ float param0 = toeEmphasize( 2.0 * lum ); // Parametrization for Curve Part 1
+ float param1 = shoulderEmphasize( 2.0 * lum - 1.0 ); // Parametrization for Curve Part 2
+
+ float lum0 = 0.5 * curveCompute( param0, k, m );
+ float lum1 = 0.5 * curveCompute( param1, m, n ) + 0.5;
+ sourceSep.r = (lum > 0.5) ? lum1 : lum0;
+
+ // Convert back to RGB and gamma correct
+ vec3 finalColor = YPbPrToRGB( sourceSep );
+ finalColor = gammaCorrect( adjSaturation( finalColor, Saturation ), GammaValue );
+ gl_FragColor = vec4( finalColor, sourceColor.a );
+}
+</FragmentShader>
+</Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="TONEMAP" input="[source]" />
+ </Passes>
+</Effect> \ No newline at end of file
diff --git a/Studio/Content/Effect Library/SMAA1X.effect b/Studio/Content/Effect Library/SMAA1X.effect
new file mode 100644
index 0000000..66ee8f6
--- /dev/null
+++ b/Studio/Content/Effect Library/SMAA1X.effect
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="searchTex" filter="nearest" clamp="clamp" type="Texture" default="./maps/effects/SearchTex-yflipped.png" hidden="True"/>
+ <Property name="areaTex" filter="linear" clamp="clamp" type="Texture" default="./maps/effects/AreaTex-yflipped.png" hidden="True"/>
+ <Property name="blendTex" filter="linear" clamp="clamp" type="Texture" hidden="True"/>
+ </MetaData>
+ <Shaders>
+ <Shared>
+vec2 pixelIncrements;
+#define SMAA_PIXEL_SIZE pixelIncrements
+#define SMAA_HLSL_3 0
+#define SMAA_HLSL_4 0
+#define SMAA_HLSL_4_1 0
+#define SMAA_GLSL_3 1
+#define SMAA_GLSL_4 0
+#define SMAA_PRESET_LOW 0
+#define SMAA_PRESET_MEDIUM 0
+#define SMAA_PRESET_HIGH 1
+#define SMAA_PRESET_ULTRA 0
+#define SMAA_PRESET_CUSTOM 0
+ vec2 pixelSizes;
+ </Shared>
+ <Shader name="EdgeDetect">
+ <VertexShader>
+#define SMAA_ONLY_COMPILE_VS 1
+#include "SMAA.glsllib"
+
+out float4 svPosition;
+out float4 offset[3];
+
+void vert ()
+{
+ pixelIncrements = vec2( 1.0 / Texture0Info.x, 1.0 / Texture0Info.y );
+ float4 tempOffset[3];
+ float4 tempPos;
+ SMAAEdgeDetectionVS(gl_Position, tempPos, TexCoord, tempOffset);
+
+ offset[0] = tempOffset[0];
+ offset[1] = tempOffset[1];
+ offset[2] = tempOffset[2];
+ svPosition = tempPos;
+}
+ </VertexShader>
+ <FragmentShader>
+#define SMAA_ONLY_COMPILE_PS 1
+#include "SMAA.glsllib"
+
+in float4 svPosition;
+in float4 offset[3];
+
+
+void frag()
+{
+ pixelIncrements = vec2( 1.0 / Texture0Info.x, 1.0 / Texture0Info.y );
+ gl_FragColor = SMAALumaEdgeDetectionPS(TexCoord, offset, Texture0);
+}
+ </FragmentShader>
+ </Shader>
+
+ <Shader name="BlendingWeightCalculation">
+
+ <VertexShader>
+#define SMAA_ONLY_COMPILE_VS 1
+#include "SMAA.glsllib"
+out float4 svPosition;
+out float4 offset[3];
+out float2 pixcoord;
+void vert()
+{
+ pixelIncrements = vec2( 1.0 / Texture0Info.x, 1.0 / Texture0Info.y );
+ float4 tempOffset[3];
+ float4 tempPos;
+ float2 tempPixCoord;
+ SMAABlendingWeightCalculationVS(gl_Position, tempPos, TexCoord, tempPixCoord, tempOffset);
+
+
+ offset[0] = tempOffset[0];
+ offset[1] = tempOffset[1];
+ offset[2] = tempOffset[2];
+ svPosition = tempPos;
+ pixcoord = tempPixCoord;
+}
+ </VertexShader>
+ <FragmentShader>
+#define SMAA_ONLY_COMPILE_PS 1
+#include "SMAA.glsllib"
+in float4 svPosition;
+in float4 offset[3];
+in float2 pixcoord;
+//Required for temporal
+int4 subsampleIndices;
+
+void frag()
+{
+ pixelIncrements = vec2( 1.0 / Texture0Info.x, 1.0 / Texture0Info.y );
+ gl_FragColor = SMAABlendingWeightCalculationPS(TexCoord, pixcoord, offset, Texture0, areaTex, searchTex, subsampleIndices);
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="NeighborhoodBlending">
+ <VertexShader>
+#define SMAA_ONLY_COMPILE_VS 1
+#include "SMAA.glsllib"
+
+out float4 svPosition;
+out float4 offset[2];
+
+void vert ()
+{
+ pixelIncrements = vec2( 1.0 / Texture0Info.x, 1.0 / Texture0Info.y );
+ float4 tempOffset[2];
+ float4 tempPos;
+ SMAANeighborhoodBlendingVS(gl_Position, tempPos, TexCoord, tempOffset);
+ offset[0] = tempOffset[0];
+ offset[1] = tempOffset[1];
+ svPosition = tempPos;
+}
+ </VertexShader>
+ <FragmentShader>
+#define SMAA_ONLY_COMPILE_PS 1
+#include "SMAA.glsllib"
+
+in float4 svPosition;
+in float4 offset[2];
+void frag()
+{
+ pixelIncrements = vec2( 1.0 / Texture0Info.x, 1.0 / Texture0Info.y );
+ gl_FragColor = SMAANeighborhoodBlendingPS(TexCoord, offset, Texture0, blendTex);
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Buffer name="edges_buffer" type="ubyte" format="rg" filter="linear" wrap="clamp" lifetime="scene"/>
+ <Buffer name="blend_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" lifetime="scene"/>
+ <Buffer name="stencil_buffer" format='depth24stencil8' lifetime="frame" />
+ <Pass shader="EdgeDetect" input='[source]' output='edges_buffer'>
+ <DepthStencil buffer='stencil_buffer' flags='clear-stencil' stencil-fail='replace' depth-fail='replace' depth-pass='replace' stencil-function='always' reference='1'/>
+ </Pass>
+ <Pass shader="BlendingWeightCalculation" input='edges_buffer' output='blend_buffer' >
+ <DepthStencil buffer='stencil_buffer' stencil-fail='keep' depth-fail='keep' depth-pass='keep' stencil-function='equal' reference='1'/>
+ </Pass>
+ <Pass shader='NeighborhoodBlending' input='[source]' >
+ <BufferInput param='blendTex' value="blend_buffer"/>
+ </Pass>
+ </Passes>
+</Effect>
+
diff --git a/Studio/Content/Effect Library/Screen Space AO.effect b/Studio/Content/Effect Library/Screen Space AO.effect
new file mode 100644
index 0000000..84da723
--- /dev/null
+++ b/Studio/Content/Effect Library/Screen Space AO.effect
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="FilterSize" formalName="Filter Size" description="Range to shoot samples for conversion" default="4"/>
+ <Property name="DistScale" formalName="Distance Scale" description="Divisor for distances during filtering;\nlarger equals more subtle" default="8"/>
+ <Property name="DistBias" formalName="Distance Bias" description="Depth bias to prevent self-shadowing artifacts" default="1"/>
+ <Property name="DebugView" formalName="Debug SSAO effect" type="Boolean" description="Allows you to see the effect of\nthe filter directly to help setup\nparameters" default="False"/>
+ <Property name="DepthSampler" type="Texture" filter="nearest" clamp="clamp"/>
+ <Property name="SourceSampler" type="Texture" filter="linear" clamp="clamp"/>
+ </MetaData>
+
+ <Shaders>
+
+ <Shader name="SSAO">
+ <FragmentShader>
+#include "depthpass.glsllib"
+uniform vec2 CameraClipRange;
+
+void frag( void )
+{
+ float ret = 16.0;
+
+ vec3 kernel[16];
+
+ // Not particularly random set of samples, I know, which means some risk
+ // of artifacts due to regularity.
+ kernel[0] = vec3(0.355512, -0.709318, -0.102371);
+ kernel[1] = vec3(0.534186, 0.71511, -0.115167);
+ kernel[2] = vec3(-0.87866, 0.157139, -0.115167);
+ kernel[3] = vec3(0.140679, -0.475516, -0.0639818);
+ kernel[4] = vec3(-0.0796121, 0.158842, -0.677075);
+ kernel[5] = vec3(-0.0759516, -0.101676, -0.483625);
+ kernel[6] = vec3(0.12493, -0.0223423, -0.483625);
+ kernel[7] = vec3(-0.0720074, 0.243395, -0.967251);
+ kernel[8] = vec3(-0.207641, 0.414286, 0.187755);
+ kernel[9] = vec3(-0.277332, -0.371262, 0.187755);
+ kernel[10] = vec3(0.63864, -0.114214, 0.262857);
+ kernel[11] = vec3(-0.184051, 0.622119, 0.262857);
+ kernel[12] = vec3(0.110007, -0.219486, 0.435574);
+ kernel[13] = vec3(0.235085, 0.314707, 0.696918);
+ kernel[14] = vec3(-0.290012, 0.0518654, 0.522688);
+ kernel[15] = vec3(0.0975089, -0.329594, 0.609803);
+
+ ivec2 iCoords = ivec2( gl_FragCoord.xy + vec2(0.5, 0.5) );
+ float depth = getDepthValue(texelFetch(DepthSampler, iCoords, 0), CameraClipRange);
+ depth = depthValueToLinearDistance( depth, CameraClipRange );
+
+ for( int i = 15; i >= 0; --i )
+ {
+ // Note -- this cheap 2D trick is partially correct, but what we really need is to
+ // get the actual position, shoot the ray in 3d and re-project to get the actual
+ // 3D distance between points.
+ vec3 ray = kernel[i] * FilterSize;
+ ivec2 newSamp = ivec2( iCoords + ray.xy );
+ float sampleDepth = getDepthValue( texelFetch(DepthSampler, newSamp, 0), CameraClipRange );
+ sampleDepth = depthValueToLinearDistance( sampleDepth, CameraClipRange );
+
+ // Occlusion is applied based on a Cauchy distribution filter
+ float occlDist = max(sampleDepth - depth - DistBias, 0.0) / DistScale;
+
+ // This gives us an occlusion based on distance where the closest stuff
+ // occludes the most, but the extra little subtraction of a yet tighter
+ // Cauchy lobe means that we avoid the super-close stuff in order to limit
+ // self occlusion. The 1.5 multiplier is to assure that the maximum possible
+ // effect of a given sample is 1.0 exactly.
+ float occlFactor = 1.0 / ( 1.0 + occlDist*occlDist*0.04 );
+ occlFactor -= 1.0 / ( 1.0 + occlDist*occlDist );
+ ret -= 1.5 * occlFactor;
+
+ }
+ ret /= 16.0;
+
+ vec4 backColor = texture2D_SourceSampler(TexCoord);
+ if (DebugView)
+ {
+ backColor = vec4( 1.0 );
+ }
+
+ gl_FragColor = vec4( ret,ret,ret, 1.0 ) * backColor;
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="SSAO">
+ <BufferInput value="[source]" param="SourceSampler" />
+ <DepthInput param="DepthSampler" />
+ </Pass>
+ </Passes>
+</Effect>
diff --git a/Studio/Content/Effect Library/Sepia.effect b/Studio/Content/Effect Library/Sepia.effect
new file mode 100644
index 0000000..3129e33
--- /dev/null
+++ b/Studio/Content/Effect Library/Sepia.effect
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <!--Name of the effect is implicitly the file stem with extension -->
+ <!--Metadata stands for properties, events, and handlers and has the same format as the viewer's metadata file
+ and the data inserted at the top of lua files-->
+ <MetaData>
+ <!--Properties are automatically translated into the effect format when we generate the effect's GLSL file -->
+ <!--Colorizes the image to a faded brown color, simulating old film coloration.-->
+ <Property name="amount" formalName="Amount" min="0" max="1" default="1" description="0 = no change to image\n1 = full sepia effect" />
+ </MetaData>
+ <!-- default shader doesn't need to be named-->
+ <Shaders>
+ <!-- an implicit #include "effect.glsllib" is done at the top of all the produced shader files -->
+ <!-- Shared sections are pasted at the top of the files after the uniform declarations. Here you put your
+ varying declarations as well as functions that all the shaders need to use-->
+ <!--Sepia doesn't share anything so all of the shared sections could be omitted and you would get the same
+ code-->
+ <Shared></Shared>
+ <!--Shared data that you want all vertex shaders to see -->
+ <VertexShaderShared></VertexShaderShared>
+ <!--Shared data that you all fragment shaders to see -->
+ <FragmentShaderShared></FragmentShaderShared>
+ <!-- shaders can have names. No name means the shader gets its integer index as its name-->
+ <Shader name="main">
+ <!-- Shaders can also have Shared sections that are shared between the vertex and fragment shaders
+ of only precisely this shader-->
+ <!--no vertex shader or empty vertex shader means just output a vert(){} for the vertex shader-->
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+void frag()
+{
+ mat3 sepiaMat = mat3(0.0);
+
+ sepiaMat[0][0] = 0.393;
+ sepiaMat[1][0] = 0.769;
+ sepiaMat[2][0] = 0.189;
+
+ sepiaMat[0][1] = 0.349;
+ sepiaMat[1][1] = 0.686;
+ sepiaMat[2][1] = 0.168;
+
+ sepiaMat[0][2] = 0.272;
+ sepiaMat[1][2] = 0.534;
+ sepiaMat[2][2] = 0.131;
+
+ vec4 origColor = texture2D_0(TexCoord);
+ vec3 sepiaColor = sepiaMat*origColor.rgb;
+ sepiaColor = clamp( sepiaColor.rgb, 0.0, origColor.a );
+
+ colorOutput(vec4(mix( origColor.rgb, sepiaColor, amount ), origColor.a));
+}
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <!-- if there is only one shader then we can assume there is only one pass and we can go from there -->
+ <!-- for this example, however, I am demonstrating the pass xml elements-->
+ <Passes>
+ <!-- single pass, input is the special source name and output is the special destination name which is assumed
+ for the last pass -->
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/Stylize - Scatter.effect b/Studio/Content/Effect Library/Stylize - Scatter.effect
new file mode 100644
index 0000000..7bd30b5
--- /dev/null
+++ b/Studio/Content/Effect Library/Stylize - Scatter.effect
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <!--Scatters the pixels in a layer, creating a blurry or smeared appearance. Without changing the color of each individual pixel, the Scatter effect redistributes the pixels randomly, but in the same general area as their original positions.-->
+ <Property name="NoiseSamp" formalName="Noise" filter="linear" clamp="repeat" type="Texture" default="./maps/effects/brushnoise.png" hidden="True"/>
+ <Property name="Amount" formalName="Scatter Amount" min="0" max="127" default="20.0" description="Determines how much to scatter."/>
+ <Property name="dir" formalName="Grain" list="Both:Horizontal:Vertical" default="Both" description="The direction in which to scatter the\npixels, horizontally or vertically.\nSelect Both to scatter pixels in all directions."/>
+ <Property name="isRand" formalName="Randomize Every Frame" type="Boolean" default="False" description="Specifies whether scattering changes at\neach frame. To animate scattering without\nkeyframes, select the Randomize Every Frame\noption."/>
+ </MetaData>
+ <Shaders>
+ <Shader>
+ <FragmentShader>
+uniform float AppFrame; // frame number since app starts
+void frag (void)
+{
+ float size = 15.0;
+ float amount = Amount / 127.0 * 0.4;
+
+ vec2 uv = TexCoord * size;
+ if (isRand)
+ uv = fract(uv + 0.031 * AppFrame);
+
+ uv = texture2D_NoiseSamp(fract(uv)).xy - 0.5;
+
+ if (dir == 0) { // both directions
+ uv *= (vec2(1.5, 0.15) * amount);
+
+ } else if (dir == 1) { // x direction
+ uv *= (vec2(1.3, 0.0) * amount);
+
+ } else { // y direction
+ uv *= (vec2(0.0, 0.29) * amount);
+ }
+
+ uv += TexCoord;
+
+ // shift half of a pixel size of the source to avoid the artifact on upper right borders.
+ // FBO size is bigger than the sprite, so clamping to [0, 1] will introduce artifacts
+ // (when OpenGL glTexParameter is set to linear). Lets not rely on OpenGL to clamp. we
+ // do it here.
+ vec2 halfPixelSize = 0.5 / Texture0Info.xy;
+ colorOutput(texture2D_0(clamp(uv, halfPixelSize, 1.0-halfPixelSize)));
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+</Effect>
diff --git a/Studio/Content/Effect Library/Tilt Shift.effect b/Studio/Content/Effect Library/Tilt Shift.effect
new file mode 100644
index 0000000..ddd9f60
--- /dev/null
+++ b/Studio/Content/Effect Library/Tilt Shift.effect
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="FocusPos" formalName="Focus Position" description="Height of the focus bar in\nnormalized coordinates" min="0" max="1" default=".5"/>
+ <Property name="FocusWidth" formalName="Focus Width" description="Objects within this range of Focus Distance\nwill be in focus" min="0" max="1" default=".2"/>
+ <Property name="BlurDebug" formalName="Debug Rendering" type="Boolean" description="Allows you to see exactly how the Focus\nvariables work. Black objects are in\nfocus, white are blurred" default="False"/>
+ <Property name="BlurAmount" formalName="Blur Amount" description="Increase the amount of blur. Amounts\nabove 4 may cause artifacts" min="0" max="10" default="4" />
+ <Property name="SourceSampler" type="Texture" filter="linear" clamp="clamp"/>
+ <Property name="VerticalEffect" formalName="Vertical" type='Boolean' description="Makes the effect work vertically\ninstead of horizontally" default="False"/>
+ <Property name="InvertBlur" formalName="Invert Blur" type="Boolean" description="Inverts the blur area so the center\nis blurred vs. the outer" default="False"/>
+ </MetaData>
+ <Shaders>
+ <Shared>
+#include "blur.glsllib"
+
+float AdvancedGetTiltShiftMultiplier(vec2 inTexCoord, float inFocusBarHeight, float inFocusWidth, bool inVertical, bool inInvert )
+{
+ //For now, you can't rotate the focus blur but in time you will be able to.
+ float texPos = inVertical ? inTexCoord.x : inTexCoord.y;
+ float focusDiff = max( 0.0, abs( texPos - inFocusBarHeight ) - (inFocusWidth/2.0) ) / inFocusWidth;
+ float retval = clamp( focusDiff, 0.0, 1.0 );
+ return inInvert ? 1.0 - retval : retval;
+}
+
+ </Shared>
+ <Shader name="DOWNSAMPLE">
+ <VertexShader>
+void vert()
+{
+ SetupBoxBlurCoords(vec2(Texture0Info.xy));
+}
+ </VertexShader>
+ <FragmentShader>
+
+vec4 AdvancedBoxTiltShiftBlur( sampler2D inBlurSampler, float inBlurSamplerAlphaFlag
+ , float inFocusBarHeight, float inFocusWidth
+ , bool inVertical, bool inInvert )
+{
+ float mult0 = .25 * AdvancedGetTiltShiftMultiplier( TexCoord0, inFocusBarHeight, inFocusWidth, inVertical, inInvert );
+ float mult1 = .25 * AdvancedGetTiltShiftMultiplier( TexCoord1, inFocusBarHeight, inFocusWidth, inVertical, inInvert );
+ float mult2 = .25 * AdvancedGetTiltShiftMultiplier( TexCoord2, inFocusBarHeight, inFocusWidth, inVertical, inInvert );
+ float mult3 = .25 * AdvancedGetTiltShiftMultiplier( TexCoord3, inFocusBarHeight, inFocusWidth, inVertical, inInvert );
+ float multTotal = mult0 + mult1 + mult2 + mult3;
+ float totalDivisor = multTotal != 0.0 ? 1.0 / multTotal : 0.0;
+ vec4 OutCol = GetTextureValuePreMult(inBlurSampler, TexCoord0) * mult0;
+ OutCol += GetTextureValuePreMult(inBlurSampler, TexCoord1) * mult1;
+ OutCol += GetTextureValuePreMult(inBlurSampler, TexCoord2) * mult2;
+ OutCol += GetTextureValuePreMult(inBlurSampler, TexCoord3) * mult3;
+ return OutCol * totalDivisor;
+}
+void frag() // Simple averaging box blur.
+{
+ gl_FragColor = AdvancedBoxTiltShiftBlur(Texture0, Texture0Info.z, FocusPos, FocusWidth, VerticalEffect, InvertBlur );
+}
+ </FragmentShader>
+ </Shader>
+ <Shader name="BLUR">
+ <VertexShader>
+
+void vert()
+{
+ SetupPoissonBlurCoords( BlurAmount, DestSize.xy );
+}
+
+ </VertexShader>
+ <FragmentShader>
+
+vec4 AdvancedPoissonTiltShiftBlur(sampler2D inSampler, float inAlphaFlag, float inBarHeight, float inFocusWidth, bool inVertical, bool inInvert )
+{
+ float mult0 = (1.0 - poisson0.z) * AdvancedGetTiltShiftMultiplier( TexCoord0, inBarHeight, inFocusWidth, inVertical, inInvert );
+ float mult1 = (1.0 - poisson1.z) * AdvancedGetTiltShiftMultiplier( TexCoord1, inBarHeight, inFocusWidth, inVertical, inInvert );
+ float mult2 = (1.0 - poisson2.z) * AdvancedGetTiltShiftMultiplier( TexCoord2, inBarHeight, inFocusWidth, inVertical, inInvert );
+ float mult3 = (1.0 - poisson3.z) * AdvancedGetTiltShiftMultiplier( TexCoord3, inBarHeight, inFocusWidth, inVertical, inInvert );
+ float mult4 = (1.0 - poisson4.z) * AdvancedGetTiltShiftMultiplier( TexCoord4, inBarHeight, inFocusWidth, inVertical, inInvert );
+
+ float multTotal = mult0 + mult1 + mult2 + mult3 + mult4;
+ float multMultiplier = multTotal > 0.0 ? 1.0 / multTotal : 0.0;
+
+ vec4 outColor = GetTextureValuePreMult( inSampler, TexCoord0 ) * (mult0 * multMultiplier);
+ outColor += GetTextureValuePreMult( inSampler, TexCoord1 ) * (mult1 * multMultiplier);
+ outColor += GetTextureValuePreMult( inSampler, TexCoord2 ) * (mult2 * multMultiplier);
+ outColor += GetTextureValuePreMult( inSampler, TexCoord3 ) * (mult3 * multMultiplier);
+ outColor += GetTextureValuePreMult( inSampler, TexCoord4 ) * (mult4 * multMultiplier);
+ return outColor;
+}
+
+void frag() // Mix the input blur and the depth texture with the sprite
+{
+ float centerMultiplier = AdvancedGetTiltShiftMultiplier( TexCoord, FocusPos, FocusWidth, VerticalEffect, InvertBlur );
+ if ( BlurDebug )
+ {
+ gl_FragColor = vec4( centerMultiplier,centerMultiplier,centerMultiplier, 1.0 );
+ }
+ else
+ {
+ vec4 blurColor = AdvancedPoissonTiltShiftBlur(Texture0, Texture0Info.z, FocusPos, FocusWidth, VerticalEffect, InvertBlur );
+ gl_FragColor = mix( texture2D_SourceSampler(TexCoord), blurColor, centerMultiplier );
+ }
+}
+ </FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Buffer name="downsample_buffer" type="ubyte" format="rgba" filter="linear" wrap="clamp" size=".5" lifetime="frame"/>
+ <Pass shader="DOWNSAMPLE" input="[source]" output="downsample_buffer"/>
+ <Pass shader="BLUR" input="downsample_buffer">
+ <BufferInput value="[source]" param="SourceSampler" />
+ </Pass>
+ </Passes>
+</Effect>
+
diff --git a/Studio/Content/Effect Library/VignetteEffect.effect b/Studio/Content/Effect Library/VignetteEffect.effect
new file mode 100644
index 0000000..7fbf7db
--- /dev/null
+++ b/Studio/Content/Effect Library/VignetteEffect.effect
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Effect>
+ <MetaData>
+ <Property name="vig_color" formalName="Vignet Color" type="Color" default="0.5 0.5 0.5" description="The color to use for the Vignetting."/>
+ <Property name="vig_strength" formalName="Strength" min="0" max="15" default="15.0" description="Strength of Vignetting."/>
+ <Property name="vig_radius" formalName="Radius" min="0" max="5" default="0.35" description="Size of Vignetting."/>
+ </MetaData>
+ <Shaders>
+ <Shared></Shared>
+ <VertexShaderShared></VertexShaderShared>
+ <FragmentShaderShared></FragmentShaderShared>
+ <Shader name="main">
+ <VertexShader></VertexShader>
+ <FragmentShader><![CDATA[
+
+void frag()
+{
+ vec4 origColor = texture2D_0(TexCoord);
+ vec2 uv = TexCoord.xy;
+ vec2 center = vec2(0.5);
+
+ vec4 bg = origColor;
+
+ uv *= 1.0 - uv.yx;
+ float vig = uv.x * uv.y * vig_strength;
+ vig = pow(vig, vig_radius);
+
+ vec4 vigColor = vec4(vig_color.rgb, vig) * vig;
+ gl_FragColor = mix(origColor, vigColor, 1.0 - vig);
+}
+ ]]></FragmentShader>
+ </Shader>
+ </Shaders>
+ <Passes>
+ <Pass shader="main" input="[source]" output="[dest]"/>
+ </Passes>
+</Effect>
+
+
diff --git a/Studio/Content/Effect Library/maps/effects/AreaTex-yflipped.dds b/Studio/Content/Effect Library/maps/effects/AreaTex-yflipped.dds
new file mode 100644
index 0000000..2f248cb
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/AreaTex-yflipped.dds
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/AreaTex-yflipped.png b/Studio/Content/Effect Library/maps/effects/AreaTex-yflipped.png
new file mode 100644
index 0000000..1d20d45
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/AreaTex-yflipped.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/CircleBokeh.png b/Studio/Content/Effect Library/maps/effects/CircleBokeh.png
new file mode 100644
index 0000000..c7da55e
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/CircleBokeh.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/HexagonalBokeh.png b/Studio/Content/Effect Library/maps/effects/HexagonalBokeh.png
new file mode 100644
index 0000000..5a2a7e6
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/HexagonalBokeh.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/SearchTex-yflipped.png b/Studio/Content/Effect Library/maps/effects/SearchTex-yflipped.png
new file mode 100644
index 0000000..b2f664c
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/SearchTex-yflipped.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/brushnoise.dds b/Studio/Content/Effect Library/maps/effects/brushnoise.dds
new file mode 100644
index 0000000..4fdc704
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/brushnoise.dds
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/brushnoise.png b/Studio/Content/Effect Library/maps/effects/brushnoise.png
new file mode 100644
index 0000000..43e2034
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/brushnoise.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/noise.dds b/Studio/Content/Effect Library/maps/effects/noise.dds
new file mode 100644
index 0000000..fdb5f20
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/noise.dds
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/noise.png b/Studio/Content/Effect Library/maps/effects/noise.png
new file mode 100644
index 0000000..69dd166
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/noise.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/noise3.dds b/Studio/Content/Effect Library/maps/effects/noise3.dds
new file mode 100644
index 0000000..31156b5
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/noise3.dds
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/noise3.png b/Studio/Content/Effect Library/maps/effects/noise3.png
new file mode 100644
index 0000000..f4857de
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/noise3.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/noiseUniform.dds b/Studio/Content/Effect Library/maps/effects/noiseUniform.dds
new file mode 100644
index 0000000..760ed6c
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/noiseUniform.dds
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/noiseUniform.png b/Studio/Content/Effect Library/maps/effects/noiseUniform.png
new file mode 100644
index 0000000..c9f2969
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/noiseUniform.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/ps_cloudlet.png b/Studio/Content/Effect Library/maps/effects/ps_cloudlet.png
new file mode 100644
index 0000000..d7cc2d6
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/ps_cloudlet.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/ps_glowDisc.png b/Studio/Content/Effect Library/maps/effects/ps_glowDisc.png
new file mode 100644
index 0000000..5cca911
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/ps_glowDisc.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/ps_glowSphere.png b/Studio/Content/Effect Library/maps/effects/ps_glowSphere.png
new file mode 100644
index 0000000..15c3363
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/ps_glowSphere.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/ps_rectangle.png b/Studio/Content/Effect Library/maps/effects/ps_rectangle.png
new file mode 100644
index 0000000..3f13ad1
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/ps_rectangle.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/ps_sphere.dds b/Studio/Content/Effect Library/maps/effects/ps_sphere.dds
new file mode 100644
index 0000000..5f58782
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/ps_sphere.dds
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/ps_sphere.png b/Studio/Content/Effect Library/maps/effects/ps_sphere.png
new file mode 100644
index 0000000..774c1f4
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/ps_sphere.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/ps_star.png b/Studio/Content/Effect Library/maps/effects/ps_star.png
new file mode 100644
index 0000000..3cd9da4
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/ps_star.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/snownoise.dds b/Studio/Content/Effect Library/maps/effects/snownoise.dds
new file mode 100644
index 0000000..070ba68
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/snownoise.dds
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/snownoise.png b/Studio/Content/Effect Library/maps/effects/snownoise.png
new file mode 100644
index 0000000..1042b3d
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/snownoise.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/starBokeh.png b/Studio/Content/Effect Library/maps/effects/starBokeh.png
new file mode 100644
index 0000000..661d868
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/starBokeh.png
Binary files differ
diff --git a/Studio/Content/Effect Library/maps/effects/white.png b/Studio/Content/Effect Library/maps/effects/white.png
new file mode 100644
index 0000000..18cca06
--- /dev/null
+++ b/Studio/Content/Effect Library/maps/effects/white.png
Binary files differ