THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/11/2002 at 22:29, xxxxxxxx wrote:
Did you set VIDEOPOST_RAYTRACING in GetRenderInfo()?
yes .
here is a little snippet, or bet ter still the entire vp plugin.
as you can see its not trying to do anything strange. but it just doesnt include reflection , transparence and a whol lot of other stuff.
its just giving the crude shaded color :(
#include "c4d.h"
class InvertData : public VideoPostData
{
public:
static NodeData *Alloc(void) { return gNew InvertData; }
virtual LONG Execute(PluginVideoPost *node, VideoPostStruct *vps);
virtual LONG GetRenderInfo(PluginVideoPost *node) { return VIDEOPOST_RAYTRACING; }
};
LONG InvertData::Execute(PluginVideoPost *node, VideoPostStruct *vps)
{
if (vps->vp==VP_INNER && vps->open && *vps->error==RAY_OK && !vps->thread->TestBreak())
{
RayParameter *ray = vps->vd->GetRayParameter(); // only in VP_INNER & VP_RENDER
if (!ray) return RAY_NOMEM;
LONG x1,y1,x2,y2,x,y,cnt,i;
x1 = ray->left; // you could try by just rendering the entire screen area
y1 = ray->top;
x2 = ray->right;
y2 = ray->bottom;
cnt = x2-x1+1;
Ray myray,myray1;
LONG px,py,l,ho,hit=0;
Vector no,po,p1,n1;
LVector p,n;
UWORD R,G,B,A;
LONG sum=0,skip=0;
Real bmpw=globalmap->GetBw();
Real bmph=globalmap->GetBh();
Real c1=1.0/255.0;
Real Xfac=1.0/rw;
Real Yfac=1.0/rh;
Real XBfac=1.0/bmpw;
Real YBfac=1.0/bmph;
// be sure that "globalmap" is a bitmap big enough for the screen
// region_from and region_to define an area to be rendered
// rendering a specific area
while ( Allow_Render)
{
for (py=region_from.y-ct;py<region_to.y-ct;py++)
{
for (px=region_from.x;px<region_to.x;px++)
{
vps->vd->GetRay(px,py,&myray);
myray.pp[0]=myray.pp[1]=myray.pp[2]=SV(myray.p);// todo sort this loop out
myray.vv[0]=myray.vv[1]=myray.vv[2]=SV(myray.v);
VolumeData *cpy = VolumeData::Alloc();if (!cpy) return RAY_OK;
vps->vd->CopyTo(cpy); // copy vd settings into cpy
Vector Col=cpy->TraceColorDirect(&myray, 100000,cpy->raydepth+1,cpy->raybits,cpy->lhit, &p,&n,&hit);
if (hit) sum++;
VolumeData::Free(cpy); // free copied data
// no reflections :(
globalmap->SetPixel(px,py,Clamp(0,255,Col.x*255.0),Clamp(0,255,Col.y*255),Clamp(0,255,Col.z*255));
}
}
}
}
return RAY_OK;
}
#define ID_SECRETVIDEOPOST ######## // a number :)
Bool RegisterVPsecret(void)
{
String name="Active Renderer";
return RegisterVideoPostPlugin(ID_SECRETVIDEOPOST,name,0,InvertData::Alloc,"",0,0);
}
any ideas why tracecolordirect wont return a usefull color??
cheers
Paul