SampleBump()



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

    On 15/03/2004 at 13:16, xxxxxxxx wrote:

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

    ---------
    I'm trying to get the new SampleBump()-Method to work...

    My test shader sets CHANNEL_DIRECTBUMP_EX in GetRenderInfo, and links to another shader (which is a simple noise shader)

    Output() basically reads as:

    Vector n_src, n_dst;  
    n_src = sd->n;  
      
    if (!shader) return n_src; //no shader available, return normal  
      
    n_dst = !(n_src + shader->SampleBump(sd, 0)); // ! = normalize result   
    // the PLUS after n_scr... is swallowed by the forum software!  
      
    return Vector(n_dst);
    

    shader ->Sample(sd) works just fine, so I guess that shader is initialized correctly. However, SampleBump doesn't change a thing :-(

    Any ideas anybody? My two recent questions stayed without any comment, let's hope that somebody cares for this one. It's incredible frustrating crumbling on such basic stuff due to very basic documentation and no examples for this new function at all :-(

    Kabe

    P.S.: Even if it is a silly question: How to get the UV orientation of the map at the sample location?



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

    On 10/11/2006 at 20:36, xxxxxxxx wrote:

    I'm interested too :)

    Cheers
    Renato



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

    On 11/11/2006 at 08:18, xxxxxxxx wrote:

    Quote: Even if it is a silly question: How to get the UV orientation of the map at the sample location?
    >
    > * * *
    >
    >
    >
    >
    > * * *

    You can get the DU/DV vectors for the orientation matrix with GetDUDV().

      
    Vector ddu, ddv;  
    vd- >GetDUDV(vd->tex, vd->p, vd->n, vd->orign, vd->lhit, TRUE, &ddu;, &ddv;);  
    

    Instead of vd->n you can use also vd->bumpn for the bumped normal. As for your question about SampleBump(), I have to check this myself first. Will let you know when I know more. BTW. I would recommend to not use CHANNEL_DIRECTBUMP_EX anymore, it is only for legacy reasons.

    cheers,
    Matthias



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

    On 21/11/2006 at 01:29, xxxxxxxx wrote:

    ok, got a solution how to get SampleBump() to work. You have to set the ddu and ddv parameters of the VolumeData first, SampleBump() needs them. Here a modified Output function of the SDK BitmapDistortion shader:

    Vector BitmapData::Output(PluginShader *chn, ChannelData *cd)  
    {  
         if (!shader) return 1.0;  
      
         if(!cd->vd) return 1.0;  
      
         Vector ddu,ddv;  
      
         cd->vd->GetDUDV(cd->vd->tex, cd->vd->p, cd->vd->n, cd->vd->orign, cd->vd->lhit, TRUE, &ddu;, &ddv;);  
         cd->vd->ddu = ddu;  
         cd->vd->ddv = ddv;  
      
         Vector res=!shader->SampleBump(cd,SAMPLEBUMP_MIPFALLOFF);  
      
         return (res+1)/2;  
    }
    

    this code outputs the deltanormals of the sampled shader, for instance a noise shader.

    cheers,
    Matthias



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

    On 21/11/2006 at 01:30, xxxxxxxx wrote:

    Thanks :)

    i'll make some test soon.

    Cheers
    Renato T.



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

    On 22/05/2007 at 03:37, xxxxxxxx wrote:

    To Maxon Support:
    You should consider to put things like this post in SDK documentation. Any way, thanks a lot, i was looking for that kind of info.


Log in to reply