stuff
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name" : "Water Ripple",
|
||||
"description" : "Add a ripple animation. Draw a mask to limit the animation to a specific area of the image.",
|
||||
"group" : "image",
|
||||
//"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/waterripple.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/waterripple.json",
|
||||
"materials/effects/waterripplenormal.png",
|
||||
"materials/effects/waterripplenormal.tex-json",
|
||||
"shaders/effects/waterripple.frag",
|
||||
"shaders/effects/waterripple.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"blending" : "translucent",
|
||||
"cullmode" : "nocull",
|
||||
"depthtest" : "disabled",
|
||||
"depthwrite" : "disabled",
|
||||
"shader" : "genericimage2",
|
||||
"textures" : [ "effectpreview" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"clampuvs" : true,
|
||||
"format" : "rgba8888",
|
||||
"nomip" : true,
|
||||
"nonpoweroftwo" : true
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/waterripple",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"textures": [null, "effects/waterripplenormal"]
|
||||
}]
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"format" : "rgba8888",
|
||||
"nomip" : true
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"format" : "rgba8888",
|
||||
"nomip" : true,
|
||||
"nonpoweroftwo" : true
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"autosize" : true,
|
||||
"material" : "materials/effectpreview.json"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"file" : "scene.json",
|
||||
"title" : "fxtemplate"
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"camera" :
|
||||
{
|
||||
"center" : "0.000 0.000 -1.000",
|
||||
"eye" : "0.000 0.000 0.000",
|
||||
"up" : "0.000 1.000 0.000"
|
||||
},
|
||||
"general" :
|
||||
{
|
||||
"ambientcolor" : "0.3 0.3 0.3",
|
||||
"bloom" : false,
|
||||
"bloomstrength" : 2,
|
||||
"bloomthreshold" : 0.64999997615814209,
|
||||
"cameraparallax" : false,
|
||||
"cameraparallaxamount" : 0.5,
|
||||
"cameraparallaxdelay" : 0.10000000149011612,
|
||||
"cameraparallaxmouseinfluence" : 0,
|
||||
"camerapreview" : true,
|
||||
"camerashake" : false,
|
||||
"camerashakeamplitude" : 0.5,
|
||||
"camerashakeroughness" : 1,
|
||||
"camerashakespeed" : 3,
|
||||
"clearcolor" : "0.7 0.7 0.7",
|
||||
"orthogonalprojection" :
|
||||
{
|
||||
"height" : 256,
|
||||
"width" : 256
|
||||
},
|
||||
"skylightcolor" : "0.3 0.3 0.3"
|
||||
},
|
||||
"objects" :
|
||||
[
|
||||
{
|
||||
"angles" : "0.000 0.000 0.000",
|
||||
"depth" : 1,
|
||||
"effects" :
|
||||
[
|
||||
{
|
||||
"file" : "effects/waterripple/effect.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"constantshadervalues" :
|
||||
{
|
||||
"Ripple strength" : 0.25,
|
||||
"Scroll speed" : 0.2199999988079071
|
||||
},
|
||||
"textures" :
|
||||
[
|
||||
null,
|
||||
"effects/waterripplenormal",
|
||||
"masks/waterripple_mask_ee0d9bbc6d0516b8583c8fb3e841485c0b7ec4e8"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"id" : 28,
|
||||
"image" : "models/effectpreview.json",
|
||||
"name" : "",
|
||||
"origin" : "128.000 128.000 0.000",
|
||||
"scale" : "1.000 1.000 1.000"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
varying vec2 v_Scroll;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"Water normal"}
|
||||
uniform sampler2D g_Texture2; // {"material":"Mask","mode":"opacitymask","default":"util/white"}
|
||||
|
||||
uniform float g_Strength; // {"material":"Ripple strength","default":0.1,"range":[0,1]}
|
||||
|
||||
varying vec4 v_TexCoordRipple;
|
||||
|
||||
void main() {
|
||||
vec2 texCoord = v_TexCoord.xy;
|
||||
|
||||
float mask = texSample2D(g_Texture2, v_TexCoord.zw).r;
|
||||
|
||||
vec3 n1 = texSample2D(g_Texture1, v_TexCoordRipple.xy).xyz * 2 - 1;
|
||||
vec3 n2 = texSample2D(g_Texture1, v_TexCoordRipple.zw).xyz * 2 - 1;
|
||||
vec3 normal = normalize(vec3(n1.xy + n2.xy, n1.z));
|
||||
|
||||
|
||||
texCoord.xy += normal.xy * g_Strength * g_Strength * mask;
|
||||
|
||||
gl_FragColor = texSample2D(g_Texture0, texCoord);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform float g_Time;
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
uniform vec4 g_Texture2Resolution;
|
||||
|
||||
uniform float g_AnimationSpeed; // {"material":"Animation speed","default":0.15,"range":[0,0.5]}
|
||||
uniform float g_Scale; // {"material":"Ripple scale","default":1,"range":[0,10]}
|
||||
uniform float g_ScrollSpeed; // {"material":"Scroll speed","default":0,"range":[0,0.5]}
|
||||
uniform float g_Direction; // {"material":"Scroll direction","default":0,"range":[0,6.28]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
varying vec4 v_TexCoordRipple;
|
||||
|
||||
vec2 rotateVec2(vec2 v, float r) {
|
||||
vec2 cs = vec2(cos(r), sin(r));
|
||||
return vec2(v.x * cs.x - v.y * cs.y,
|
||||
v.x * cs.y + v.y * cs.x);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
|
||||
float piFrac = 0.78539816339744830961566084581988 * 0.5;
|
||||
float pi = 3.141;
|
||||
|
||||
vec2 coordsRotated = v_TexCoord.xy;
|
||||
vec2 coordsRotated2 = v_TexCoord.xy * 1.333;
|
||||
|
||||
vec2 scroll = rotateVec2(vec2(0, -1), g_Direction) * g_ScrollSpeed * g_ScrollSpeed * g_Time;
|
||||
|
||||
v_TexCoordRipple.xy = coordsRotated + g_Time * g_AnimationSpeed * g_AnimationSpeed + scroll;
|
||||
v_TexCoordRipple.zw = coordsRotated2 - g_Time * g_AnimationSpeed * g_AnimationSpeed + scroll;
|
||||
v_TexCoordRipple *= g_Scale;
|
||||
|
||||
float rippleTextureAdjustment = (g_Texture0Resolution.x / g_Texture0Resolution.y);
|
||||
v_TexCoordRipple.xz *= rippleTextureAdjustment;
|
||||
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
|
||||
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
|
||||
}
|
||||
Reference in New Issue
Block a user