Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Getting Material in Video Post ExecutePixel

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 232 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 24/03/2010 at 04:50, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   11.5 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      I want to find the name of a material a pixel is being rendered in from a Video Post plugin. I have got code that works in some cases, but if there are different materials applied to selected faces of a cube I can't see how to get the right material.

      Here's what I'm doing

      if (pp->frag[0]->id.Content())
      {
          RayObject *obj=pp->frag[0]->id.GetObject(pp->vd);
          if (obj->texcnt)
          {
              GeListNode* mp=pp->vd->GetTexData(obj, 0)->mp;
              if (mp && mp->IsInstanceOf(Tbaselist2d))
              {
                  BaseList2D *bmp=static_cast<BaseList2D*>(mp);
                  name=bmp->GetName();

      but in the example I'm currently working on, obj->texcnt is 3 and the names I actually want are those from GetTexData(obj, 0), GetTexData(obj, 1) and GetTexData(obj, 2). Unfortunately I can't see any way to work out which index I need for a given pixel!

      I can get polygon index numbers, which are different on the 3 faces I can see, but can't see any way to map them to textures.

      Thanks,

      Arvan

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 24/03/2010 at 06:59, xxxxxxxx wrote:

        You can access the current texture through BaseVolumeData::tex.

        Have a look at the example below.

          
        void VisualizePostData::ExecutePixel(PluginVideoPost *node, PixelPost *pp, LONG x, LONG subx, LONG suby)  
        {  
          if (pp->vd)  
          {  
              TexData *tex = NULL;  
              tex = pp->vd->tex; //the texture data of the current pixel  
          
              if (tex)  
              {  
                  //render red if a texture has been found, just as example  
                  pp->col[0] = 1.0;  
                  pp->col[1] = 0.0;  
                  pp->col[2] = 0.0;  
              }  
          }  
        }  
        

        cheers,
        Matthias

        1 Reply Last reply Reply Quote 0
        • First post
          Last post