Skip to content

Instantly share code, notes, and snippets.

@Bananaft
Last active September 23, 2018 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bananaft/461c78495a2878cb132676ccab9535a9 to your computer and use it in GitHub Desktop.
Save Bananaft/461c78495a2878cb132676ccab9535a9 to your computer and use it in GitHub Desktop.
#include "Uniforms.glsl"
#include "Samplers.glsl"
#include "Transform.glsl"
#include "ScreenPos.glsl"
varying vec2 vScreenPos;
uniform float cBlurness;
void VS()
{
mat4 modelMatrix = iModelMatrix;
vec3 worldPos = GetWorldPos(modelMatrix);
gl_Position = GetClipPos(worldPos);
vScreenPos = GetScreenPosPreDiv(gl_Position);
}
void PS()
{
vec4 viewport = texture2D(sDiffMap, vScreenPos);
vec4 prevFrame = texture2D(sSpecMap, vScreenPos);
vec4 Col = viewport*(1.-cBlurness) + prevFrame * cBlurness;
gl_FragColor = Col;
}
<renderpath>
<rendertarget name="copyframe" sizedivisor="1 1" tag="Blur" format="rgba"/>
<command type="quad" tag="Blur" vs="copyblur" ps="copyblur">
<texture unit="diffuse" name="viewport" />
<texture unit="specular" name="copyframe" />
<output index="0" name="viewport" />
<output index="1" name="copyframe" />
<parameter name="Blurness" value="0.7" />
</command>
</renderpath>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment