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 normal in channeldata

    Scheduled Pinned Locked Moved SDK Help
    13 Posts 0 Posters 961 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 15/10/2007 at 14:16, xxxxxxxx wrote:

      hmm, not sure what you are doing wrong but sd->n will give you the actuall surface normal (use sd->vd->n for the phong normal). Why should it crash? It´s just reading. Are you sure it´s not crashing at a different location? Definetly doesn´t make sense.

      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 15/10/2007 at 14:55, xxxxxxxx wrote:

        Thanks for your reply.

        I need the actual surface normal in world coordinates.
        When I load my shader into the color channel, the shader correctly returns the normal. But if I add an object with my shader as the material and I start rendering, Cinema crashes and wants to send informations to maxon.

        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 15/10/2007 at 15:06, xxxxxxxx wrote:

          Okay, it was my lightsource, generating the crash because I want to get the position of all light sources.

          Do you know how I can get the position of the global light if no lightsource is in my scene?

          > _
          > for(long i=0; i <bdata.numberOfLights; i++)
          > {
          > Vector light = sd->vd->GetLight(i)->link->GetMg().off;
          > }
          > _

          Thank you very much.

          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 15/10/2007 at 16:42, xxxxxxxx wrote:

            Hmm, I don´t know. The global light is actually two light sources that are always there. I assume they are in the list just like normal light objects, but I honestly don´t know as I never tried. 🙂 Searching the docs should do the trick maybe.

            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 08/11/2007 at 07:29, xxxxxxxx wrote:

              Hi!

              I am having a new problem with my plugin. Perhaps you can help me.

              > Vector cam = sd- >vd->GetRayCamera()->m.off;

              This gets a Vector to my active Camera in world coordinates. Now I need this vector in the local coordinates of my surface point.
              Is there a possibility to get this vector or do I have to transform my world-vector into this local coordinate system and how can I do this? Do I only need the transformation and rotation matrix of my surface point?

              Many thanks for your help!
              Manuel

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

                I am not quite sure what you mean. You could build a matrix around the surface point and multiply the global point with the inverted matrix to get a local point.

                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 12/11/2007 at 10:25, xxxxxxxx wrote:

                  Hi Matthias,

                  thank you for your reply. If I understand your answer correctly, I can't get a vector from my surface point to my camera without calculating the transformation matrix, right?
                  How can I get this transformation matrix?

                  Thank you,
                  Manuel

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

                    Ah, ok, to get a vector pointing from your surface to your camera is quite easy. You just subtract the surface point position from the camera position.

                    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 14/11/2007 at 05:25, xxxxxxxx wrote:

                      Yes, but that's not my problem. The vector I get if i subtract the global camera position from the global coordinates of the surface point is right, but if I rotate this surface, the vector is the same. If I do the same in local coordinates, the vector is not always the same because the local coordinate system changes and the surface normal has another direction.

                      I hope you understand what I mean, otherwise I'll paint a graphic to illustrate my problem.

                      Thank you very much for your patience.
                      Manuel

                      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 14/11/2007 at 05:53, xxxxxxxx wrote:

                        It seems you want to use the tangent space of a surface point. You can do this with the surface normal and the ddu, ddv vectors. So your tangent space matrix would look like this:

                        off = surface point position
                        v1 = ddu
                        v2 = ddv
                        v3 = surface normal

                        Use the GetDUDV() function to obtain the ddu, ddv vectors. Keep in mind ddu, dduv vectors depend on texture coordinates.

                        If this still isn't what you are looking for then please provide an illustration of your problem.

                        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 14/11/2007 at 06:09, xxxxxxxx wrote:

                          Hm, I not sure if this could be a solution.

                          My Problem:

                          If I rotate my surface, the vector to my cam is always the same vector. If you calculate the vector in local coordinates, it isn't because the local coordinate system is rotated around an angle theta, for example.
                          My surface normal now should be my local y-axis. Then I need a tangent and binormal I think. Or is there an easier way of getting my vector in local coordinates?

                          I hope my problem ist understandable. 😉

                          Manuel

                          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 14/11/2007 at 06:51, xxxxxxxx wrote:

                            Well, the problem for a 3D surface is that there just isn't only one defined local matrix for a surface point. There are several ways to build a local matrix for a surface point. You could use a fixed vector and build a matrix with the crossproducts of the surface normal and this fixed vector. Or use the tangent space vectors ddu, ddv.

                            Btw. what are you trying to achieve, maybe there is another better solution?

                            cheers,
                            Matthias

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