stuff
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
|
||||
#include "common_fragment.h"
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
varying vec3 v_RefractTexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_normal","default":"","format":"normalmap","formatcombo":true}
|
||||
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","combo":"MASK","paintdefaultcolor":"0 0 0 1"}
|
||||
|
||||
void main() {
|
||||
#if MASK
|
||||
float mask = texSample2D(g_Texture2, v_TexCoord.zw).r;
|
||||
#else
|
||||
float mask = 1;
|
||||
#endif
|
||||
|
||||
vec2 texCoord = v_TexCoord.xy;
|
||||
vec3 normal = DecompressNormal(texSample2D(g_Texture1, v_RefractTexCoord.xy));
|
||||
|
||||
texCoord.xy += normal.xy * v_RefractTexCoord.z * mask;
|
||||
|
||||
vec4 albedo = texSample2D(g_Texture0, texCoord.xy);
|
||||
|
||||
//vec2 screenCoord = v_ScreenCoord.xy / v_ScreenCoord.z * CAST2(0.5) + 0.5;
|
||||
//vec4 bg = texSample2D(g_Texture3, screenCoord.xy);
|
||||
//albedo.rgb = mix(bg.rgb, albedo.rgb, albedo.a);
|
||||
//albedo.a = 1;
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture2Resolution;
|
||||
|
||||
uniform vec2 g_Scale; // {"material":"scale","label":"ui_editor_properties_scale","linked":true,"default":"1 1","range":[0,10]}
|
||||
uniform float g_Strength; // {"material":"strength","label":"ui_editor_properties_strength","default":0.1,"range":[-1,1]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
varying vec3 v_RefractTexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
v_RefractTexCoord.xy = a_TexCoord * g_Scale;
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
|
||||
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
|
||||
v_RefractTexCoord.z = sign(g_Strength) * g_Strength * g_Strength;
|
||||
}
|
||||
Reference in New Issue
Block a user