有工具将 2.x 的 shader 转成 3.x 的 shader吗

好多实用的 shader 都是 2.x 的,3.x 的根本用不了,没有 shader语法基础,有啥办法能转成 3.x 的吗?

我发个 2.x 的,有木有热心老哥帮忙改一改

CCEffect %{
techniques:

  • passes:
    • vert: vs
      frag: fs
      blendState:
      targets:
      • blend: true
        rasterizerState:
        cullMode: none
        properties:
        texture: { value: white }
        time: { value: 0 }
        speed: { value: 0.002 }
        }%

CCProgram vs %{

precision highp float;

#include

in vec3 a_position;

in mediump vec2 a_uv0;
out mediump vec2 v_uv0;

in vec4 a_color;
out vec4 v_color;

void main () {
gl_Position = cc_matViewProj * vec4(a_position, 1);
v_uv0 = a_uv0;
v_color = a_color;
}

}%

CCProgram fs %{
precision highp float;

uniform Time {
float time;
};

uniform SPEED {
float speed;
};

uniform sampler2D texture;
in mediump vec2 v_uv0;
in vec4 v_color;

void main () {
vec2 uv = v_uv0.xy;
uv.x += time * speed;
uv.x = fract(uv.x);
vec4 color = texture2D(texture, uv);
gl_FragColor = color;
}
}%

不仅2.x的shader3.x用不了,很多3.x的shader,升级3.x版本后也用不了。

不如来学习 3.x 的 shader:Shader My Head - VaJoy的专栏 - 掘金

很久之前就收藏订阅了的,还只看了前两章 :grinning: