3 Replies Latest reply on Aug 27, 2011 9:05 AM by Dee McDee

    how to get image of texture

    dsdsdsdsd Level 1

      is this possible: put member(...).texture(...).image

      ultimately I wish to:
      a = member("w3d").texture("some").image
      b = member("jpg").image
      a.copypixels( b , a.rect , b.rect)

        • 1. Re: how to get image of texture
          DAVID NAJAR Level 1

          The simple answer is NOT or better said NOT SO SIMPLE. If you build the original 3D scene and convert it to W3D file format then you can get into director the images you use on your 3D application as a textures separately and apply these at runtime to your models, so you have the images (bitmap data) to play with as any other bitmap on Director. The image property of the texture doesn’t works, at least to me. Other solution is at runtime build a plane facing the 3D camera, setting the visual size, projection and so on, assign a new shader with the emissive property set to color(255,255,255) (full white) to the plane and put the texture you want (considering some texture params like quality, nearFiltering and renderFormat) and grab the image property of the stage or 3d cast member. It isn’t a elegant way to get the image of a texture but works, the drawback of this is that image`s resolution could be not the same as the original (stored on the W3D file) and the aspect ratio of the texture not always is square, then you have to code all this considerations and modify the width/length and visible size of your plane with texture on screen and some more. My personal solution: I’ve made a texture extractor application by using a Xtra to read binary data (on the 3d cast member media property) and search for a jpg binary header and end binary tag, then copy the binary data in between and save to disk (with the same Xtra) with somename.jpg extension and I get a jpg file exactly as the stored on the w3D file!!! From here you can import the new jpg image file into Director and use it as you like. You even can do this at runtime but just as a projector application, if you want to do it as plugin run mode (shockwave plugin on a web browser) the option of the plane facing the camera could work. I hope this can help you

          Have a nice coding!!!
          • 2. Re: how to get image of texture

            Hello David,

            In your reply you daid you have an Xtra to copy the binary data of a texture and save it to a jpeg. Have you made this available to the public?

            I have a project that has come back to haunt me from almost 8 years ago that Ihave the director files but none of the 3DS files or the textures. They want to update some models in the game with updated textures so now I'm trying to figure out the best way for me to  move forward. Of cours I've attempted to copy a texture as an image to a new member but that fails. So if you have available the Xtra that you are speaking of I would be very interested in it.



            • 3. Re: how to get image of texture
              Dee McDee Level 2

              Noisecrime has a texture extractor movie that uses ByteArrays:



              It works pretty well as long as you don't need the alpha component.