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

    Getting the object the shader is attached

    Scheduled Pinned Locked Moved SDK Help
    9 Posts 0 Posters 878 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 31/08/2007 at 04:52, xxxxxxxx wrote:

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

      ---------
      Hi,

      I have a volumetric shader and I would like to know if there is a way to retrieve the RayObject that the shader is attached to and is calculated for in CalcVolumetric?

      When there are intersecting objects vd->op always returns the object the exit point of the span belongs to and not the object that the shader is attached to.

      so any chance to get that RayObject?

      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 07/09/2007 at 07:32, xxxxxxxx wrote:

        Is there a way to retrieve it safely or not?

        Thanks

        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 13/09/2007 at 00:07, xxxxxxxx wrote:

          I have no idea, will have to ask the developers.

          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 13/09/2007 at 03:36, xxxxxxxx wrote:

            thx. I´ll be waiting.

            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 18/09/2007 at 03:19, xxxxxxxx wrote:

              A shader could be attached to several objects. How should that work in your case?

              Couldn't you go through all RayObjects and check for their materials?

              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 18/09/2007 at 05:57, xxxxxxxx wrote:

                Yes, my shader is attached to several objects, that is the reason why I want to know the currently evaluated rayobject!

                What would going thru all RayObjects help actually? If I find 3 objects with the according material, how do I know which object is currently the intersection object in CalcVolumetric? There´s no RayObject I could check against. That´s the problem I am trying to solve.

                When the currently evaluated ray hits the object (A) my shader is attached to then CalcVolumetric is called for my shader (so I know my object has been hit for sure) and there is another object (B) inside of it, then vd->op is filled with the other object (so as I said, the span exit point). See the drawing below.

                But there is no way to retrieve Object A, so the object that *has* been hit and which my shader is attached to and for which my shader is called for, but no info about it??? So I think there must be a way to retrieve the RayObject. Maybe in InitRender?

                But I don´t understand what going thru the rayobjects with my material should help, due to not knowing what to compare these found Rayobjects to.

                ********* Ray *********  
                               /  
                     OBJECT A / = ?  
                      ------------  
                     |      /   
                -----|---- /   
                |    |   |/     
                |     ---|--------  
                |        |  
                ---------  
                OBJECT B = vd->op
                

                Is it clearer now and is there a way to retrieve the hit object, which my shader is actually attached to.

                thx!

                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 24/09/2007 at 03:12, xxxxxxxx wrote:

                  push, 3 weeks later and still no answer. I hope I don´t have to wait another week for an answer (to this simple question).

                  thx

                  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 24/09/2007 at 03:52, xxxxxxxx wrote:

                    Sorry for the delay.

                    Will this give you the correct RayObject?

                    RayObject *robj = NULL;
                    LONG local_id = 0;
                    robj = vd->ID_to_Obj(vd->lhit, &local;_id);

                    According to the developers lhit will give you the entry point RayObject.

                    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 24/09/2007 at 04:51, xxxxxxxx wrote:

                      thanks Matthias! I simply got impatient. 😉

                      I will try it this afternoon right when I am back (still in the uni).
                      But looks like the right thing! Darn, why didn´t that came to my mind?!

                      In any case, I´ll report back.

                      Sam

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