Frage

I'm making a Stage3D space game: www.sugarspook.com/darkmatters/demo.html, and I'd like to add 'glows' to some objects.

Is there a way to do this solely in the AGAL shaders, or do I need to pre-render the glowing objects and 'blur' them?

War es hilfreich?

Lösung

Yeah, you will need to prerender to a texture first. Here's what i would do:

  • Prerender an object to texture.
  • Downsample multiple times to a desired size (more downsamples = bigger glow).
  • Apply some kind of blur (I prefer Gaussian).
  • Tint blurred texture with some color.
  • Upsample.
  • Render.

You can take a look at the example I posted in my blog. It's for Alternativa3D but may be useful as the principle is the same everywhere. Here's github link to whole lib.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top