CINEVERSITY

    Maxon Logo
    • Login
    • Search
    • Recent
    • Popular
    • Users
    • Groups

    Shadow to Vertex map

    Question & Answers
    xpresso vertex map light c4d cinema 4d
    2
    13
    1241
    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.
    • M
      Michal Rodzinski last edited by Dr. Sassi

      Hi
      Is there a way to transmit shadow information from a light source to vertex map? Phyton or expresso?
      Like in this plugin:
      https://cinemaplugins.com/c4d-plugins/topology-vertex-maps/
      But this plugin is unsuported in cinema 4d 2023.

      I need this to create shader inside Octan.

      I tried this method:
      https://www.cineversity.com/forums/viewthread/2374/
      but it’s not working as I expected. It illuminates the entire object if it’s in the light range.
      Thank you for your help.
      Michal

      1 Reply Last reply Reply Quote
      • Dr. Sassi
        Dr. Sassi last edited by

        Hi Michal,

        Yes, the solution with the R18 file was based on the idea of what is hit by the light, which is more or less like what can be done with a Cone Field if a spotlight is in use. In other words, that was not render-based.

        Shadows are not that simple, as they can be based on several things. Be that as it will, shadows are render based.

        If you like to have that shadow in a Vertex Map, I suggest baking the object's texture (Illumination) and using that in a Shader Field inside the Vertex Map.
        Example, baked and applied:
        https://www.dropbox.com/s/312f31yaloi7meb/CV4_2023_drs_23_TXvs_01.zip?dl=0

        What options are available in getting Shadow Data from a node is not my expertise, as I don't have an Octane license.

        All the best

        Dr. Sassi Sassmannshausen Ph.D.
        Senior Trainer, Maxon Master Trainer, L&D - Strategist
        Cinema 4D mentor since 2004, Member of VES, DCS.

        1 Reply Last reply Reply Quote
        • M
          Michal Rodzinski last edited by

          Hi Dr. Sassi,
          Thank you for your quick reply.
          I have another question based on firestone. I will also post some screenshots to make it clear.
          I'm trying to replicate the shader from Cinema 4d standalone Halfton pattern. In this shader, you can set the gradient ramp dependent on the camera or light source to get shading.
          where is a shadow the dots are bigger and where is light they get smaller. there is of course node (in Octane) "toon ramp" but it can be plugin only in two places
          and you can't use it as a gradient mask to set the size of the dots. The dots just decrease opacity but not size. As in this example:
          https://www.dropbox.com/s/0bk0yo0iz4e65ie/05.png?dl=0
          Think I'm close. I was able to fake that using OSL Shader which supposes to get a light vector but it didn't work.
          It can only give an object normal based on position so I move the axis point of an object to the position of the light.
          And It works but only if the object and light are static.
          https://www.dropbox.com/s/95e3xsitjgtl7xz/01.png?dl=0
          https://www.dropbox.com/s/jfkftwoet704mei/02.png?dl=0
          I need it to be dynamic. So baking is not an option.
          We're getting to the point where I thought vertex map could save me.

          Your method from the topic https://www.cineversity.com/forums/viewthread/2374/ is promising but I have one last question
          Can you set the vertex map so that if the point normal is between 0-90 degrees to the light source the vertex is 100% strength and if the angle is from 90 - 180 degrees the strength of the vertex map is 0%
          I hope my English is sufficient to make it clear 🙂

          What I was able to do is to set the linear fall of the light to get this effect but of course is not working with complex scenes. And it's working more like a 3d linear gradient that you can set manually.
          https://www.dropbox.com/s/jl2blo8l3wf35h1/06.png?dl=0
          Thank you.
          All The best
          Michal

          1 Reply Last reply Reply Quote
          • Dr. Sassi
            Dr. Sassi last edited by Dr. Sassi

            Hi Michal,

            To keep the forum readable, new questions need to have a new thread; otherwise, it becomes an endless text. Thanks for considering this in the future.

            I'm unfamiliar with OSL shaders in Octane; as I mentioned, I have zero access to Octane. Perhaps check any related Octane Forum.

            You can bake an image sequence and use this. My understanding of the target here is a rendering. In that way, most parts inside a project can be backed, cached, or expressed somehow.

            A Vertex Map has no idea about its Normal direction, nor is there anything that defines the position inside of a given Vertex Map.
            This needs to be taken from the Point Position and the Light Position. But what happens if one uses a Normal Map? The orientation changes at that moment. A few variables need to be known first to find (perhaps) a solution, but it is more complete than that.
            This is not a straightforward situation. Think about Area lights, parallel lights, different shadow qualities with their edge definitions, etc., not even think how a few lights in concert will work.

            All the best

            Dr. Sassi Sassmannshausen Ph.D.
            Senior Trainer, Maxon Master Trainer, L&D - Strategist
            Cinema 4D mentor since 2004, Member of VES, DCS.

            1 Reply Last reply Reply Quote
            • M
              Michal Rodzinski last edited by

              Hi,
              I will post new questions in new threads in the future. sorry for the mess.
              Thank you for your time explaining what is possible.
              best regards
              Michal

              1 Reply Last reply Reply Quote
              • Dr. Sassi
                Dr. Sassi last edited by Dr. Sassi

                Thanks for understanding, Michal.

                (No need for any sorry here, but thanks for the thought.)

                I believe we like to find something when we go to any forum. I try to make it as easy as possible for anyone.

                BTW, have you tried to place the camera as a child of light (same position, etc.), so a Fresnel Shader will show the angle of the surface and how it changes? This can be backed, even as animation. Then you have the data.
                https://www.dropbox.com/s/gkqbhf65fucqaoa/CV4_2023_drs_23_TXfv_01.zip?dl=0
                Note that the "Use Camera Vector" is enabled; Fresnel needs that.

                Cheers

                Dr. Sassi Sassmannshausen Ph.D.
                Senior Trainer, Maxon Master Trainer, L&D - Strategist
                Cinema 4D mentor since 2004, Member of VES, DCS.

                1 Reply Last reply Reply Quote
                • M
                  Michal Rodzinski last edited by

                  Thanks,
                  Have a nice weekend.

                  1 Reply Last reply Reply Quote
                  • Dr. Sassi
                    Dr. Sassi last edited by

                    You're welcome, Michal.

                    Enjoy your weekend as well.

                    Dr. Sassi Sassmannshausen Ph.D.
                    Senior Trainer, Maxon Master Trainer, L&D - Strategist
                    Cinema 4D mentor since 2004, Member of VES, DCS.

                    1 Reply Last reply Reply Quote
                    • Dr. Sassi
                      Dr. Sassi last edited by Dr. Sassi

                      P.S.: I hope this helps a little bit, as these are the closest I can find that brings shows some surface angle into the game to create a specific result.

                      https://github.com/redshift3d/RedshiftOSLShaders/blob/main/Iridescence.osl
                      https://github.com/redshift3d/RedshiftOSLShaders/blob/main/Flakes.osl

                      Dr. Sassi Sassmannshausen Ph.D.
                      Senior Trainer, Maxon Master Trainer, L&D - Strategist
                      Cinema 4D mentor since 2004, Member of VES, DCS.

                      1 Reply Last reply Reply Quote
                      • M
                        Michal Rodzinski last edited by

                        Hi,
                        I solved my problem getting "shadow to vertex map"
                        It's not perfect but it is in real time and that's enough for me for now.
                        I modified a little bit of your expresso and connect point normal to plight normal.
                        https://www.dropbox.com/s/onj94slaskbw57t/07.png?dl=0
                        I hope it's not a bug 🙂
                        Thank you for all your help
                        I will test it with a shader and post some results.
                        Best regards

                        1 Reply Last reply Reply Quote
                        • Dr. Sassi
                          Dr. Sassi last edited by

                          Hi Michal Rodzinski,

                          Yes, that is an option for self-shadowing to a certain degree.

                          The Normal of a Plane point will be 0, 1, 0 even if you take the object axis and rotate the object.
                          The Normal direction inside of a hole (e.g., Donut) might have Normals that point to the light but would receive shadow from itself.

                          The Normal idea is excellent if these limitations are not in the way.
                          Also, this is not an option to evaluate the received shadow from a different object.

                          I would say it is the way it works, not a bug.

                          Anyway, I hope that works for you.

                          Cheers

                          Dr. Sassi Sassmannshausen Ph.D.
                          Senior Trainer, Maxon Master Trainer, L&D - Strategist
                          Cinema 4D mentor since 2004, Member of VES, DCS.

                          1 Reply Last reply Reply Quote
                          • M
                            Michal Rodzinski last edited by

                            Hi Dr. Sassi,
                            I want to share what I have done with the vertex map technique and resolve one problem with this solution.
                            https://youtu.be/-w2yPYcm8SY
                            What I have now is for my sufficient. I think I don't need complex self-shadowing because as you can see in the example there is a solid black toon shadow,
                            that covers this area of the model.
                            But there is one problem.
                            There are two options connecting to Plight

                            1. if from node "Point" I connect Point normal to Normal in Plight - Light rotation is working, moving object is working, rotating object is not working;
                            2. if from node "Point" I connect Point position to Normal - Light rotation is working, Moving object is not working, rotating object is working;
                              and in both cases, deformers don't work.
                              here is a screen capture:
                              https://www.dropbox.com/s/nvckyml24lzzjj8/Desktop%202023.02.10%20-%2013.01.34.01.mp4?dl=0
                              this is the moment I hit the wall - is there any solution to resolve this problem?
                              I'm asking because I will use it on animated characters.
                              thank you for all your help
                              All the Best.
                            1 Reply Last reply Reply Quote
                            • Dr. Sassi
                              Dr. Sassi last edited by Dr. Sassi

                              Hi Michal Rodzinski,

                              The idea is to rotate the points around the axis but not the axis itself.

                              The position of each Point is based on the Object Axis. With this, the Normal is a Local idea. So you need to rotate the "surface" but not the axis. How to do that? Rotate Point from the X-Pool>System Presets> Matrix in XPresso.

                              Example:
                              https://www.dropbox.com/s/3wf6skt6a3w2xe6/CV4_2023_drs_23_XPvr_01.c4d.zip?dl=0
                              I have marked what can be moved and what can be rotated. Any derivation from that and the system is broken.

                              The "surface" can now be rotated or moved" while the Vertex Map is focused on the light source.

                              Since I have no file here, and screen capture nor images tell me that, I can only suggest/guess that you had in the Point Node, not the "Use Deformed Points" checked on.

                              =======

                              With that knowledge, you might use the Cluster Object to rotate the points around, while the Object that rotates the Point is a child of the Object, so it stays at Position 0, 0, 0.

                              My best wishes

                              Dr. Sassi Sassmannshausen Ph.D.
                              Senior Trainer, Maxon Master Trainer, L&D - Strategist
                              Cinema 4D mentor since 2004, Member of VES, DCS.

                              1 Reply Last reply Reply Quote
                              • First post
                                Last post