Ok you need to add first code to your shader list and call it ReflectionShader01 (or any other name but you will then need to add it to Lua part. Then you can call this shader with Lua (second code here) with any action you create (at begin of scene or whatever you use). Also you will need to have your mask png linkded correctly so game knows where shader is appled on the screen. I will attach one I am using for my game but you can make any shape of it... Also other picture is used if you want to create waves effect alike water. My code if for clear non moving mirror tho. But you can play with settings to customize as you wish :)#ifdef GL_ES
precision lowp float;
precision lowp int;
#endif
uniform sampler2D texel;
uniform sampler2D DistortTex;
uniform sampler2D MaskTex;
varying vec2 uvVarying;
uniform float time;
uniform float TintR;
uniform float TintG;
uniform float TintB;
uniform float TintMix;
uniform float Mirror_PosY;
uniform float Distort_MoveX;
uniform float Distort_MoveY;
uniform float Strength;
//uniform float Mirror_PosX;
//uniform float Brechung;
void main ()
{
vec2 uv = uvVarying;
float Mask = texture2D(MaskTex, uv).r;
float Distort = texture2D(DistortTex, fract(uv + vec2(time*Distort_MoveX,time*Distort_MoveY) ) ).r;
vec4 ColorTint = vec4(TintR,TintG,TintB,1.0);
float Brechung = 1.0;
vec4 result = vec4(0.0);
vec4 base = texture2D(texel, uv);
float Offset = (Mirror_PosY-0.5)*2.0;
// if y 0.67 then 0.34
// if y 0.75 then 0.5
// if y 0.5 then 0.0
//
if (uv.y > Mirror_PosY) {
vec4 reflection = mix( texture2D(texel, vec2(uv.x,((1.0-uv.y)*Brechung) + (Distort*Strength) +Offset ) ) , ColorTint, TintMix);
result = mix(base, reflection, Mask);
} else {
result = base;
}
gl_FragColor = result;
}local eff = "ReflectionShader01"
shader_effects[eff] = { shader = Shaders[eff].Compiled }
shaderAddEffect(eff)
bind(eff, "time", field("getTime()*0.001"))
bind(eff, "TintR", field("0.3"))
bind(eff, "TintG", field("0.3"))
bind(eff, "TintB", field("0.3"))
bind(eff, "TintMix", field("0.5"))
bind(eff, "Mirror_PosY", field("0.78"))
bind(eff, "Distort_MoveX", field("0.0"))
bind(eff, "Distort_MoveY", field("0.0"))
bind(eff, "Strength", field("0.0"))
--bind(eff, "Mirror_PosX", field("1.0"))
--bind(eff, "Brechung", field("1.0"))
graphics.shaderUniform(shader_effects[eff].num.num, "_t_DistortTex", "vispath:effects/clouds02.png")
graphics.shaderUniform(shader_effects[eff].num.num, "_t_MaskTex", "vispath:effects/mask02.png")