Sunday, March 13, 2011

Renderman RSL DSO Plugin for quering progress rendering

I tested the new RenderMan Interface Control lib for the getting progress rendering
in shader calculating environment. The new Ric API include function RtInt RicGetProgress()
for returns percentage progress of rendering.
I wrote the little DSO with float function returns progress during rendering:


// progress.cpp source code
#include <stdio.h>
#include "RslPlugin.h"
#include "Ric.h"
extern "C" {
    RSLEXPORT int
    progressFloat(RslContext* rslContext,    int argc, const RslArg* argv[])
    {
        RslFloatIter result(argv[0]);
        *result = (float)(RicGetProgress());
        //printf("GetProgress --- %f\n", *result);
        return 0;
    }

    static RslFunction myFunctions[] =
    {
        {"varying float progress()", progressFloat, NULL, NULL },
        NULL
    };
RSLEXPORT RslFunctionTable RslPublicFunctions(myFunctions);
}; /* extern “C” */
And I used it in shader code for red-blue indexing of progress:
plugin  "progress";
.......
float pr = progress()*0.01; // 
Ci = mix(color(1,0,0), color(0,0,1), pr);
Main goal this function - calling for progress during re-rendering for optimizing calculation budget etc. But rerendring cals this function yielded unexpected results.















































In next step I plan testing this one with a more complicated calculations.

No comments:

Post a Comment