Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How to achieve a Neon-Light effect?

In an attempt at a screensaver I am making, I am a fan of neo-like graphics, which, of course, look great against a black background. As I understand it, neon, graphically speaking, is essentially a gradient of a color, brightest in the center, and gets darker proceeding outward. Although, more accurate is similar, but separating it into tubes and glow. The tubes are mostly white, while the glow is where most of the color is seen. Well... the tubes could also be a light variant of the color, you could say. The glow is darker.

Anyhow, my question is, how could you generate such things given an initial pattern of pixels that would be the tubes? For example, let's say I want to make a neon 'H'. I, via the libraries, can attain the rectangles of pixels which represent it, but I want to make it look neonized. How could I algorithmically achieve such an effect given a base tube shape and base color?

EDIT: ok, I mistated that. Got a bit distracted. My purpose for this was similar to a neon effect, but not. Sorry about that. What I am looking for is something like this:

Start with a pattern of pixels:


How to I find the U pixels?


Sorry if that looks bad.

share|improve this question

marked as duplicate by bummzack, doppelgreener, Laurent Couvidou, John McDonald, Byte56 Oct 15 '12 at 23:42

This question was marked as an exact duplicate of an existing question.

If you have a higher-resolution image of your “tube” than your example suggests, then the solution is a matter of very basic image-processing. The first thing to try to generate the glow would be a Gaussian blur of your “tube” shape. Then draw the blur output (possibly with a brightness adjustment) followed by the tubes. If you find that the glow is too weak, or if you are working with very thin lines, try a morphological dilate operation before the blur (possibly even applying it to the tubes to thicken them).

Combinations of these and related effects, as well as small offsets, can also automatically generate a decent impression of a shiny glass tube.

All of the above are standard image-processing operators and any decent image-processing library should make it easy to perform them.

If you are really working with single-pixel tubes with tight corners and want to produce a single-pixel glow as your example suggests, then your problem more closely resembles a tile-based graphics problem — choosing transition tiles — and you should approach it that way.

If none of the above is what you meant, then I recommend clarifying your question. Even the roughest of actual prototype graphics or even freehand sketches of what you're trying to achieve would help greatly.

share|improve this answer

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