Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Hair + Vray

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 413 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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;       
            }  
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post