LWF gamma converter for Vray



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

    On 10/04/2008 at 06:00, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.5 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hello all,

    Coming from 3ds Max+Vray, I used a gamma converter script for LWF and I would like to build a similar script for converting Vray materials in C4d to the LWF gamma of 0.55/0.454 by using a filter in the texture diffuse slot. Because I am still new to programming I would like to know how to call shaders in the texture map. Calling vectors and int's goes well in this first script to call the functions, but in the texturemap it goes wrong. I cannot use the GetChannel, this returns a Nill.

    Can I insert a XslaFilter in the Texturemap and copy the current texture into that shader with C.O.F.F.E.E.? Or must I plunge into C++?

    This is my current code:

    I found the namings in the plugin description folders in the vray plugin folder.
    As you can see below I can call vray colors/sliders and states, but when I try the same script on the texturemap it fails. So if someone can help further to insert a shader in the texture map, please let me know!

    Eelke

    > `

      
    \>  main(doc,op)   
    \>  {   
    \>  //Get the first material in the manager   
    \>  var diffcolor1 = doc->GetFirstMaterial();       
    \>    
    \>  //Cycle through all materials   
    \>  while(diffcolor1)   
    \>  {   
    \>  //Get all data from the selected material   
    \>  var diffcolor1Bc = diffcolor1->GetContainer();   
    \>    
    \>  //Check the current state of the channel diffuse color 1   
    \>  var currchannel=diffcolor1Bc->GetData(VRAYMATERIAL_USE_COLOR);   
    \>  //Show in the console   
    \>  println(currchannel);   
    \>    
    \>  //Set the state of this channel ON   
    \>  diffcolor1Bc->SetData(VRAYMATERIAL_USE_COLOR,TRUE);   
    \>  //Set the texture of this channel to 50% gray   
    \>  diffcolor1Bc->SetData(VRAYMATERIAL_COLOR_COLOR,(vector(0.5,0.5,0.5)));   
    \>  //Set the texture of this channel to 100% Transparent   
    \>  diffcolor1Bc->SetData(VRAYMATERIAL_COLOR_TRANSP_MULT,(1.0));   
    \>  //Set the texture of this channel to Filter (DOES NOT WORK YET, MUST I SET A UNIQUE CONTAINER?)   
    \>  diffcolor1Bc->SetData(VRAYMATERIAL_COLOR_TRANSPSHADER,(XSLAFILTER));   
    \>    
    \>  //Put the new data back into the origional data   
    \>  diffcolor1->SetContainer(diffcolor1Bc);   
    \>    
    \>  //UPDATE THUMBNAIL       
    \>  diffcolor1->Update();   
    \>  diffcolor1->Message(MSG_UPDATE);   
    \>    
    \>  //Get Next Material   
    \>  diffcolor1=diffcolor1->GetNext();   
    \>  }   
    \>    
    \>  }  
    \>  
    

    `



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

    On 10/04/2008 at 08:49, xxxxxxxx wrote:

    It's currently not possible in COFFEE to insert shaders into materials. It is possible with the C++ plugin API. You have to set the link of the shader and insert it into the material.

    some sample in this thread
    copy shader tree

    cheers,
    Matthias



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

    On 10/04/2008 at 14:15, xxxxxxxx wrote:

    Thanks for the quick reply,

    Because I am totally new in C++, how can I test my scripts the fastest? Can I write C++ in C4d in the C.O.F.F.E.E. script editor or must I use an external scripter and open it in C4d through adding it in the plugin folder?
    I tried to copy/paste some samples in the script editor, but I probably must paste it in a framework. Only I would like to write the functions first before setting up a menuplugin. Is that possible?

    Eelke


Log in to reply