On 28/10/2014 at 12:59, xxxxxxxx wrote:
User Information:
Cinema 4D Version: r14
Platform: Windows ;
Language(s) : C++ ;
---------
Hi there,
can someone point me to what i am doing wrong here?
Basically i want to use the UniqueIP of different objects within a shader, but it doesn't work. shouldn' this apply different shades of red to each object?
Vector uniqueIDshader::Output(BaseShader *chn, ChannelData *cd)
{
Vector result = Vector(0.0);
if (cd->vd)
{
RayObject *robj = NULL;
robj = cd->vd->op;
if (!robj) return 0.0;
LONG uniqueID = robj->link->GetUniqueIP();
result.x = (uniqueID%255)/255.0;
return result;
}
return result;
}
edit: generally i'd like to have a random number for each object the shader is assigned to and i thought the unique ip could be used for the random init.
thanks,
Ello