1
$\begingroup$

I have a number of (opaque) objects created using the glGenLists() glNewList() utilities. As generated, the Alpha values are all set to 1

Is there a way to make these objects when summoned blend into the scene (sort of as if they were being teleported using the Star Trek transporter). Likewise, I'd also like them to dissolve away when dismissed.

I could of course use time-varying alpha blending in a subroutine if they weren't list objects, but I'm wondering if there's a performance penalty associated with that.

What I'm really trying to do is replace larger coarser ground texture quads with finer smaller quads as I descend in altitude from a satellite while looking down.

Thanks

$\endgroup$
1
$\begingroup$

It looks like there are a few steps to make this work:

  1. 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.
  2. 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; at t=0, make the color buffer 0*effect_mesh + 1*original_mesh; and at t=0.3, make the color buffer 0.3*effect_mesh + 0.7*original_mesh.
  3. 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.

$\endgroup$
  • $\begingroup$ Thanks Clabe45 for the excellent suggestion. I'll give this a shot and revert if I run into issues or have more questions $\endgroup$ – Sharat V Chandrasekhar Jul 30 '17 at 0:12
  • $\begingroup$ No problem. I apologize if I didn't answer directly since I don't really understand list objects. $\endgroup$ – clabe45 Jul 30 '17 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.