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
    • Recent
    • Tags
    • Users
    • Login

    object position in shader

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 476 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 20/10/2009 at 00:50, xxxxxxxx wrote:

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

      ---------
      Hi there,

      in a shader plugin i am trying to get the position of all objects in a scene, to do some further calculations. I am doing it this way:

      > `

        
      \>  if (volumeData)  
      \>  {            
      \>  RayObject *parent = volumeData->op;  
      \>  if (parent)  
      \>  {  
      \>  oC = volumeData->GetObjCount()-1;  
      \>  for (int i=0;i<oC;i++)  
      \>  {  
      \>  rObj = volumeData->GetObj(i);  
      \>  p1 = rObj->mp;  
      \>  p2 = parent->mp;   
      \>  //using p2 works and gives some colors, but p1 returns black  
      \>  value += p2/10000;   
      \>  }  
      \>  return value;  
      \>  }  
      \>  }  
      \>  
      

      `

      any ideas what i am doing wrong ? Thanks in advance for your input

      cheers,
      Ello

      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 20/10/2009 at 01:36, xxxxxxxx wrote:

        i tried this one, too, just to check
        _
        BaseObject *rObj = volumeData- >GetObj(i)->link;
        if (rObj) value.x = 1.0;//rObj->GetPos().x;
        else value.y = 1.0;
        _
        the objects are rendered red, so the rObj is found. but using rObj->GetPos().x; gives only black..

        but why?? i dont understand

        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 20/10/2009 at 03:19, xxxxxxxx wrote:

          You should get the position through the rayobject's matrix for instance.

          Something like this works (spherical gradient from the world orign) :

          > \> Vector MandelbrotData::Output(PluginShader \*chn, ChannelData \*cd) \> { \>      if (cd->vd && cd->vd->op) \>      { \>           LReal len = Len(cd->vd->op->mg.off); \>           return LClamp(0.0, 1000.0, len) / 1000.0; \>      } \> \>      return 0.0; \> } \>

          cheers,
          Matthias

          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 20/10/2009 at 04:59, xxxxxxxx wrote:

            ah.. ok, that seems to work.

            thank you

            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 20/10/2009 at 12:03, xxxxxxxx wrote:

              hi again, i need a little advice on what is wrong here. i want to check, wether objects have other objects nearby, but its not working. here is my snippet, where is my fault?

              > `

                
              \>  RayObject *parent = volumeData->op;  
              \>  if (!parent) goto endit;  
              \>  pPos = parent->mg.off;  
              \>  LONG oc = volumeData->GetObjCount();  
              \>  for (int i=0;i<(oc-1);i++)  
              \>  {  
              \>  RayObject* robj = volumeData->GetObj(i);  
              \>  if (Len(pPos - robj->mg.off)<100) result = 1.0;  
              \>  }  
              \>  return result;  
              \>  
              

              `

              i was thinking that with this shader every object that has another object in the 100 units range should be whitem but well, it isnt working like that.

              thanks for your help,
              ello

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