accessing bitmap shader



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

    On 04/02/2008 at 01:23, xxxxxxxx wrote:

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

    ---------
    Hi all,

    I'm trying to access the color value of a shader, while not in a rendering process. The Plugin should scale multiple objects, based on the gray value of a give shader - like the mograph shader-effektor does.

    I created a fake InitRenderStruct and ChannelData and all works fine with a normal shader like noise or gradient, but as soon as i load a bitmap it doesnt give proper values.

    > <code>
    > InitRenderStruct iStruct;
    > iStruct.doc = doc;
    > iStruct.docpath = &(doc->GetDocumentPath());
    > iStruct.errorlist = NULL;
    > iStruct.flags = 0;
    > iStruct.fps = doc->GetFps();
    > iStruct.matname = NULL;
    > iStruct.thread = thread;
    > iStruct.time = doc->GetTime();
    > iStruct.vd = NULL;
    > iStruct.version = GeGetVersionType();
    >
    > ChannelData cd;
    > cd.d = 0;
    > cd.off = 0;
    > cd.scale = 0;
    > cd.n = Vector(0,0,1);
    > cd.p = Vector(1,1,0);
    > cd.t = doc->GetTime().Get();
    > cd.texflag = 0;
    > cd.vd = NULL;
    >
    > shader->InitRender( &iStruct; );
    >
    > for (Real a=0; a<1; a += .1)
    >      for (Real b=0; b<1; b += .1)
    >      {
    >           cd.p = Vector( a, b, 0);
    >
    >           // this doesnt work for bitmaps ???
    >           Real testValue = shader->Sample(&cd;).x;
    >      }
    >
    > shader->FreeRender();
    > </code>

    Thanks in advance, Heinrich Löwe


Log in to reply