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

    Shader to texture?

    Scheduled Pinned Locked Moved SDK Help
    1 Posts 0 Posters 154 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 04/11/2010 at 19:44, xxxxxxxx wrote:

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

      ---------
      I have a material using a Xtiles shader in the color channel, and I want to convert it to a bitmap.
      I followed the code here:
      https://developers.maxon.net/forum/topic/5075/5001_reading-texture-data&KW=PluginShader&PID=20508#20508
      However, InitRender() always returns 0.  No bitmap is generated.  All passed parameters appear valid.
      How can I convert this shader to a bitmap?

        
       //BaseContainer *data = mat->GetDataInstance();  
       //PluginShader *shader = (PluginShader* )data->GetLink(MATERIAL_COLOR_SHADER, doc, Xbitmap);
       BaseChannel *channel = mat->GetChannel(CHANNEL_COLOR);  
       BaseShader *shader = channel->GetShader();
       Filename docpath = doc->GetDocumentPath();  
       String matname = mat->GetName();
       InitRenderStruct rs;  
       rs.version   = GetC4DVersion();  
       rs.time      = doc->GetTime();  
       rs.fps       = doc->GetFps();  
       rs.docpath   = docpath;  
       rs.matname   = &matname;  
       rs.errorlist = NULL;  
       rs.vd        = NULL;  
       rs.doc       = doc;  
       rs.thread    = NULL;  
       rs.flags     = INITRENDERFLAG_TEXTURES;
       BOOL br = shader->InitRender(rs); // returns zero
       BaseBitmap *bmp = shader->GetBitmap();  
       if (!bmp) return FALSE;  // returns NULL
       GePrint(LongToString(bmp->GetBw()));  
       GePrint(LongToString(bmp->GetBh()));
       shader->FreeRender();  
      

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