请教大牛这个shader效果怎么实现

这个是我在shadertoy上找到改写的效果


这个是代码:
// Effect Syntax Guide: https://github.com/cocos-creator/docs-3d/blob/master/zh/material-system/effect-syntax.md

CCEffect %{
  techniques:
  - name: opaque
    passes:
    - vert: general-vs:vert # builtin header
      frag: unlit-fs:frag
      properties: &props
        mainTexture:    { value: black }
        mainColor:      { value: [0, 0, 0, 1], editor: { type: color } }
      # blendState:
      #   targets:
      #   - blend: true
      #     blendSrc: src_alpha
      #     blendDst: one
      #     blendEq: add
      #     blendSrcAlpha: one
      #     blendDstAlpha: one_minus_src_alpha
      #     blendAlphaEq: add
      #     blendColorMask: all
}%

CCProgram unlit-fs %{
  precision highp float;
  #include <output>
  #include <cc-fog-fs>
  #include <cc-global>

  in vec2 v_uv;

  in float blinkTransparency;
  uniform sampler2D mainTexture;
  
  uniform Constant {
    vec4 mainColor;
  };

float PI = 3.1415926535;
float sections = 3.0;

bool belongs(float time, vec2 uv, float near, float far) {
    near += sin(uv.x - time * 8.0) / 50.0;
    far += cos(uv.y - time * 8.0) / 50.0;
    vec2 center = vec2(0.5, 0.5);
    vec2 xy = uv - center;
    float dist = distance(xy, vec2(0.0, 0.0));
    float angle = mod(atan(xy.y, xy.x) + time * 2.5 + sin(time * 4.0) / 1.0, PI * 2.0);
    float oddity = mod(angle / (2.0 * PI) * sections * 2.0, 2.0);
    if (dist > near && dist < far && floor(mod(oddity, 2.0)) == 0.0) {
        return true;
    } else {
        return false;
    }
}

  vec4 frag () {
    vec4 fragColor;
    vec2 UV = v_uv;
    float TIME = cc_time.x/5.;

    if (belongs(TIME, UV, 0.2, 0.25) || belongs(TIME + 0.5, UV, 0.3, 0.35) || belongs(TIME + 1.0, UV, 0.4, 0.45)) {
        fragColor =  mainColor;
    } else {
       discard;
    }
    return CCFragOutput(fragColor);
   
  }
}%

请问要做成这种发光效果需要怎么实现?

感谢各位大佬 :pray: :pray:

1赞

代码贴上了,直接拿呗 :grin:

大佬能帮忙改一份 【乐府】使用CocosCreator模拟书本翻页效果] 吗? 【乐府】使用CocosCreator模拟书本翻页效果