Of course, I know nothing about shader but I like to try, I paste two shaders together and you can see the code blow, and I make a animation to tween those parameters to make that twice effect, only test in pc. hope that work for you.
Shader "james/BlendTwist"
{
Properties {
_Background ("Background", 2D) = "" {} //Receive input from a Texture on Texture Unit 0
_BackgroundScrollX ("X Offset", float) = 0 //Receive input from float
_BackgroundScrollY ("Y Offset", float) = 0 //Receive input from float
_BackgroundScaleX ("X Scale", float) = 1.0 //Receive input from float
_BackgroundScaleY ("Y Scale", float) = 1.0 //Receive input from float
_Refraction ("Refraction", float) = 0.0001 //Receive input from float
_DistortionMap ("Distortion Map", 2D) = "" {} //Receive input from a Texture on Texture Unit 1
_DistortionScrollX ("X Offset", float) = 0 //Receive input from float
_DistortionScrollY ("Y Offset", float) = 0 //Receive input from float
_DistortionScaleX ("X Scale", float) = 1.0 //Receive input from float
_DistortionScaleY ("Y Scale", float) = 1.0 //Receive input from float
_DistortionPower("Distortion Power", float) = 0.08 //Receive input from float
}
//Define a shader
SubShader {
//Define what queue/order to render this shader in
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} //Background | Geometry | AlphaTest | Transparent | Overlay - Render this shader as part of the geometry queue because it does not use blending
//Define a pass
Pass {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite Off Lighting Off Cull Off Fog { Mode Off } Blend SrcAlpha OneMinusSrcAlpha
LOD 110
CGPROGRAM //Start a program in the CG language
#pragma target 2.0 //Run this shader on at least Shader Model 2.0 hardware (e.g. Direct3D 9)
#pragma fragment frag //The fragment shader is named 'frag'
#pragma vertex vert //The vertex shader is named 'vert'
#include "UnityCG.cginc" //Include Unity's predefined inputs and macros
//Unity variables to be made accessible to Vertex and/or Fragment shader
uniform sampler2D _Background; //Define _Background from Texture Unit 0 to be sampled in 2D
//uniform float4 _Background_ST; //Use the Float _Background_ST to pass the Offset and Tiling for the texture(s)
uniform sampler2D _DistortionMap; //Define _DistortionMap from Texture Unit 1 to be sampled in 2D
//uniform float4 _DistortionMap_ST; //Use the Float _DistortionMap_ST to pass the Offset and Tiling for the texture(s)
uniform sampler2D _DistortionMap2; //Define _DistortionMap2 from Texture Unit 2 to be sampled in 2D
//uniform float4 _DistortionMap2_ST; //Use the Float _DistortionMap2_ST to pass the Offset and Tiling for the texture(s)
uniform float _BackgroundScrollX;
uniform float _BackgroundScrollY;
uniform float _DistortionScrollX;
uniform float _DistortionScrollY;
uniform float _DistortionPower;
uniform float _BackgroundScaleX;
uniform float _BackgroundScaleY;
uniform float _DistortionScaleX;
uniform float _DistortionScaleY;
uniform float _DistortionScrollX2;
uniform float _DistortionScrollY2;
uniform float _DistortionPower2;
uniform float _DistortionScaleX2;
uniform float _DistortionScaleY2;
uniform float _Refraction;
//Data structure communication from Unity to the vertex shader
//Defines what inputs the vertex shader accepts
struct AppData {
float4 vertex : POSITION; //Receive vertex position
half2 texcoord : TEXCOORD0; //Receive texture coordinates
//half2 texcoord1 : TEXCOORD1; //Receive texture coordinates
//fixed4 color : COLOR; //Receive vertex colors
};
//Data structure for communication from vertex shader to fragment shader
//Defines what inputs the fragment shader accepts
struct VertexToFragment {
float4 pos : POSITION; //Send fragment position to fragment shader
half2 uv : TEXCOORD0; //Send interpolated texture coordinate to fragment shader
//half2 uv2 : TEXCOORD1; //Send interpolated texture coordinate to fragment shader
//fixed4 color : COLOR; //Send interpolated gouraud-shaded vertex color to fragment shader
};
//Vertex shader
VertexToFragment vert(AppData v) {
VertexToFragment o; //Create a data structure to pass to fragment shader
o.pos = mul(UNITY_MATRIX_MVP,v.vertex); //Include influence of Modelview + Projection matrices
o.uv = v.texcoord.xy; //Send texture coords from unit 0 to fragment shader
return o; //Transmit data to the fragment shader
}
//Fragment shader
fixed4 frag(VertexToFragment i) : COLOR {
fixed2 distortion = tex2D(_DistortionMap, float2(_DistortionScaleX,_DistortionScaleY)*i.uv+float2(_DistortionScrollX,_DistortionScrollY).xy) * _DistortionPower - (_DistortionPower*0.5); //Get distortion map, Red=X, Green=Y
return tex2D(_Background, float2(_BackgroundScaleX,_BackgroundScaleY)*i.uv+(_Refraction*(distortion))+float2(_BackgroundScrollX,_BackgroundScrollY)); //Get the background
}
ENDCG //End of CG program
}
}
}