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

    Number of faces hit by ray in transparency shader

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 572 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

      On 18/07/2016 at 06:46, xxxxxxxx wrote:

      How can I know how many faces a ray has hit, when rendering?
      I'm talking about a shader that would be placed in the transparency channel of a material.
      Does the BaseVolumeData.raydepth helps somehow?
      What is the depth?
      The SDK only tells this:

      The depth of the actual ray.

      Not very informative.

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

        On 19/07/2016 at 01:50, xxxxxxxx wrote:

        Hello,

        indeed it seems that the "raydepth" is the number of intersections that happened before the ray in question hit the shader. You can easily test this by construction a scene with multiple reflections and the use the raydepth to define the output color of the shader.

        Best wishes,
        Sebastian

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

          On 19/07/2016 at 06:23, xxxxxxxx wrote:

          Thank you, Sebastian.
          So, "raydepth" could mean number of reflections so far or number of faces crossed, depending on the context (reflection or transparency channel)?

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

            On 20/07/2016 at 00:11, xxxxxxxx wrote:

            Hello,

            as it seems the number of intersections that happened before the ray in question hit the shader also includes refractions etc.

            best wishes,
            Sebastian

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

              On 20/07/2016 at 00:23, xxxxxxxx wrote:

              Ok, thank you.
              That will be enough for me, I think.
              I can find out if my shader calculation is being performed inside a specific channel, can't I?

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

                On 20/07/2016 at 08:34, xxxxxxxx wrote:

                Hello,

                I don't think so. The ShaderData.Output() function only receives the ChannelData argument and I think it does not contain any information on the context of the call. In fact, a shader can also be sampled not as part of a material but as part of an object (like in the "Displacer" deformer). In that case there would be no "channel" at all.

                For questions no longer related to the threads initial topic please open a new thread. Thanks.

                Best wishes,
                Sebastian

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

                  On 20/07/2016 at 08:46, xxxxxxxx wrote:

                  Thank you, Sebastian.
                  I will try to figure out by myself first but, if I get into trouble I will open a new thread.

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