yes
This commit is contained in:
21
modules/wallpaper-engine/effects/edgedetection/effect.json
Normal file
21
modules/wallpaper-engine/effects/edgedetection/effect.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"version" : 1,
|
||||
"replacementkey" : "edgedetection",
|
||||
"name" : "ui_editor_effect_edge_detection_title",
|
||||
"description" : "ui_editor_effect_edge_detection_description",
|
||||
"group" : "enhance",
|
||||
"performance" : "expensive",
|
||||
"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/edgedetection.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/edgedetection.json",
|
||||
"shaders/effects/edgedetection.frag",
|
||||
"shaders/effects/edgedetection.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/edgedetection",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name" : "Edge Detection",
|
||||
"description" : "Detects edges of the image using the sobel filter.",
|
||||
"group" : "image",
|
||||
//"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/edgedetection.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/edgedetection.json",
|
||||
"shaders/effects/edgedetection.frag",
|
||||
"shaders/effects/edgedetection.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/edgedetection",
|
||||
"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"
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"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",
|
||||
"copybackground" : true,
|
||||
"depth" : 1,
|
||||
"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
|
||||
},
|
||||
{
|
||||
"angles" : "0.000 0.000 0.000",
|
||||
"copybackground" : true,
|
||||
"effects" :
|
||||
[
|
||||
{
|
||||
"file" : "effects/edgedetection/effect.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"combos" :
|
||||
{
|
||||
"BLENDMODE" : 0
|
||||
},
|
||||
"constantshadervalues" :
|
||||
{
|
||||
"Alpha" : 1,
|
||||
"Detection multiply" : 5,
|
||||
"Detection size" : 0.80000001192092896,
|
||||
"Detection threshold" : 0,
|
||||
"Outline background" : "1 1 1",
|
||||
"Outline color" : "0 0 0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"id" : 22,
|
||||
"image" : "models/util/fullscreenlayer.json",
|
||||
"name" : "Fullscreen",
|
||||
"origin" : "0.000 0.000 0.000",
|
||||
"parallaxDepth" : "1.000 1.000",
|
||||
"scale" : "1.000 1.000 1.000",
|
||||
"size" : "714.000 521.000",
|
||||
"visible" : true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":0}
|
||||
|
||||
#include "common.h"
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec2 v_TexCoordKernel[9];
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
uniform float g_BlendAlpha; // {"material":"Alpha","default":1,"range":[0.01,1]}
|
||||
uniform vec3 g_OutlineColor1; // {"material":"Outline color","default":"0 0 0","type":"color"}
|
||||
uniform vec3 g_OutlineColor2; // {"material":"Outline background","default":"1 1 1","type":"color"}
|
||||
uniform float g_DetectionThreshold; // {"material":"Detection threshold","default":0.5,"range":[0,5]}
|
||||
uniform float g_DetectionMultiply; // {"material":"Detection multiply","default":1,"range":[0,5]}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoordKernel[4]);
|
||||
|
||||
vec3 sample00 = texSample2D(g_Texture0, v_TexCoordKernel[0]).rgb;
|
||||
vec3 sample10 = texSample2D(g_Texture0, v_TexCoordKernel[1]).rgb;
|
||||
vec3 sample20 = texSample2D(g_Texture0, v_TexCoordKernel[2]).rgb;
|
||||
vec3 sample01 = texSample2D(g_Texture0, v_TexCoordKernel[3]).rgb;
|
||||
|
||||
vec3 sample21 = texSample2D(g_Texture0, v_TexCoordKernel[5]).rgb;
|
||||
vec3 sample02 = texSample2D(g_Texture0, v_TexCoordKernel[6]).rgb;
|
||||
vec3 sample12 = texSample2D(g_Texture0, v_TexCoordKernel[7]).rgb;
|
||||
vec3 sample22 = texSample2D(g_Texture0, v_TexCoordKernel[8]).rgb;
|
||||
|
||||
vec3 gx = sample20 - sample00 + (sample21 - sample01) * 2 + sample22 - sample02;
|
||||
vec3 gy = sample00 - sample02 + (sample10 - sample12) * 2 + sample20 - sample22;
|
||||
|
||||
float g = abs(greyscale(gx)) + abs(greyscale(gy));
|
||||
|
||||
vec3 combinedColor = mix(g_OutlineColor2, g_OutlineColor1,
|
||||
min(1.0, max(0.0, g - g_DetectionThreshold) * g_DetectionMultiply));
|
||||
|
||||
gl_FragColor.a = albedo.a;
|
||||
gl_FragColor.rgb = ApplyBlending(BLENDMODE, albedo.rgb, combinedColor, g_BlendAlpha);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
|
||||
uniform float g_DetectionSize; // {"material":"Detection size","default":1,"range":[0,5]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoordKernel[9];
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
|
||||
vec2 texelSize = vec2(1.0 / g_Texture0Resolution.z, 1.0 / g_Texture0Resolution.w) * g_DetectionSize;
|
||||
|
||||
v_TexCoordKernel[0] = a_TexCoord - texelSize;
|
||||
v_TexCoordKernel[1] = a_TexCoord - vec2(0.0, texelSize.y);
|
||||
v_TexCoordKernel[2] = a_TexCoord + vec2(texelSize.x, -texelSize.y);
|
||||
v_TexCoordKernel[3] = a_TexCoord - vec2(texelSize.x, 0.0);
|
||||
v_TexCoordKernel[4] = a_TexCoord;
|
||||
v_TexCoordKernel[5] = a_TexCoord + vec2(texelSize.x, 0.0);
|
||||
v_TexCoordKernel[6] = a_TexCoord + vec2(-texelSize.x, texelSize.y);
|
||||
v_TexCoordKernel[7] = a_TexCoord + vec2(0.0, texelSize.y);
|
||||
v_TexCoordKernel[8] = a_TexCoord + texelSize;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "FX Preview",
|
||||
"type": "scene2d"
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":0}
|
||||
|
||||
#include "common.h"
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec2 v_TexCoordKernel[9];
|
||||
|
||||
uniform sampler2D g_Texture0; // {"hidden":true}
|
||||
|
||||
uniform float g_BlendAlpha; // {"material":"alpha","label":"ui_editor_properties_alpha","default":1,"range":[0.01,1]}
|
||||
uniform float g_BlendBrightness; // {"material":"brightness","label":"ui_editor_properties_brightness","default":1,"range":[0,2]}
|
||||
uniform vec3 g_OutlineColor1; // {"material":"outlinecolor","label":"ui_editor_properties_outline_color","default":"0 0 0","type":"color"}
|
||||
uniform vec3 g_OutlineColor2; // {"material":"outlinecolorbg","label":"ui_editor_properties_outline_background","default":"1 1 1","type":"color"}
|
||||
uniform float g_DetectionThreshold; // {"material":"detectthreshold","label":"ui_editor_properties_detection_threshold","default":0.5,"range":[0,5]}
|
||||
uniform float g_DetectionMultiply; // {"material":"detectmultiply","label":"ui_editor_properties_detection_multiply","default":1,"range":[0,5]}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoordKernel[4]);
|
||||
|
||||
vec3 sample00 = texSample2D(g_Texture0, v_TexCoordKernel[0]).rgb;
|
||||
vec3 sample10 = texSample2D(g_Texture0, v_TexCoordKernel[1]).rgb;
|
||||
vec3 sample20 = texSample2D(g_Texture0, v_TexCoordKernel[2]).rgb;
|
||||
vec3 sample01 = texSample2D(g_Texture0, v_TexCoordKernel[3]).rgb;
|
||||
|
||||
vec3 sample21 = texSample2D(g_Texture0, v_TexCoordKernel[5]).rgb;
|
||||
vec3 sample02 = texSample2D(g_Texture0, v_TexCoordKernel[6]).rgb;
|
||||
vec3 sample12 = texSample2D(g_Texture0, v_TexCoordKernel[7]).rgb;
|
||||
vec3 sample22 = texSample2D(g_Texture0, v_TexCoordKernel[8]).rgb;
|
||||
|
||||
vec3 gx = sample20 - sample00 + (sample21 - sample01) * 2 + sample22 - sample02;
|
||||
vec3 gy = sample00 - sample02 + (sample10 - sample12) * 2 + sample20 - sample22;
|
||||
|
||||
float g = abs(greyscale(gx)) + abs(greyscale(gy));
|
||||
|
||||
vec3 combinedColor = mix(g_OutlineColor2, g_OutlineColor1,
|
||||
min(1.0, max(0.0, g - g_DetectionThreshold) * g_DetectionMultiply)) * g_BlendBrightness;
|
||||
|
||||
gl_FragColor.a = albedo.a;
|
||||
gl_FragColor.rgb = ApplyBlending(BLENDMODE, albedo.rgb, combinedColor, g_BlendAlpha);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
|
||||
uniform float g_DetectionSize; // {"material":"size","label":"ui_editor_properties_detection_size","default":1,"range":[0,5]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoordKernel[9];
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
|
||||
vec2 texelSize = vec2(1.0 / g_Texture0Resolution.z, 1.0 / g_Texture0Resolution.w) * g_DetectionSize;
|
||||
|
||||
v_TexCoordKernel[0] = a_TexCoord - texelSize;
|
||||
v_TexCoordKernel[1] = a_TexCoord - vec2(0.0, texelSize.y);
|
||||
v_TexCoordKernel[2] = a_TexCoord + vec2(texelSize.x, -texelSize.y);
|
||||
v_TexCoordKernel[3] = a_TexCoord - vec2(texelSize.x, 0.0);
|
||||
v_TexCoordKernel[4] = a_TexCoord;
|
||||
v_TexCoordKernel[5] = a_TexCoord + vec2(texelSize.x, 0.0);
|
||||
v_TexCoordKernel[6] = a_TexCoord + vec2(-texelSize.x, texelSize.y);
|
||||
v_TexCoordKernel[7] = a_TexCoord + vec2(0.0, texelSize.y);
|
||||
v_TexCoordKernel[8] = a_TexCoord + texelSize;
|
||||
}
|
||||
Reference in New Issue
Block a user