47 Star 369 Fork 213

木限东 / CocosCreatorShader

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sphere.effect 2.51 KB
一键复制 编辑 原始数据 按行查看 历史
木限东 提交于 2022-06-02 10:00 . update dir
// Effect Syntax Guide: https://github.com/cocos-creator/docs-3d/blob/master/zh/material-system/effect-syntax.md
CCEffect %{
techniques:
- name: opaque
passes:
- vert: unlit-vs:vert # builtin header
frag: unlit-fs:frag
properties: &props
noiseTexture: { value: white }
mainTexture: { value: white }
mainColor: { value: [1, 1, 1, 1], editor: { type: color } }
- name: transparent
passes:
- vert: unlit-vs:vert # builtin header
frag: unlit-fs:frag
blendState:
targets:
- blend: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
blendSrcAlpha: src_alpha
blendDstAlpha: one_minus_src_alpha
properties: *props
}%
CCProgram unlit-vs %{
precision highp float;
#include <input-standard>
#include <cc-global>
#include <decode-base>
#include <cc-local-batch>
#include <input-standard>
#include <cc-fog-vs>
#include <cc-shadow-map-vs>
in vec3 a_color;
#if HAS_SECOND_UV
in vec2 a_texCoord1;
#endif
out vec3 position;
out vec3 v_position;
out vec3 v_normal;
out vec3 v_tangent;
out vec3 v_bitangent;
out vec2 v_uv;
out vec2 v_uv1;
out vec3 v_color;
vec4 vert () {
StandardVertInput In;
CCVertInput(In);
mat4 matWorld, matWorldIT;
CCGetWorldMatrixFull(matWorld, matWorldIT);
position=(In.position).xyz;
v_position = (matWorld * In.position).xyz;
v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);
v_tangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);
v_bitangent = cross(v_normal, v_tangent) * In.tangent.w; // note the cross order
v_uv = a_texCoord;
#if HAS_SECOND_UV
v_uv1 = a_texCoord1;
#endif
v_color = a_color;
CC_TRANSFER_FOG(matWorld * In.position);
CC_TRANSFER_SHADOW(matWorld * In.position);
return cc_matProj * (cc_matView * matWorld) * In.position;
}
}%
CCProgram unlit-fs %{
precision highp float;
#include <output>
#include <cc-fog-fs>
in vec2 v_uv;
in vec3 position;
uniform sampler2D noiseTexture;
uniform sampler2D mainTexture;
uniform Constant {
vec4 mainColor;
};
vec4 frag () {
vec2 uv = v_uv;
vec4 color = mainColor;
uv.x -= cc_time.x / 5.0;
uv.y -= cc_time.x / 5.0;
vec4 noiseCol = texture(noiseTexture, uv);
color.a = noiseCol.r * 0.3;
if (position.y < - 0.35) {
color.a = 0.0;
}
vec4 col = color * texture(mainTexture, uv);
CC_APPLY_FOG(col);
return CCFragOutput(col);
}
}%
1
https://gitee.com/yeshao2069/cocos-creator-shader.git
git@gitee.com:yeshao2069/cocos-creator-shader.git
yeshao2069
cocos-creator-shader
CocosCreatorShader
v3.5.x

搜索帮助