THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/04/2010 at 23:15, xxxxxxxx wrote:
Cinema 4D Version: 11.5
Platform: Windows ;
Language(s) : C++ ;
Hi everyone !
I'm trying to implement a plugin which needs some pre render passes like the GI.
Is there a way to let the c4d core do a pre pass (like the AR GI) ?
I've implemented my own prepass in the plugin. but it's very slow compared to a standard c4d
rendering. and the sampling is even less (every 4th pixel and no AA at all) than the main pass.
I used TraceColorDirect() and this may be slower but that many (10 times ore more) ?
Maybe there is something missing ... here the code from the thread:
VolumeData \*vd = vps->render->GetInitialVolumeData(threadNum);
for(Real fy=0; fy<h; fy+=step)
for(Real fx=0; fx<w; fx+=step)
screen_x = left + fx;
screen_y = top \+ fy;
vd->GetRay(screen_x, screen_y, &ray);
ray.ior = 1.0f;
ray.transport = Vector(1.0,1.0,1.0);
color = vd->TraceColorDirect(&ray, 1.0e30f, 0, vd->raybits, lastHit, &oldP, &si);
for(LONG iy=top; iy<bottom; ++iy)
bitmap->SetLine(left, iy, w, &colors[(iy-top)\*w], 32, TRUE);
and of course I use threads for it ... here is how I do that:
LONG render = 0;
for(LONG i=0; i<numThreads; ++i)
LC_RECT rect = buckets _;
threads _.Init(vps, i, rect.left, rect.top, rect.right, rect.bottom, ...);
thList _= &threads _;
if(!mp.Init(vps->thread, numThreads, thList))
ret = RAY_MP;
ret = RAY_MP;
// wait for a thread
VPRenderThread \*thread = VPRenderThread\* )mp.WaitForNextFree();
ret = RAY_USERBREAK;
LONG threadID = thread->GetThreadID();
// ok, assign a new bucket
LC_RECT rect = buckets[render];
thread->Init(vps, threadID, rect.left, rect.top, rect.right, rect.bottom, ..);
Real prog = (Real)render/(Real)numBuckets;
so not sure why it's so slow ... sure, the raytracer takes more time for camera rays than the scanliner ... but that many ?
the project you can download from here
if you like