THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/11/2010 at 07:41, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 11.532
Platform: Windows ;
Language(s) : C++ ;
---------
Hello together,
i'm currently working on a command line plugin which is trying to render a document at some point. It's working fine until 32bit float images have to be created. The problem is, that the illumination channel looks brighter than it should in some cases. This happens unpredictable.
I guess this is because of my missinterpretation of the RenderDocument() method and/or the wrong use of the MultipassBitmap Class, so maybe someone can help me to get it correct.
Her comes some example code:
The rendering is started during the start-up phase of C4D:
Bool PluginMessage(LONG id, void *data)
{
// only use functionality if c4d is started without gui
if (GeGetSystemInfo() != SYSTEMINFO_NOGUI) return FALSE;
// run on C4D startup
// normally comand line args are passed, skipped for demonstration
if (id == C4DPL_COMMANDLINEARGS)
{
// start rendering here
Run();
return TRUE;
}
return FALSE;
}
The implementation of the exemplary Run() method:
void Run()
{
// load document
BaseDocument *doc = LoadDocument( "myscene.c4d",
SCENEFILTER_OBJECTS|SCENEFILTER_MATERIALS,
NULL );
if (!doc) return;
// retrieve RenderData information
RenderData *rData = doc->GetActiveRenderData();
if (!rData) return;
BaseContainer *bc = rData->GetDataInstance();
if (!bc) return;
// prepare dummy bitmap
LONG x = bc->GetLong(RDATA_XRES);
LONG y = bc->GetLong(RDATA_YRES);
LONG depth = MODE_RGBf; // depth is hardcoded for demonstration
MultipassBitmap *bmp = MultipassBitmap::Alloc(x, y, depth);
if (!bmp)
{
KillDocument(doc);
return;
}
// start render
LONG result = RenderDocument(doc, *bc, NULL, NULL, bmp, RENDERFLAG_EXTERNAL, NULL);
// cleanup
MultipassBitmap::Free(bmp);
KillDocument(doc);
return;
}