yes
This commit is contained in:
20
modules/wallpaper-engine/effects/colorkey/effect.json
Normal file
20
modules/wallpaper-engine/effects/colorkey/effect.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version" : 1,
|
||||
"replacementkey" : "colorkey",
|
||||
"name" : "ui_editor_effect_color_key_title",
|
||||
"description" : "ui_editor_effect_color_key_description",
|
||||
"group" : "colorize",
|
||||
"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/colorkey.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/colorkey.json",
|
||||
"shaders/effects/colorkey.frag",
|
||||
"shaders/effects/colorkey.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/colorkey",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name" : "Color Key",
|
||||
"description" : "Mask a part of the image that matches a color of choice.",
|
||||
"group" : "colorize",
|
||||
//"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/colorkey.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/colorkey.json",
|
||||
"shaders/effects/colorkey.frag",
|
||||
"shaders/effects/colorkey.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name" : "Opacity",
|
||||
"description" : "Adds an opacity mask to the image.",
|
||||
"group" : "colorize",
|
||||
"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/opacity.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/opacity.json",
|
||||
"shaders/effects/opacity.frag",
|
||||
"shaders/effects/opacity.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/colorkey",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/opacity",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"autosize" : true,
|
||||
"material" : "materials/effectpreview.json"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"file" : "scene.json",
|
||||
"general" :
|
||||
{
|
||||
"properties" :
|
||||
{
|
||||
"schemecolor" :
|
||||
{
|
||||
"order" : 0,
|
||||
"text" : "ui_browse_properties_scheme_color",
|
||||
"type" : "color",
|
||||
"value" : "0 0 0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title" : "preview",
|
||||
"type" : "scene"
|
||||
}
|
||||
66
modules/wallpaper-engine/effects/colorkey/preview/scene.json
Normal file
66
modules/wallpaper-engine/effects/colorkey/preview/scene.json
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"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",
|
||||
"colorBlendMode" : 0,
|
||||
"copybackground" : true,
|
||||
"depth" : 1,
|
||||
"effects" :
|
||||
[
|
||||
{
|
||||
"file" : "effects/colorkey/effect.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"constantshadervalues" :
|
||||
{
|
||||
"Color" : "0.5333333333333333 0.6784313725490196 0.5333333333333333",
|
||||
"Fuzziness" : 0.029999999329447746,
|
||||
"Tolerance" : 0.40000000596046448,
|
||||
"Write alpha" : 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"id" : 38,
|
||||
"image" : "models/effectpreview.json",
|
||||
"name" : "",
|
||||
"origin" : "128.000 128.000 0.000",
|
||||
"parallaxDepth" : "1.000 1.000",
|
||||
"scale" : "1.000 1.000 1.000",
|
||||
"size" : "256.000 256.000",
|
||||
"visible" : true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
// [COMBO] {"material":"Invert","combo":"INVERT","type":"options","default":0}
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
uniform float g_KeyAlpha; // {"material":"Write alpha","default":0,"range":[0,1]}
|
||||
uniform float g_KeyFuzz; // {"material":"Fuzziness","default":0,"range":[0,3]}
|
||||
uniform float g_KeyTolerance; // {"material":"Tolerance","default":0.1,"range":[0,3]}
|
||||
uniform vec3 g_KeyColor; // {"material":"Color", "type": "color", "default":"1 1 1"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
|
||||
float delta = dot(abs(g_KeyColor - albedo.rgb), vec3(1, 1, 1));
|
||||
float blend = smoothstep(0.001, 0.002 + g_KeyFuzz, delta - g_KeyTolerance);
|
||||
|
||||
#if INVERT == 1
|
||||
blend = 1.0 - blend;
|
||||
#endif
|
||||
|
||||
albedo.a *= mix(g_KeyAlpha, 1.0, blend);
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"Mask","mode":"opacitymask","default":"util/white"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
|
||||
albedo.a *= mask;
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture1Resolution;
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
|
||||
v_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "FX Preview",
|
||||
"type": "scene2d"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_invert","combo":"INVERT","type":"options","default":0}
|
||||
// [COMBO] {"material":"ui_editor_properties_flatten","combo":"FLATTEN","type":"options","default":0}
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"hidden":true}
|
||||
|
||||
uniform float g_KeyAlpha; // {"material":"alpha","label":"ui_editor_properties_write_alpha","default":0,"range":[0,1]}
|
||||
uniform float g_KeyFuzz; // {"material":"fuzziness","label":"ui_editor_properties_fuzziness","default":0,"range":[0,3]}
|
||||
uniform float g_KeyTolerance; // {"material":"tolerance","label":"ui_editor_properties_tolerance","default":0.1,"range":[0,3]}
|
||||
uniform vec3 g_KeyColor; // {"material":"color","label":"ui_editor_properties_color", "type": "color", "default":"1 1 1"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
|
||||
float delta = dot(abs(g_KeyColor - albedo.rgb), vec3(1, 1, 1));
|
||||
float blend = smoothstep(0.001, 0.002 + g_KeyFuzz, delta - g_KeyTolerance);
|
||||
|
||||
#if INVERT == 1
|
||||
blend = 1.0 - blend;
|
||||
#endif
|
||||
|
||||
albedo.a *= mix(g_KeyAlpha, 1.0, blend);
|
||||
|
||||
#if FLATTEN == 1
|
||||
albedo.rgb *= albedo.a;
|
||||
#endif
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
}
|
||||
Reference in New Issue
Block a user