Skip navigation
Currently Being Moderated

how to get image of texture

Oct 1, 2007 11:05 PM

hello;

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)


thanks
dsdsdsdsd
 
Replies
  • Currently Being Moderated
    Oct 10, 2007 11:57 PM   in reply to dsdsdsdsd
    Hi

    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!!!
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 26, 2011 4:37 PM   in reply to DAVID NAJAR

    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.

    Thanks,

    Don

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 27, 2011 9:05 AM   in reply to dlhays3

    Noisecrime has a texture extractor movie that uses ByteArrays:

    http://www.noisecrime.com/develop/techdemo/d11_5.html

     

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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)