4 Replies Latest reply on Jan 24, 2008 4:13 AM by GlennoUK

    Semi transparent models, using a greyscale image

    GlennoUK Level 1
      Hi,

      Ive done a few searches on the forum for this. But couldnt find a specific answer. With regards to textures with alpha channels, and im not sure if im aiming in the right direction.

      I want to have a semi transparent model, of a hair model actually. I have a grayscale image, which is the alpha channel information, and i have a number of textures of various hair colours that work with this greyscale alpha jpg.

      I'd like to assign the alpha channel jpg to textureList[1], to ahieve transparency according to the greyscale image. then apply the specific hair colour jpg to textureList[2].

      Ive played around with blend, blendSource and blendConstant, and I can get a bit of an effect(streaks in the girls hair), but not the alpha channel effecting the visibility of the model effect i'm after.

      Is it possible to affect the visibility of a models polys, through a greyscale texture/jpg being used for alpha channel information? Is there another way, that ive missed?

      Thanks in advance,
      Glenno
        • 1. Re: Semi transparent models, using a greyscale image
          _lw Level 1
          The easiest way is to use PNG with 32bit alpha channel. When you use these textures in your shader, then it will be transparent by default.

          Make also sure you use the correct textureRenderFormat.
          • 2. Re: Semi transparent models, using a greyscale image
            _eyesonly
            You could even animate the alpha of the image using imaging lingo. To set it on a single #fromImageObject texture you will need to create two images, a 32 bit "host" image and an 8 bit grayscale image. You can then use setAlpha() to apply the alpha information to your host image and then create the texture using the 32 bit imageobject (with the correct texturerenderformat). If either the host imageobject is not 32 bit or the grayscale image not 8 bit the setAlpha() operation will fail silently.
            • 3. Re: Semi transparent models, using a greyscale image
              Level 7
              > If either the host
              > imageobject is not 32 bit or the grayscale image not 8 bit the setAlpha()
              > operation will fail silently.

              Adding to this, if the dimensions aren't the same the setAlpha() command
              will fail; and I wouldn't say "silently" as the command returns a
              boolean indicating success or not:
              bSuccess = imageObject.setAlpha(alphaImageObject)
              • 4. Re: Semi transparent models, using a greyscale image
                GlennoUK Level 1
                Thanks very much for the replies. Unfortunately theres a lot of textures, with the vast majority already been made, and where an alpha was needed, its been supplied seperately as a seperate greyscale jpg. Next step is to try your suggestion of using the greyscale image as the alpha for an image object. And if not, get the required alpha textures remade as PNGs.

                Thanks again,
                Glenno