3 Replies Latest reply on Mar 21, 2007 8:42 AM by smartino

    Model as a member.

    smartino Level 1

      I'm just wondering if there a way in which I can grab (snapshot) a model within a 3D member and create an static image of it. I can stage.image the 3D member, but I would like to refine it even more to just the model I would be looking to grab. Further more it would be nice to include an alpha to the member to knock out the background if the model was an odd shape.

      If there is an xtra or a method of doing this I'd be creatful to anybody who can point me in the right direction.

      Thanks in advance for any help.

      Cheers Simon.
        • 1. Re: Model as a member.
          James Newton, ACP Level 3
          You can use...

          vImage = member("3D").image

          ... assuming that your shockwave3D member is called "3D".

          You can use the crop() method on an image to return a cropped rect of that image. Or you can position your model in the 3D sprite before you take the snapshot, so that it fills the sprite.
          • 2. Re: Model as a member.
            _lw Level 1
            As far as i know, only the default camera of a 3D-member will produce the "member("3D").image". But you can set the size of the image with the "defaultrect" property of the 3D-member. The 3D-member does not have to be on stage.

            If you would like to get a image that has the size of 1024x1024 you would set the "defaultrect" of the 3D-member first.

            member("3D").regpoint=point(512,512) -- just to keep the center in the middle, would make sense to use variables here...


            or the faster way would be to create in the beginning a image and then use copypixels.

            property pimage

            ... -- later on in the script where you want to copy the image of the 3D member into your bitmap...
            pImage.copyPixels(pmember.image, pimage.rect, pmember.rect)

            to generate the alpha-channel, i think you would have to use two images, one with a white backround and a black model. You only need to apply a black shader to your model (and all its children) and make the screenshot. Then use some imaging lingo to add the alpha channel to the colored version.

            • 3. Model as a member.
              smartino Level 1
              Nice work both of you. Both worked fine and hondo3000, the alpha idea is just what i needed.