Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Shader plugin & object

    Cinema 4D SDK
    4
    7
    1.0k
    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.
    • Y
      yac4duser
      last edited by m_adam

      Hi,
      Is it possible to create a shader plugin (ShaderData) that modify the object structure ? I saw an example like this using a different software few years ago but I can’t remember where…
      For instance, if I have a cube and apply a material using this shader it will change all quad polygons into triangles only during the render (... + maybe inside the viewport if possible)

      Thank you

      1 Reply Last reply Reply Quote 0
      • P
        PluginStudent
        last edited by

        In computer science, there are vertex shaders, geometry shaders, and tesselation shaders, which change an object's vertices or the object's geometry.

        Cinema 4D's ShaderData is only a pixel (or fragment) shader. AFAIK, there are no vertex, geometry, or tesselation shaders in C4D.

        1 Reply Last reply Reply Quote 0
        • Y
          yac4duser
          last edited by

          Thank you @PluginStudent for your answer ! very instructive 🙂
          I found this

          showing a kind of real-time boolean shader (Geo clip shader)
          So, since C4D allow only pixel/fragment shaders, I wonder how this one was done ?

          1 Reply Last reply Reply Quote 0
          • ferdinandF
            ferdinand
            last edited by ferdinand

            Hi,

            this was done in Arnold, so Cinema has not much to do with it, but it would also be possible to some degree in Cinema.

            As you can see in the video, this is a render time only effect, no geometry is being modified. The way I would go about implementing this would be to intersection test the point you are currently rendering with whatever geometry you want to use as your cutting surface and either let the ray pass or not pass depending on the outcome.

            In Cinema you could access that initial point to intersection test by getting the ray-intersection point in object space via the passed VolumeData of the ray your shader is currently being polled for. If you want your cutting geometry to be an arbitrary polygon mesh you will have to raycast between our point and that mesh. A much easier solution is to just allow a handful of SDF primitives as cutting geometry. You could then just pass your intersection point into that SDF, if it is smaller than zero, you would let the ray pass, if not, you would not. The passing or not part could be achieved by putting the shader in the alpha channel and let it return black and white as its output.

            But this would not let you generate the intersection surfaces of the intersected mesh (for meshes that have some kind of "shell" geometry with a thickness). While computing these intersection surfaces is not that hard, especially in the for SDF case, integrating the results with a raytracer you only have 3rd party access to, is not. A relatively easy solution would be to return a solid color for these surfaces instead of trying to emulate/redirect the shading of these points. But this would still require more than a simple shader in the alpha channel in Cinema.

            Cheers,
            zipit

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 1
            • Y
              yac4duser
              last edited by

              thank you very much @zipit !! your answer gave me a lot of ideas 🙂

              1 Reply Last reply Reply Quote 0
              • ManuelM
                Manuel
                last edited by

                hi,

                I've been looking at one possible solution but found nothing yet. As said before, you can't do that in our shader system.

                Creating your own material could help more, but you only have the displace function that only displace the points and do not change the object.
                Creating the subdivision is not possible neither.

                I will check if i find something but that could take time.

                Cheers,
                Manuel

                MAXON SDK Specialist

                MAXON Registered Developer

                1 Reply Last reply Reply Quote 0
                • Y
                  yac4duser
                  last edited by

                  I have time and you have my attention sir Manuel! I'm looking forward for this 🙂
                  I think adding this feature to C4D will be a good improvement... at least, for those who are interested in.

                  Thank you again

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