THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/10/2003 at 05:55, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.200
Platform: Windows ;
Language(s) : C.O.F.F.E.E ; C++ ;
---------
I'm trying to write a plugin to allow Cinema 4D to produce EPix files for Piranesi, these are raster images with depth and material channels and camera projection information. I'm doing it as a Video Post plugin, and am recording the depths and materials in the ExecutePixel method.
The material channel is a tag for each pixel and a list of names to associate with each tag. I would like the tags to correspond to Cinema 4D materials and the names to be the names of those materials.
void EpixWriterData::ExecutePixel(PluginVideoPost *node, PixelPost *pp, LONG x, LONG subx, LONG suby)
{
if (pp->frag[0])
{
if (pp->vd->lhit)
{
LONG vind;
RayObject *obj=pp->vd->ID_to_Obj(pp->vd->lhit, &vind);
if (obj->texcnt)
{
use tag based on void* mp=pp->vd->GetTexData(obj, 0)->mp and name it with (BaseMaterial* )mp->GetName();
}
else if (obj->texture_link)
{
use tag based on obj->texture_link named obj->texture_link->GetName()
}
else if (obj->link)
{
use tag based on obj->link named obj->link->GetName()
}
else
{
use tag based on obj address with generated name
}
}
}
else
{
use fixed tag with fixed name
}
}
else
{
use special tag value for nothing there
}
}
I have two problems I know of here.
- I'm using the TexData mp field which is documented as internal use only - what is the supported way to get to the material name?
- If the ray to this pixel is reflected I get the depth of the object seen directly in pp->frag[0]->z, but pp->vd->lhit refers to the object whose reflection I can see. How do I get at the object corresponding to pp->frag[0]?
Thanks,
Arvan