颜色可变的剪影效果 Shader
https://cloud.tencent.com/developer/article/1659055
- eazax-silhouette.effect 文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| // Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
CCEffect %{ techniques: - passes: - vert: vs frag: fs blendState: targets: - blend: true rasterizerState: cullMode: none properties: targetColor: { value: [80.0, 60.0, 33.0, 1], inspector: { type: color } } }%
CCProgram vs %{ precision highp float;
#include <cc-global>
attribute vec3 a_position; attribute vec2 a_uv0; out vec2 uv0;
void main () { gl_Position = cc_matViewProj * vec4(a_position, 1); uv0 = a_uv0; } }%
CCProgram fs %{ precision highp float; in vec2 uv0; uniform sampler2D texture;
uniform FragConstants { vec4 targetColor; };
void main () { vec2 coord = uv0.xy; vec4 color = texture2D(texture, coord); gl_FragColor = vec4(targetColor.r, targetColor.g, targetColor.b, color.a);
} }%
|