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

    Accessing normals via coffee script.

    SDK Help
    0
    2
    192
    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
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 22/10/2007 at 03:06, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9.52 
      Platform:   Windows  ;   
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hello.
       
      My problem is one discussed previously in some posts, but I put it on the table again because all previous posts were related to C++ plugins rather than coffee scripts inside C4D (9.52 in my case).
      My question: Is it possible to access the normals via coffee (face or vertex normals?) . CreatePhongnormals(...) does not work within the Script Manager.
      I would like to write an export plugin which respects the phong shading breaks and angle limits of the phong tag while exporting.
       
      Thanks!

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 18/03/2012 at 14:46, xxxxxxxx wrote:

        Man that's an old one. Anyway, maybe someone is interested into the solution here.
        You can calculate the face-normals yourself

        main(doc, op) {  
          var poly = op->GetPolygon(0);  
          var v1 = op->GetPoint(poly->a);  
          var v2 = op->GetPoint(poly->b);  
          var v3 = op->GetPoint(poly->c);  
          var v4 = op->GetPoint(poly->d);  
          var normal = vnorm(vcross(v3 - v1, v4 - v2));  
          println(normal);  
        }
        

        The vertex-normals are just the arithmetic middle between the face-normals of all ascending polygons.

        Cheers,
        -Niklas

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