• Categories
    • Overview
    • News & Information
    • Cinema 4D SDK Support
    • Cineware SDK Support
    • ZBrush 4D SDK Support
    • Bugs
    • General Talk
  • Unread
  • Recent
  • Tags
  • Users
  • Register
  • Login
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
  • Register
  • Login

Changing Face Normal's Direction?

Cinema 4D SDK
r21 python
4
5
717
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.
  • B
    bentraje
    last edited by Aug 11, 2020, 8:51 AM

    Hi,

    Face normal's direction is computed automatically based on the average of the points, correct me if I'm wrong.

    Is there a way I can override it and compute it myself?

    Regards,
    Ben

    1 Reply Last reply Reply Quote 0
    • F
      ferdinand
      last edited by ferdinand Aug 11, 2020, 9:17 AM Aug 11, 2020, 9:17 AM

      Hi,

      the orientation of a face, i.e. the average of its point normals, is determined by the right-hand-rule of the cross product. Because of that, inverting the vertex order of a polygon will also flip its normal.

      Note that this order is primarily a geometric feature and not a sequential one. If you for example reflect the points of a polygon on some axis, you will also invert their geometric order by that. To have the resulting polygon to point into the same direction as the source, you will have to invert the vertex order of the polygon.

      I have shown most of this in an example for another question of yours.

      Cheers,
      zipit

      MAXON SDK Specialist
      developers.maxon.net

      1 Reply Last reply Reply Quote 1
      • B
        bentraje
        last edited by Aug 11, 2020, 1:34 PM

        @zipit

        Thanks for the response.
        But I think there is a misunderstanding.

        I just want to replace the face normal's direction.
        So somewhat an operation like this

        face_list = polygon_obj.GetFaces()
        for face in face_list: 
            face.normal = c4d.Vector(x, x,x) 
        

        There is a GetFaceNormal but it is on the SculptObject.
        Basically, I don't know how to access the face's normal and replace them with my own vectors.

        Here's also a demonstration of what I am after in Houdini:

        1 Reply Last reply Reply Quote 0
        • P
          PluginStudent
          last edited by PluginStudent Aug 11, 2020, 3:21 PM Aug 11, 2020, 3:20 PM

          Normal data is stored in a Normal tag. See NormalTag Manual.

          So you can create a (new) normal tag and store any new normal data you like.

          If you look around the forum you will find threads showing how to do that in Python, e.g. Handling direction of the normal tag.

          1 Reply Last reply Reply Quote 0
          • M
            Manuel
            last edited by Aug 12, 2020, 8:32 AM

            hi,

            everything have been said, nothing to add here 🙂

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            4 out of 5
            • First post
              Last post