Announcement

Collapse
No announcement yet.

Access to SUBTEXNO_DIFFUSE : diffuse map name and channel ID in 3ds Max ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Access to SUBTEXNO_DIFFUSE : diffuse map name and channel ID in 3ds Max ?

    Hello,

    I am trying to retrieve VRay diffuse file map name and the UV channel to which it is applied.

    Actually I have:

    IParamBlock2 *pblockMaps=mtl->GetParamBlockByID(VRayMtlParameters::vrayMtl_maps _id);

    int diffuse_map_on = pblockMaps->GetInt(VRAYMTL_TEXMAP_ON_PARAMID(VRayMtlParameter s::SUBTEXNO_DIFFUSE), ip->GetTime());
    if (diffuse_map_on)
    {
    Texmap *diffuse_texture = pblockMaps->GetTexmap(VRAYMTL_TEXMAP_PARAMID(VRayMtlParameter s::SUBTEXNO_DIFFUSE));

    // How can I access the Diffuse file map name and map channel number to which the map is applied ?



    Any help would be great !

    Thanks,
    Manuel

  • #2
    This is really a 3ds Max question rather than pdplayer, isn't it? In any case, it depends on what kind of texture is attached. If diffuse_texture->ClassID() returns Class_ID(BMTEX_CLASS_ID,0) then it is a bitmap texture, and you can use the following code to extract the file name:
    Code:
    MSTR getBitmapFileName(Texmap *texmap, TimeValue time) {
        if (!texmap || texmap->ClassID()!=Class_ID(BMTEX_CLASS_ID, 0))
            return _T("");
    
        // Bitmap texture pblock ID, taken from bmtex.h in the 3ds Max SDK
        enum { bmtex_params,bmtex_time };
    
        IParamBlock2 *pblock2=texmap->GetParamBlockByID(bmtex_params);
        if (!pblock2)
            return _T("");
    
        // Bitmap texture parameter IDs, taken from bmtex.h in the 3ds Max SDK
        enum {
            bmtex_clipu,bmtex_clipv,bmtex_clipw,bmtex_cliph,
            bmtex_jitter,bmtex_usejitter,
            bmtex_apply,bmtex_crop_place,
            bmtex_filtering,
            bmtex_monooutput,
            bmtex_rgboutput,
            bmtex_alphasource,
            bmtex_premultalpha,
            bmtex_bitmap,
            bmtex_coords, // access for UVW mapping
            bmtex_output, //output window
            bmtex_filename // bitmap filename virtual parameter, JBW 2/23/99
        };
    
        PBBitmap *pbbitmap=pblock2->GetBitmap(bmtex_bitmap, time);
        if (!pbbitmap)
            return _T("");
    
        MaxSDK::Util::Path path=pbbitmap->bi.GetPathEx();
        return path.GetString();
    }
    The source code of the Bitmap texture is included with the 3ds Max sdk in [maxsdk]\samples\materials\bmptex.h and bmptex.cpp

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      Thanks for the piece of code. Very appreciated!
      You are true, I post the question in the bad forum. We might move the post if you want.

      In my case the Texmap classid is not BMTEX_CLASS_ID, but this is something else.
      The Texmap class id is : 0x6EC3730C

      I guess this is specific to VRay, but I can't find any documentation on it.

      Looking the diffuse in Material Editor lead to the joined image capture, which is this 0x6EC3730C Texmap classid.
      When I click on Map #28 button it opens the BMTEX_CLASS_ID TexMap, but I don't know how to access to it programatically from the previous one.

      Any help is very appreciated!

      Thanks



      Comment


      • #4
        I'm trying to do the same thing, any further info on this?

        Comment

        Working...
        X