Upgrade Guide: Particle from v3.5.x to v3.6.0

CPU Particle

The particle shader particle-vs-legacy.chunk should be modified to support instance particles added in v3.6.0.

layout before

  1. in vec3 a_position; // center position
  2. in vec3 a_texCoord; // xy:vertex index,z:frame index
  3. in vec3 a_texCoord1; // size
  4. in vec3 a_texCoord2; // rotation
  5. in vec4 a_color;
  6. #if CC_RENDER_MODE == RENDER_MODE_STRETCHED_BILLBOARD
  7. in vec3 a_color1; // velocity.x, velocity.y, velocity.z, scale
  8. #endif
  9. #if CC_RENDER_MODE == RENDER_MODE_MESH
  10. in vec3 a_texCoord3; // mesh vertices
  11. in vec3 a_normal; // mesh normal
  12. in vec4 a_color1; // mesh color
  13. #endif

layout now

  1. in vec3 a_texCoord1; // size
  2. in vec3 a_texCoord2; // rotation
  3. in vec4 a_color;
  4. in vec3 a_texCoord; // xy:vertex index,z:frame index
  5. #if !CC_INSTANCE_PARTICLE
  6. in vec3 a_position; // center position
  7. #endif
  8. #if CC_INSTANCE_PARTICLE
  9. in vec4 a_texCoord4; // xyz:position,z:frame index
  10. #endif
  11. #if CC_RENDER_MODE == RENDER_MODE_STRETCHED_BILLBOARD
  12. in vec3 a_color1; // velocity.x, velocity.y, velocity.z, scale
  13. #endif
  14. #if CC_RENDER_MODE == RENDER_MODE_MESH
  15. in vec3 a_texCoord3; // mesh vertices
  16. in vec3 a_normal; // mesh normal
  17. in vec4 a_color1; // mesh color
  18. #endif

Other shader code should be modified refer to particle-vs-legacy.chunk of v3.6.0

GPU Particle

GPU particle shader particle-vs-gpu.chunk should be modified.

layout before

  1. in vec4 a_position_starttime; // center position,particle start time
  2. in vec4 a_size_uv; // xyz:size, w:uv_0
  3. in vec4 a_rotation_uv; // xyz:rotation, w:uv_1
  4. in vec4 a_color;
  5. in vec4 a_dir_life; // xyz:particle start velocity,w:particle lifetime
  6. in float a_rndSeed;
  7. #if CC_RENDER_MODE == RENDER_MODE_MESH
  8. in vec3 a_texCoord; // mesh uv
  9. in vec3 a_texCoord3; // mesh vertices
  10. in vec3 a_normal; // mesh normal
  11. in vec4 a_color1; // mesh color
  12. #endif

layout after

  1. in vec4 a_position_starttime; // center position,particle start time
  2. in vec4 a_color;
  3. in vec4 a_dir_life; // xyz:particle start velocity,w:particle lifetime
  4. in float a_rndSeed;
  5. #if !CC_INSTANCE_PARTICLE
  6. in vec4 a_size_uv; // xyz:size, w:uv_0
  7. in vec4 a_rotation_uv; // xyz:rotation, w:uv_1
  8. #endif
  9. #if CC_INSTANCE_PARTICLE
  10. in vec4 a_size_fid; // xyz:size, w:fid
  11. in vec3 a_rotation; // xyz:rotation
  12. in vec3 a_uv;
  13. #endif
  14. #if CC_RENDER_MODE == RENDER_MODE_MESH
  15. in vec3 a_texCoord; // mesh uv
  16. in vec3 a_texCoord3; // mesh vertices
  17. in vec3 a_normal; // mesh normal
  18. in vec4 a_color1; // mesh color
  19. #endif

Other shader code should be modified refer to particle-vs-gpu.chunk of v3.6.0.