yes
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"version" : 1,
|
||||
"replacementkey" : "lightshafts",
|
||||
"name" : "ui_editor_effect_lightshafts_title",
|
||||
"description" : "ui_editor_effect_lightshafts_description",
|
||||
"group" : "colorize",
|
||||
"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/lightshafts.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/lightshafts.json",
|
||||
"shaders/effects/lightshafts.frag",
|
||||
"shaders/effects/lightshafts.vert"
|
||||
],
|
||||
"gizmos" :
|
||||
[
|
||||
{
|
||||
"type" : "EffectPerspectiveUV",
|
||||
"vars" :
|
||||
{
|
||||
"p0" : "point0",
|
||||
"p1" : "point1",
|
||||
"p2" : "point2",
|
||||
"p3" : "point3"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"alphawriting" : "default",
|
||||
"blending" : "translucent",
|
||||
"combos" :
|
||||
{
|
||||
"FOG" : 1
|
||||
},
|
||||
"cullmode" : "nocull",
|
||||
"depthtest" : "disabled",
|
||||
"depthwrite" : "disabled",
|
||||
"shader" : "genericimage4",
|
||||
"textures" : [ "effectpreview" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"clampuvs" : true,
|
||||
"format" : "rgba8888",
|
||||
"nomip" : true,
|
||||
"nonpoweroftwo" : true
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 256 KiB |
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/lightshafts",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"autosize" : true,
|
||||
"material" : "materials/effectpreview.json"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"file" : "scene.json",
|
||||
"general" :
|
||||
{
|
||||
"properties" :
|
||||
{
|
||||
"schemecolor" :
|
||||
{
|
||||
"order" : 0,
|
||||
"text" : "ui_browse_properties_scheme_color",
|
||||
"type" : "color",
|
||||
"value" : "0 0 0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title" : "preview",
|
||||
"type" : "scene",
|
||||
"version" : 0
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"camera" :
|
||||
{
|
||||
"center" : "0.96342 -7.22564 -1.00000",
|
||||
"eye" : "0.96342 -7.22564 0.00000",
|
||||
"up" : "0.00000 1.00000 0.00000"
|
||||
},
|
||||
"general" :
|
||||
{
|
||||
"ambientcolor" : "0.30000 0.30000 0.30000",
|
||||
"bloom" : false,
|
||||
"bloomhdrfeather" : 0.1,
|
||||
"bloomhdriterations" : 8,
|
||||
"bloomhdrscatter" : 1.619,
|
||||
"bloomhdrstrength" : 2.0,
|
||||
"bloomhdrthreshold" : 1.0,
|
||||
"bloomstrength" : 2.0,
|
||||
"bloomthreshold" : 0.64999998,
|
||||
"bloomtint" : "1.00000 1.00000 1.00000",
|
||||
"camerafade" : true,
|
||||
"cameraparallax" : false,
|
||||
"cameraparallaxamount" : 0.5,
|
||||
"cameraparallaxdelay" : 0.1,
|
||||
"cameraparallaxmouseinfluence" : 0.0,
|
||||
"camerapreview" : true,
|
||||
"camerashake" : false,
|
||||
"camerashakeamplitude" : 0.5,
|
||||
"camerashakeroughness" : 1.0,
|
||||
"camerashakespeed" : 3.0,
|
||||
"clearcolor" : "0.70000 0.70000 0.70000",
|
||||
"clearenabled" : true,
|
||||
"farz" : 10000.0,
|
||||
"fov" : 50.0,
|
||||
"hdr" : false,
|
||||
"nearz" : 0.0099999998,
|
||||
"orthogonalprojection" :
|
||||
{
|
||||
"height" : 256,
|
||||
"width" : 256
|
||||
},
|
||||
"perspectiveoverridefov" : 95.0,
|
||||
"skylightcolor" : "0.30000 0.30000 0.30000",
|
||||
"zoom" : 1.0
|
||||
},
|
||||
"objects" :
|
||||
[
|
||||
{
|
||||
"castshadow" : false,
|
||||
"color" : "0.56863 0.56863 0.56863",
|
||||
"depth" : 1,
|
||||
"effects" :
|
||||
[
|
||||
{
|
||||
"file" : "effects/lightshafts/effect.json",
|
||||
"id" : 19,
|
||||
"name" : "",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"combos" :
|
||||
{
|
||||
"RAYMODE" : 2,
|
||||
"RENDERING" : 1
|
||||
},
|
||||
"constantshadervalues" :
|
||||
{
|
||||
"colorend" : "0.5 0.8 1",
|
||||
"colorstart" : "1 1 1",
|
||||
"colorwexponent" : 1.52,
|
||||
"colorwintensity" : 8.02,
|
||||
"noiseamount" : 0.33,
|
||||
"noisescale" : 1.0,
|
||||
"point0" : "0.07252 0.03708",
|
||||
"point1" : "1.06537 0.04142",
|
||||
"point2" : "1.21069 1.01650",
|
||||
"point3" : "-0.09353 1.00193",
|
||||
"rayfeather" : "0.05 0.2",
|
||||
"rayradius" : 0.16,
|
||||
"rayscale" : "0.74 0.1",
|
||||
"raysmoothness" : 0.75,
|
||||
"rayspeed" : 0.2
|
||||
},
|
||||
"id" : 20
|
||||
}
|
||||
],
|
||||
"visible" : true
|
||||
}
|
||||
],
|
||||
"id" : 38,
|
||||
"image" : "models/effectpreview.json",
|
||||
"name" : "",
|
||||
"origin" : "128.00000 128.00000 0.00000",
|
||||
"size" : "256.00000 256.00000"
|
||||
}
|
||||
],
|
||||
"version" : 0
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":31}
|
||||
// [COMBO] {"material":"ui_editor_properties_write_alpha","combo":"WRITEALPHA","type":"options","default":0}
|
||||
// [COMBO] {"material":"ui_editor_properties_direction","combo":"RAYMODE","type":"options","default":0,"options":{"ui_editor_properties_linear":0,"ui_editor_properties_radial":1,"ui_editor_properties_corner":2}}
|
||||
// [COMBO] {"material":"ui_editor_properties_rendering","combo":"RENDERING","type":"options","default":0,"options":{"ui_editor_properties_color":0,"ui_editor_properties_gradient":1}}
|
||||
|
||||
#include "common_fragment.h"
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
varying vec3 v_TexCoordFx;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_noise","default":"util/noise"}
|
||||
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_gradient_map","default":"gradient/gradient_iridescent","formatcombo":true,"require":{"RENDERING":1}}
|
||||
|
||||
uniform float g_Time;
|
||||
|
||||
uniform float g_Speed; // {"material":"rayspeed","label":"ui_editor_properties_speed","default":0.2,"range":[0.1, 1.0]}
|
||||
uniform vec2 g_Scale; // {"material":"rayscale","label":"ui_editor_properties_scale","default":"0.5 0.1","linked":true,"range":[0.1, 2.0]}
|
||||
uniform float g_Smoothness; // {"material":"raysmoothness","label":"ui_editor_properties_smoothness","default":0.75,"range":[0.1, 1.0]}
|
||||
uniform vec2 g_Feather; // {"material":"rayfeather","label":"ui_editor_properties_feather","default":"0.05 0.2","linked":true,"range":[0.0, 0.5]}
|
||||
uniform float g_Radius; // {"material":"rayradius","label":"ui_editor_properties_radius","default":0.5,"range":[0.0, 1.0]}
|
||||
|
||||
uniform float g_NoiseScale; // {"material":"noisescale","label":"ui_editor_properties_noise_scale","default":1.0,"range":[0.0, 5.0]}
|
||||
uniform float g_NoiseAmount; // {"material":"noiseamount","label":"ui_editor_properties_noise_amount","default":0.33,"range":[0.0, 1.0]}
|
||||
|
||||
uniform float g_Intensity; // {"material":"colorwintensity","label":"ui_editor_properties_intensity","default":1,"range":[0.01, 10.0]}
|
||||
uniform float g_Exponent; // {"material":"colorwexponent","label":"ui_editor_properties_exponent","default":0.5,"range":[0.2, 2.0]}
|
||||
uniform vec3 g_ColorRaysStart; // {"material":"colorstart","label":"ui_editor_properties_color_start","default":"1 1 1","type":"color"}
|
||||
uniform vec3 g_ColorRaysEnd; // {"material":"colorend","label":"ui_editor_properties_color_end","default":"0.5 0.8 1","type":"color"}
|
||||
|
||||
void main() {
|
||||
vec2 fxCoord = v_TexCoordFx.xy / v_TexCoordFx.z;
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord);
|
||||
|
||||
float mask = step(0.0, v_TexCoordFx.z);
|
||||
|
||||
#if RAYMODE == 1
|
||||
vec2 rayCenter = vec2(0.5, 0.5);
|
||||
vec2 rayDelta = fxCoord - rayCenter;
|
||||
fxCoord.x = atan2(rayDelta.y, rayDelta.x) / 6.283185 + 0.5;
|
||||
fxCoord.y = length(rayDelta) * 2.0;
|
||||
//fxCoord.y += texSample2D(g_Texture1, vec2(fxCoord.x * 0.054111 * g_NoiseScale, 0)).r * g_NoiseAmount - (g_NoiseAmount * 0.5);
|
||||
fxCoord.y = smoothstep(g_Radius, 1.0, fxCoord.y);
|
||||
fxCoord.y = (fxCoord.y - 0.0001) * 1.00021;
|
||||
vec2 fxCoordRef = fxCoord;
|
||||
|
||||
mask *= smoothstep(0.50001, 0.5 - g_Feather.x, abs(fxCoord.x - 0.5));
|
||||
mask *= smoothstep(0.50001, 0.5 - g_Feather.y, abs(fxCoord.y - 0.5));
|
||||
#elif RAYMODE == 2
|
||||
vec2 rayCenter = vec2(0, 0);
|
||||
vec2 rayDelta = fxCoord - rayCenter;
|
||||
fxCoord.x = atan2(rayDelta.y, rayDelta.x) / 6.283185 * 4;
|
||||
fxCoord.y = max(rayDelta.x, rayDelta.y);
|
||||
//fxCoord.y = length(rayDelta);
|
||||
fxCoord.y += texSample2D(g_Texture1, vec2(fxCoord.x * 0.054111 * g_NoiseScale, 0)).r * g_NoiseAmount - (g_NoiseAmount * 0.5);
|
||||
fxCoord.y = smoothstep(g_Radius, 1.0, fxCoord.y);
|
||||
|
||||
vec2 fxCoordRef = fxCoord;
|
||||
|
||||
mask *= smoothstep(0.50001, 0.5 - g_Feather.x, abs(fxCoord.x - 0.5));
|
||||
mask *= smoothstep(0.50001, 0.5 - g_Feather.y, abs(fxCoord.y - 0.5));
|
||||
#else
|
||||
//fxCoord.y += texSample2D(g_Texture1, vec2(fxCoord.x * 0.054111 * g_NoiseScale, 0)).r * g_NoiseAmount - (g_NoiseAmount * 0.5);
|
||||
vec2 fxCoordRef = fxCoord;
|
||||
mask *= smoothstep(0.50001, 0.5 - g_Feather.x, abs(fxCoord.x - 0.5));
|
||||
mask *= smoothstep(0.50001, 0.5 - g_Feather.y, abs(fxCoord.y - 0.5));
|
||||
#endif
|
||||
|
||||
float grad = 1.0 - fxCoord.y;
|
||||
mask *= grad;
|
||||
|
||||
vec2 fxCoord2 = fxCoord;
|
||||
fxCoord.xy *= vec2(0.054111 * g_Scale.x, 0.003111 * g_Scale.y);
|
||||
fxCoord2.xy *= vec2(0.07333 * g_Scale.x, 0.005967111 * g_Scale.y);
|
||||
|
||||
fxCoord.xy += g_Time * g_Speed * vec2(0.003, 0.000375111);
|
||||
fxCoord2.xy -= g_Time * g_Speed * vec2(0.0047111, 0.0007399);
|
||||
|
||||
float fx0 = texSample2D(g_Texture1, fxCoord).r;
|
||||
float fx1 = texSample2D(g_Texture1, fxCoord2).r;
|
||||
float fx = fx0 * fx1;
|
||||
fx = pow(fx, g_Exponent);
|
||||
|
||||
fx = smoothstep((1.0 - g_Smoothness) * 0.29999, 0.3 + g_Smoothness * 0.7, fx);
|
||||
|
||||
#if RENDERING == 0
|
||||
vec3 fxColor = mix(g_ColorRaysEnd, g_ColorRaysStart, fx) * g_Intensity;
|
||||
#else
|
||||
vec2 gradientUVs = vec2(fxCoordRef.y, 0);
|
||||
#if TEX2FORMAT == FORMAT_R8 || TEX2FORMAT == FORMAT_RG88
|
||||
vec3 gradColor = texSample2D(g_Texture2, gradientUVs).rrr;
|
||||
#else
|
||||
vec3 gradColor = texSample2D(g_Texture2, gradientUVs).rgb;
|
||||
#endif
|
||||
vec3 fxColor = gradColor * g_Intensity;
|
||||
#endif
|
||||
|
||||
fx *= mask;
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, fxColor, fx);
|
||||
albedo.a = max(albedo.a, fx);
|
||||
|
||||
#if WRITEALPHA
|
||||
albedo.a = fx;
|
||||
#endif
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "common_perspective.h"
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
|
||||
uniform vec2 g_Point0; // {"material":"point0","label":"p0","default":"0.67728 0.01297"}
|
||||
uniform vec2 g_Point1; // {"material":"point1","label":"p1","default":"0.76007 0.14043"}
|
||||
uniform vec2 g_Point2; // {"material":"point2","label":"p2","default":"0.46654 1.09592"}
|
||||
uniform vec2 g_Point3; // {"material":"point3","label":"p3","default":"0.16363 0.44881"}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
varying vec3 v_TexCoordFx;
|
||||
|
||||
void main() {
|
||||
mat3 xform = inverse(squareToQuad(g_Point0, g_Point1, g_Point2, g_Point3));
|
||||
|
||||
v_TexCoord.xy = a_TexCoord.xy;
|
||||
v_TexCoordFx = mul(vec3(a_TexCoord.xy, 1.0), xform);
|
||||
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "FX Preview",
|
||||
"type": "scene2d"
|
||||
}
|
||||
Reference in New Issue
Block a user