It looks like there are a few steps to make this work:
- Linearly interpolate the alpha of the mesh from transparent to fully opaque, or vice versa.
- Note 1: It seems as if the alpha starts to fade a few seconds after the effect has started.
- Note 2: The alpha of the "effect meshes" (covered in #2 and #3) should be changed independently of the original mesh. This will help produce the desired effect.
- Generate (just the color buffer for) a mesh with identical vertices, but make the color blue or green. The brightness of each vertice's/triangle's color should be calculated using either random noise (i.e. using a random number generator), or Perlin Noise; or a combination of the two. For the flashing effect, it would be best to regenerate the mesh each frame (with a different noise seed, if using Perlin Noise). Next, calculate a weighted average between the colors of this "effect mesh" and the those of the original mesh, according to how much time has passed. For instance, assuming
t
is the percentage of the way through the effect that has passed; att=0
, make the color buffer0*effect_mesh + 1*original_mesh
; and att=0.3
, make the color buffer0.3*effect_mesh + 0.7*original_mesh
. - For the vertical line effect, think about ray-tracing all the vertices (using multiple vertical rays). If a vertex is hit by (or near) a ray, make that vertex's color lighter/darker. This effect would be best done with a weighted average also, according to the time (since the lines are stronger towards the beginning).
*** Although this "Star Trek" effect varies from scene to scene, you should order these effects; don't do them all at the same time.