Ambrosia Garden Archive
    • Grayscale Masking


      Disclaimer: I'm not asking for help about masking.

      So, when doing masks for the Titan in Anathema, which is large and has a lot of straight edges, I started wondering something. Since anti-aliasing makes the sprite smoother looking by essentially blurring between the background and image to create something of a mock-transparency, could the same thing (hypothetically) be done with masks to make them grayscale instead of B&W? The effect would be something like a semi-transparency with whatever the ship is on top of and the background, but only in a fine line around the ship, which would create, in effect, real-time anti-aliasing.

      I know the Nova engine can't do this, but would it theoretically be possible?

    • Yes, what you're describing is just an 'alpha' mask (or channel) which is an 8-bit transparency layer for an image. Any modern program which uses sprites for anything will almost certainly use alpha masks.

    • Before PNGs with 8-bit masking were common, the only way to do transparent graphics on the web was with GIFs, which are limited to 1-bit masks just like EV Nova , and sometimes people would try to simulate semi-transparency by alternating black and white pixels in the mask. The results, though, were never very impressive; if you’re stuck with a low bit depth, it’s best to do an exemplary job of creating graphics with that in mind, rather than trying to simulate a higher depth.

      If we’re talking about a hypothetical improved version of the engine, the thing to ask for would be true support for 8-bit masks, not any sort of complicated workaround. Or live rendering of 3D models into a 2D playing space, as Matt once mused about when he forgot for a moment how much work is involved in creating an Escape Velocity game.

    • In an alpha layer, white is completly opaque, black is completely transparent. Think like masks. Colors in between are partly transparent. A pixel just below white will be just a teeny bit transperant, while a pixel just above black will be almost entirely transparent. And just so you know, don't put any other colors, like red or green in there. I haven't tried it personally, but I've heard that it can crash the program. What do you expect. Transperant, transperant, opaque, semi-opaque, red... Wait a minute, what the @#$%!% is red supposed to signify!!!

    • @0101181920, on Oct 9 2007, 01:43 AM, said in Grayscale Masking:

      And just so you know, don't put any other colors, like red or green in there.

      An alpha channel is by definition an 8-bit greyscale image — it’s simply not possible to put colours into it, any more than an RLE’s mask can contain greys.

    • Yes, .png files for example have anti-aliased masking or alpha mapping, so you can put them over any color background and still see smooth transitions. Take my avatar for example.

    • @david-arthur, on Oct 12 2007, 08:55 AM, said in Grayscale Masking:

      An alpha channel is by definition an 8-bit greyscale image — it’s simply not possible to put colours into it, any more than an RLE’s mask can contain greys.

      Actually, there are some programs, I believe that CS is one of them, that will let you make your own alpha masks. If you put colors in them, it will screw up your computer ( :ninja: attacking 😄 , resulting in (searches happy face library), darn, there isn't an unconcious smiley face, but that's what I want.)

    • @0101181920, on Oct 13 2007, 03:45 PM, said in Grayscale Masking:

      Actually, there are some programs, I believe that CS is one of them, that will let you make your own alpha masks.

      Certainly you can make your own alpha masks (where else would you get them?), but you still can’t put colours in them: they consist of a single channel, rather than the three that are needed to store colour.

    • What I mean is that you can actually import it from another program, and if it has colors, then boom.

    • It is not possible for the mask to contain colour and a program certainly isn't going to crash if you try - it will merely convert it to greyscale.

    • Just what I heard. My sources are not completely reputable. Read the fine print.

      Fine Print:
      In the circumstances that I say something wrong on any thread, all people who have looked at the thread owe me 100$.

    • Let's pretend I didn't look :rolleyes:

      I have a question of my own about masks though. I've just been poking around with Photoshop (never really used it before) - I opened a PNG file with an alpha mask and can't for the life of me work out how on earth to access and modify the mask.

    • What do you mean by "modifying" the alpha mask? Do you mean making it transparent and overlaying it over another image, or expanding/contracting the mask?

      Either way I can't help you, but I'm interested. :laugh:

    • I know how to do it in GraphicConverter, but not Photoshop.

    • Yeah, I've always used GraphicConverter but have been looking at alternatives. In GC it's a piece of cake but with Photoshop I'm completely stumped.

      Modifying... well I wasn't looking to do anything specific, I was just trying to learn how to do things in PS.

    • @guy, on Oct 13 2007, 11:41 PM, said in Grayscale Masking:

      I have a question of my own about masks though. I've just been poking around with Photoshop (never really used it before) - I opened a PNG file with an alpha mask and can't for the life of me work out how on earth to access and modify the mask.

      Well.... There really should be a simple one-step method, but this is the only thing I could work out:

      • Open your png.
      • Use the Layers dialog to set min & max output levels both to 0 (black).
      • Create a new layer, fill it with white, and put it behind the layer with your png.
      • Merge Down the black+transparent png layer and the white layer. This is your alpha-mask-to-be.
    • Well... that's utterly ridiculous... but it did work :mellow:

    • @guy, on Oct 14 2007, 06:49 PM, said in Grayscale Masking:

      Well... that's utterly ridiculous...

      Agreed! There are a fair number of situations in which Photoshop makes me just throw up my hands and fire up GC.