2

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?

tversteeg
  • 4,717
  • 10
  • 42
  • 77
moosefetcher
  • 1,841
  • 2
  • 23
  • 39

1 Answers1

1

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.

Varnius
  • 1,527
  • 1
  • 12
  • 14
  • OK, well I guess the next thing is to figure out HOW to do what you suggest. Downsampling hadn't occurred to me. Thanks for the answer. – moosefetcher Mar 07 '13 at 12:56
  • Check out my blog post. There is a link to a git repository where you can find some source for this. – Varnius Mar 07 '13 at 13:59
  • I can't seem to find the link to github, sorry. I can find the demo. Looks good. Any pointers? – moosefetcher Mar 07 '13 at 16:50
  • Added github link to my answer. Check eu.nekobit.alternativa3d.post.effects.OuterGlow class. :) – Varnius Mar 07 '13 at 18:28