Skip to content

Instantly share code, notes, and snippets.

@jrsa
Created February 3, 2018 22:42
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 jrsa/60e983567454c6141578a315cc457589 to your computer and use it in GitHub Desktop.
Save jrsa/60e983567454c6141578a315cc457589 to your computer and use it in GitHub Desktop.
color shifting displacement feedback process implemented as a unity3d postprocessing shader
Shader "Jars/PostEffect"
{
HLSLINCLUDE
#include "../PostProcessing/Shaders/StdLib.hlsl"
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
float _Blend;
float4 Frag(VaryingsDefault i) : SV_Target
{
float4 prelook = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
float4 color2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + ((prelook.rb - 0.5) / 200.0));
float4 shiftAmount = float4(0.005, 0.01, 0.015, 0.0);
return (color2 + shiftAmount) % 1.0;;
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment Frag
ENDHLSL
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment