Announcement

Collapse
No announcement yet.

[VRaySDK] Identify VRay fur strand during shading

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [VRaySDK] Identify VRay fur strand during shading

    Hi,
    I have modified vrayfur sample that comes with vray. I want to randomize color of every hair strand. I know I can do that inside VRayFurInstance::shade. This is what I do:

    Code:
    VRenderInstance::fullShade((VRayInterface&)vri);
    RayResult rresult = vri.rayresult;
    GenericPrimitive *pp = rresult.primitive;	
    
    if (pp->type() == PRIM_TYPE_STATIC_HAIR_SEGMENT_LINE)
    {
    StaticHairStrand *hStrand = (StaticHairStrand*)pp->owner;
    int oi = pp->owner->ownerIndex;
    ::Random r;
    float v;
    r.srand(oi);
    r.rand();
    //now I modify vri.mtlresult.color
    }
    Problem is oi changes from frame to frame for same strands. Inside genStrand every strand is identified by faceIndex and strandIndex but I have no idea how can I access these data from VRayFurInstance::shade. Any idea how can I do this? Maybe I should try some different approach?
Working...
X