Rendering 9 camera viewports



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

    On 13/07/2005 at 16:15, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9 
    Platform:   Windows  ;   
    Language(s) :   C.O.F.F.E.E  ;  C++  ;

    ---------
    I would like to write a plugin that does the following 2
    thing:
    In C4D program, there is a liner array o 9 target cameras.
    1. Renders a single output stream consisting of a 9 camera viewports,
    tiled as 3x3 and save this 9 tile viewport as an AVI file.
    2. I also want to tie the 9 camera's together so that if you move one
    camera
    (the center camera) the other 8 cameras follow maintaining relative
    distance.
    I am completely new to C4D.  I will probably be using
    C++ since by reading archived forum, coffee does not
    seem to  support what I would like to do.  I will greatly
    appreciate if anybody can give me some sugesstions
    (code samples welcome!)
    Thanks!



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

    On 21/07/2005 at 11:35, xxxxxxxx wrote:

    You are right that C++ is the way to go. There is an example in an earlier thread that you might find helpful: http://www.plugincafe.com/forum/display_topic_threads.asp?ForumID=4&TopicID=1065



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

    On 21/07/2005 at 11:36, xxxxxxxx wrote:

    Concerning 2., that is probably easiest to do with an Xpresso tag or a C.O.F.F.E.E. expression, depending on which one you know the best.



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

    On 01/08/2005 at 12:26, xxxxxxxx wrote:

    Hi Mikael
    Thanks for your reply.  What kind of plugin would you recomend for this type of project? 
    Thanks for your help.



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

    On 07/08/2005 at 20:23, xxxxxxxx wrote:

    About the code sample, it seems to be straight forward to render one camera to one output file, but what I am looking to do is render 9 camera's to the same output file so that the final output is a 3x3 tile of the 9 camera views. Is there a way to do this?



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

    On 11/08/2005 at 12:32, xxxxxxxx wrote:

    Yes. Just use the BaseBitmap functions (e.g. ScaleBicubic) to copy the small images to the right offset in the big one.



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

    On 12/08/2005 at 05:15, xxxxxxxx wrote:

    In ScaleBicubic, how do you define the base bit map source ?? the function has room for a destination, but not for a source. Or is the source assumed to be the calling bitmap.
    Also just to verify the method you are suggesting, Use Render Document to Render 9 Bitmaps, (do I need to define a filename ie generate a file for each of the bitmaps?) and then use scalebicubic to copy each bitmap into the final bitmap, and lastly use the save function of the basebitmap class to save my final 9 tile image. Is the overall approach ??



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

    On 16/08/2005 at 01:27, xxxxxxxx wrote:

    I am running into an odd problem using the  scale bicubic it doesn't write into the section specified, it seems to just rewrite into the upper left hand corner. Is there something that i am doing noticably wrong in this code?
    for (LONG i = 1; i <= 3; i++)
        {  
      AutoAlloc<BaseBitmap> TileBMP1;
      if (!TileBMP1)
      {
          MessageDialog("Unable to Alloc TileBMP1...");
          return false;
      }
      TileBMP1->Init(rdata.GetLong(RDATA_XRES), rdata.GetLong(RDATA_YRES));
      String cam = "CamTileN" + LongToString(i);
      BaseObject* cobj1 = doc->SearchObject(cam);
      MyPrivateData *pd;  // s defined
      //Set this camera as active scene camera
      if (!cobj1)
      {
          MessageDialog("Camera 1 Not Found");
          return false;
      }
      doc->GetRenderBaseDraw()->SetSceneCamera(cobj1);
      //Now Render that BitMap // did you know i have myprogresshook defined????
      if (RenderDocument(doc, rdata, MyProgressHook, &pd, TileBMP1, TRUE, NULL) != RAY_OK)
      {
          MessageDialog("Unable to write file...");
          return false;
      }
     // This part doesn't seem to be working as it should. it should be copying the bitmap section by section, it only writes to the 1st part for some reason
      TileBMP1->ScaleBicubic(NineTileBMP,0,0,TileBMP1->GetBw(),TileBMP1->GetBh(),(i)*NineTileWidth/3,0,((i)*NineTileWidth/3) + NineTileWidth/3,NineTileHeight/3);
      MessageDialog(cam);
     }



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

    On 16/08/2005 at 07:00, xxxxxxxx wrote:

    I haven't tried the code above, but reading
    "It only writes to the 1st part for some reason"
    sounds similiar to my problem posted yesterday
    ("ScaleBicubic erases image?")
    It seems that [(i)*NineTileWidth/3, 0] is always
    [0,0] for the destination position.

    I hope that bug will be fixed soon...



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

    On 07/09/2005 at 08:02, xxxxxxxx wrote:

    Hmm, it seems to work fine here. Perhaps the coordinate calculations are wrong? Note that the xmin/xmax coordinates are inclusive! Here are my two small-scale test cases:

        
        
        {  
         AutoAlloc<BaseBitmap> b;  
         AutoAlloc<BaseBitmap> b9;  
           
         b->Init(1, 1);  
         b9->Init(3, 3);  
           
         b9->Clear(50, 50, 50);  
           
         b->Clear(255, 0, 0);  
         b->ScaleBicubic(b9, 0, 0, 0, 0, 0, 0, 0, 0);  
         b->Clear(0,255,0);  
         b->ScaleBicubic(b9, 0, 0, 0, 0, 1, 1, 1, 1);  
         b->Clear(128,255,0);  
         b->ScaleBicubic(b9, 0, 0, 0, 0, 0, 1, 0, 1);  
         b->Clear(255,128,0);  
         b->ScaleBicubic(b9, 0, 0, 0, 0, 1, 0, 1, 0);  
         b->Clear(255,0,128);  
         b->ScaleBicubic(b9, 0, 0, 0, 0, 2, 0, 2, 0);  
         b->Clear(128,0,255);  
         b->ScaleBicubic(b9, 0, 0, 0, 0, 0, 2, 0, 2);  
         b->Clear(0,255,128);  
         b->ScaleBicubic(b9, 0, 0, 0, 0, 2, 1, 2, 1);  
         b->Clear(0,128,255);  
         b->ScaleBicubic(b9, 0, 0, 0, 0, 1, 2, 1, 2);  
         b->Clear(0,0,255);  
         b->ScaleBicubic(b9, 0, 0, 0, 0, 2, 2, 2, 2);  
         ShowBitmap(b9);  
        }  
        {  
         AutoAlloc<BaseBitmap> b;  
         AutoAlloc<BaseBitmap> b9;  
           
         b->Init(3, 3);  
         b9->Init(9, 9);  
           
         b9->Clear(50, 50, 50);  
           
         b->Clear(255, 0, 0);  
         b->ScaleBicubic(b9, 0, 0, 2, 2, 0, 0, 2, 2);  
         b->Clear(0,255,0);  
         b->ScaleBicubic(b9, 0, 0, 2, 2, 3, 3, 5, 5);  
         b->Clear(128,255,0);  
         b->ScaleBicubic(b9, 0, 0, 2, 2, 0, 3, 2, 5);  
         b->Clear(255,128,0);  
         b->ScaleBicubic(b9, 0, 0, 2, 2, 3, 0, 5, 2);  
         b->Clear(255,0,128);  
         b->ScaleBicubic(b9, 0, 0, 2, 2, 6, 0, 8, 2);  
         b->Clear(128,0,255);  
         b->ScaleBicubic(b9, 0, 0, 2, 2, 0, 6, 2, 8);  
         b->Clear(0,255,128);  
         b->ScaleBicubic(b9, 0, 0, 2, 2, 6, 3, 8, 5);  
         b->Clear(0,128,255);  
         b->ScaleBicubic(b9, 0, 0, 2, 2, 3, 6, 5, 8);  
         b->Clear(0,0,255);  
         b->ScaleBicubic(b9, 0, 0, 2, 2, 6, 6, 8, 8);  
         ShowBitmap(b9);  
        }
    

    Would it be possible to write such a test-case showing the problems you are having?



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

    On 07/09/2005 at 15:51, xxxxxxxx wrote:

    In theory the below code should generate 3 boxes of different colors in a diagnol fashion, but instead I get the final box stretching across the 300x300 area in the bitmap.
     const LONG NineTileWidth = 1290;
     const LONG NineTileHeight = 720;
     
     AutoAlloc<BaseBitmap> NineTileBMP;   
     if (!NineTileBMP)
     {
               MessageDialog("Unable to Alloc NineTileBMP");
               return false;
     }
     NineTileBMP->Init(NineTileWidth,NineTileHeight);
     
     AutoAlloc<BaseBitmap> TileBMP1;
     if (!TileBMP1)
     {
         MessageDialog("Unable to Alloc TileBMP1...");
         return false;
     }
     TileBMP1->Init(rdata.GetLong(RDATA_XRES), rdata.GetLong(RDATA_YRES));
     for (LONG i = 1; i <= 3; i++)
     {  
      TileBMP1->Clear(i*255/3,i*255/3,i*255/3); 
      TileBMP1->ScaleBicubic(NineTileBMP,0,0,TileBMP1->GetBw(),TileBMP1->GetBh(),((i-1)*100),((i-1)*100),(i*100),(i*100));
     }
       ShowBitmap(NineTileBMP);



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

    On 07/09/2005 at 16:09, xxxxxxxx wrote:

    Test Example : ok I expanded your test example... it works as long as your numbers are less than 10.. after 10 something wierd happens.
     AutoAlloc<BaseBitmap> b;
     AutoAlloc<BaseBitmap> b9; 
     b->Init(3, 3);
     b9->Init(90, 90); 
     b9->Clear(50, 50, 50); 
     b->Clear(255, 0, 0);
     b->ScaleBicubic(b9, 0, 0, 2, 2, 0, 0, 20, 20);
     b->Clear(0,255,0);
     b->ScaleBicubic(b9, 0, 0, 2, 2, 30, 30, 50, 50);
     b->Clear(0,0,255);
     b->ScaleBicubic(b9, 0, 0, 2, 2, 60, 60, 80, 80);
     ShowBitmap(b9);



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

    On 08/09/2005 at 12:34, xxxxxxxx wrote:

    Confirmed and reported. Since the bug only seems to affect operations where the bitmap really is scaled, i.e. not 1:1 operations, a workaround is to do the scaling in two steps:

        
        
        AutoAlloc<BaseBitmap> b;   
        AutoAlloc<BaseBitmap> b2;   
        AutoAlloc<BaseBitmap> b9;
        
        
        
        
        b->Init(3, 3);   
        b2->Init(21, 21);   
        b9->Init(90, 90);  
        
        
        
        
        b9->Clear(50, 50, 50);  
        
        
        
        
        b->Clear(255, 0, 0);   
        b->ScaleBicubic(b2, 0, 0, 2, 2, 0, 0, 20, 20);  
        b2->ScaleBicubic(b9, 0, 0, 20, 20, 0, 0, 20, 20); 
        
        
        
        
        b->Clear(0,255,0);   
        b->ScaleBicubic(b2, 0, 0, 2, 2, 0, 0, 20, 20);  
        b2->ScaleBicubic(b9, 0, 0, 20, 20, 30, 30, 50, 50);
        
        
        
        
        b->Clear(0,0,255);   
        b->ScaleBicubic(b2, 0, 0, 2, 2, 0, 0, 20, 20);  
        b2->ScaleBicubic(b9, 0, 0, 20, 20, 60, 60, 80, 80);
        
        
        
        
        ShowBitmap(b9);
    

    This makes it even more important to avoid off-by-one-errors, since they might make the second scale operation non-1:1.



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

    On 21/09/2005 at 15:56, xxxxxxxx wrote:

    Thank you Mikael,
    Now I am on the home stretch with one last problem. It always renders the same frame into the bitmap each time. Is there a way to select which frame is being rendered.
    I have tried setting data in the Base Container used in renderdocument
     rdata.SetTime(RDATA_FRAMEFROM,     BaseTime(frame, doc->GetFps()));
     rdata.SetTime(RDATA_FRAMETO,     BaseTime(frame, doc->GetFps()));

    and tried
     rdata.SetLong(RDATA_FRAMESEQUENCE, frame);

    but in both cases whatever frame is on display is the frame htat gets rendered, not what i am passing in the code, is there a way to set the frame similar to setactiveobject ??
    Here is my render document command
    RenderDocument(doc, rdata, MyProgressHook, &pd, TileBMP, TRUE, NULL)



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

    On 14/10/2005 at 13:32, xxxxxxxx wrote:

    RDATA_FRAMESEQUENCE should be set to 0 = Manual I guess, but probably those values are ignored since RenderDocument() only does a single frame. Try using doc->SetTime() to set the time.



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

    On 07/12/2005 at 23:10, xxxxxxxx wrote:

    I have a problem using the path to generate my final AVI file , I want to use the path from Render Settings->save however, since my avi file is made up of bitmaps that are generated by renderdocument, my avi file gets overwritten by each call to renderdocument. Is there a way that I can change that path, such that renderdocument goes to some other file, and my avi can be saved, but still use the directory specified in Path ??



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

    On 10/12/2005 at 04:53, xxxxxxxx wrote:

    Wouldn't that just be a matter of changing RDATA_PATH before calling RenderDocument()?


Log in to reply