Hair + Vray



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/04/2007 at 06:19, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.6 + 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    HI All,

    this is a specific question to David.
    What i need to do to integrate the hair post rendering on my vray render?
    Deep Buffer or what?

    Cheers
    Renato



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/04/2007 at 06:36, xxxxxxxx wrote:

    From the HairVideoPost you should be able to access the render data for hair. The hair pixels are accessed via the GetFragments. Using this you can access for any (x,y) the color, transparency and depth for the hair render.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/04/2007 at 15:12, xxxxxxxx wrote:

    Hi David,

    so i just need to get for each pixel the fragment and composite it with each vray pixel at the certain deep?

    will be easy to me a piece of code to get it inside my bridge (in execute) :)

    Cheers
    Renato



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/04/2007 at 02:11, xxxxxxxx wrote:

    If you take the hair video post example and replace the main execute with the code below it should give you a starting point. You can also use the GetFragmentLink call which will access the data directly rather than it copying to an array:

      
    LONG HairSDKVideopost::Execute(PluginVideoPost *node, VideoPostStruct *vps)  
    {  
         if (vps->vp==VP_INNER)  
         {  
              //HairLibrary hlib;  
      
    #define HAIR_RENDER_TYPE 1008  
    #define HAIR_RENDER_TYPE_RASTER_8BIT 0  
      
              if (vps->open)  
              {  
                   AutoAlloc<BaseBitmap> bmap;  
      
                   HairVideoPost *hpost=(HairVideoPost* )vps->vd->FindVideoPost(VPhair);  
                   if (hpost)  
                   {  
                        LONG x,y,cnt,i;  
                        Bool bit8=hpost->GetDataInstance()->GetLong(HAIR_RENDER_TYPE)==HAIR_RENDER_TYPE_RASTER_8BIT;  
                        RayParameter *rp=vps->vd->GetRayParameter();  
      
                        if (bmap->Init(rp->xres,rp->yres))  
                        {  
                             for (y=rp->top;y<=rp->bottom;y++)  
                             {  
                                  for (x=rp->left;x<=rp->right;x++)  
                                  {  
                                       Vector col;  
                                       Real trans=1.0;  
      
                                       HairFragment *hf=hpost->GetFragments(x,y,cnt,0);  
      
                                       if (bit8)  
                                       {  
                                            for (i=0;i<cnt;i++)  
                                            {  
                                                 col+=hf _.col*trans;  
                                                 trans=trans*hf _.trans;  
                                            }  
                                       }  
                                       else  
                                       {  
                                            for (i=0;i<cnt;i++)  
                                            {  
                                                 col+=hf _.col*trans*(1.0-hf _.trans);  
                                                 trans=trans*hf _.trans;  
                                            }  
                                       }  
      
                                       GeFree(hf);  
      
                                       bmap->SetPixel(x,y,col.x*255,col.y*255,col.z*255);  
                                  }  
                             }  
                        }  
      
                        bmap->Save(Filename("c:\\testme.tiff"),FILTER_TIF,NULL,0);  
                   }  
      
                   //m_pOldColorHook=hlib.SetHook(vps->doc,HAIR_HOOK_TYPE_SAMPLE_COLOR,(void* )_SampleHairColorHook);  
                   //hlib.SetHook(vps->doc,HAIR_HOOK_TYPE_SAMPLE_TRANS,_SampleHairTransparencyHook);  
                   //hlib.SetHook(vps->doc,HAIR_HOOK_TYPE_SAMPLE_SHADOWS,_SampleShadowBufferHook);  
                   //hlib.SetHook(vps->doc,HAIR_HOOK_TYPE_ILLUMINATE,_IlluminateHook);  
              }  
              else  
              {  
                   //hlib.SetHook(vps->doc,HAIR_HOOK_TYPE_SAMPLE_COLOR,m_pOldColorHook);  
              }  
         }  
      
         return RAY_OK;       
    }  
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/04/2007 at 02:28, xxxxxxxx wrote:

    Thanks David,

    this will be my starting point to implement it.

    Cheers :)
    Renato


Log in to reply