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
    • Register
    • Login

    RayObject from link?

    Scheduled Pinned Locked Moved SDK Help
    10 Posts 0 Posters 736 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 28/04/2005 at 06:50, xxxxxxxx wrote:

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

      ---------
      I have an object link and I would like to know how to safely retrieve the according RayObject in a shader.

      Thank you
      Katachi

      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 28/04/2005 at 08:01, xxxxxxxx wrote:

        There is no direct way, you just need to go through all the ray objects (from VolumeData) to find it. If you need to repeat it many times you can of couse build an array you can search faster but for a one off just do the search at the start and store the RayObject pointer.

        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 28/04/2005 at 08:10, xxxxxxxx wrote:

          Thanks Dave. Pity perfomancewise but well, can´t have everything. 🙂

          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 28/04/2005 at 13:11, xxxxxxxx wrote:

            If you are accesing it lots then create a table to look them up quicker, if you are only accessing them at the start then it doesn't matter since it won't take much time to run through the objects. I can't see why you would be accessing them during rendering, if this is what I think it is for 🙂 you just need to know the RayObject pointers for that so you could fetch them at InitRender.

            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 28/04/2005 at 14:39, xxxxxxxx wrote:

              yes it is for what you think it is for 😉
              Thank you, that´s how I am doing it now.

              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 23/05/2005 at 09:13, xxxxxxxx wrote:

                Hi,

                I still have a problem here. The RayObject pointers of primitives and/or deformed objects in InitRender don´t seem to match the ones during rendering.

                Anybody an idea how to retrieve the correct rayobject for a primitive or deformed object for a baselink object?

                dorig     =     (BaseObject* )data->GetObjectLink(INST_MASTER,is->doc); if(!dorig) return LOAD_OK;  
                     orig     =     NULL;  
                  
                     if(is->vd)  
                     {  
                          VolumeData* vd = is->vd;  
                          for(LONG i=0;i<vd->GetObjCount();++i)  
                          {  
                               //Get RayObject  
                               RayObject* temp = vd->GetObj(i);  
                               if(temp->link==dorig)  
                               {  
                                        /*there are 3 objs in the scene and this condition is never true, which is quite impossible as it´s an object from within this scene. :) */  
                                    orig = temp;  
                                    break;  
                               }                 
                          }  
                     }
                
                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 23/05/2005 at 12:39, xxxxxxxx wrote:

                  Just a guess.. I think vd->GetObj(i) references an object in the cache of "dorig". It makes sense because generator objects store polygon geometry in their caches. And deformed objects store the deformed geometry in yet another cache.

                  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 23/05/2005 at 12:50, xxxxxxxx wrote:

                    Your guess was right. 🙂

                    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 23/05/2005 at 12:50, xxxxxxxx wrote:

                      As Michael said, the link from the rayobject will point to the cache, not the original document object which a baselink gives. You need to step through the cache until you find the original but this is not always possible. The cache is a complex beast!

                      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 23/05/2005 at 12:54, xxxxxxxx wrote:

                        thx Dave and Michael, you both helped me a lot. 🙂 (was fighting with this the whole day and just couldn´t understand the original object doesn´t match. I think this should be a side note in the docs for GetObj()!!)

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