Creator 3.4 开启阴影后就会报错

  • Creator 版本: 3.4

  • 目标平台: google浏览器
    fbx的3D模型开启阴影设置后就会报错

有大佬能看出是什么问题嘛?

打开devTools,看一下有什么其它报错



就只有这个报错了

我关掉shadowcastMode就不会报这个错

原因是自定义的effect 不能使用阴影,不过没能解决,请问是哪里的问题?

// 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
        mainTexture:    { value: black }
        mainColor:      { value: [0, 0, 0, 1], editor: { type: color } }
      # blendState:
      #   targets:
      #   - blend: true
      #     blendSrc: src_alpha
      #     blendDst: one_minus_src_alpha
      #     blendSrcAlpha: src_alpha
      #     blendDstAlpha: one_minus_src_alpha
}%

CCProgram unlit-vs %{
  precision highp float;
  #include <input-standard>
  #include <cc-global>
  #include <cc-local-batch>
  #include <input-standard>
  #include <cc-fog-vs>
  #include <cc-shadow-map-vs>

  in vec4 a_color;
 

  #if HAS_SECOND_UV
    in vec2 a_texCoord1;
  #endif

  #if USE_INSTANCING 
     in float blinkFp;
     in vec4 instanced_color;
  #endif

  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 vec4 v_color;
  out float blinkTransparency;

  vec4 vert () {
    StandardVertInput In;
    CCVertInput(In);

    mat4 matWorld, matWorldIT;
    CCGetWorldMatrixFull(matWorld, matWorldIT);

    vec4 pos = matWorld * In.position;

    v_position = pos.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;
    #if USE_INSTANCING 
      v_color = instanced_color;
    #endif

    // CC_TRANSFER_FOG(pos);
    // CC_TRANSFER_SHADOW(pos);

    // if(blinkFp > 0.0)
    //   blinkTransparency = abs(1.0 - mod(cc_time.x, blinkFp * 2.0)/blinkFp);
    // else blinkTransparency = 1.0;

    return cc_matProj * (cc_matView * matWorld) * In.position;
  }
}%


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

  in vec2 v_uv;
  #if USE_INSTANCING
    in vec4 v_color;
  #endif

  in float blinkTransparency;
  uniform sampler2D mainTexture;

  uniform Constant {
    vec4 mainColor;
  };


  vec4 frag () {
    vec4 col = mainColor;
    #if USE_INSTANCING
      col = v_color;
    #endif
    // CC_APPLY_FOG(col);
    return CCFragOutput(col);
  }
}%

你好,需要你这边提供一下项目。我们这边看看