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
    • Recent
    • Tags
    • Users
    • Login

    BackfaceCulling & Non-planar Polys

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 393 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 29/04/2011 at 19:33, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:      Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      BackfaceCulling() is not accurately telling me whether a non-planar poly is displayed. It works fine for planar polys.

      The normal passed to BackfaceCulling() is calculated using CalcFaceNormal(). Its orientation is the same as the normal displayed in the editor for a selected poly.

      Below is a non-planar poly at its Backface Culling visibility threshold for the scene camera (within 0.001°). The normal for switching backfacing visibility should be vertical in this view.

      How is this normal internally calculated by C4D?

      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 02/05/2011 at 06:57, xxxxxxxx wrote:

        I would triangulate the mesh for exact results.

        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 04/05/2011 at 07:11, xxxxxxxx wrote:

          Thanks for the tip, I think this has put me on the right track.

          I've triangulated several quads and have found that a correctly oriented normal is derived from either one of the tris or the average of the normals of both tris.

          I'll post results as soon as I've had time to test further.

          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/05/2011 at 02:07, xxxxxxxx wrote:

            Okay, I've worked it out.

            Instead of triangulating a quad, I'm creating two matrices. The first is derived from poly.a, poly.c and poly.d. and the second from poly.a, poly.b and poly.c. The 'normals' are the Z axes of the matrices.

            Two normals determine whether a non-planar poly is backfacing: the normal from the first matrix, and the average of this and the other normal. When both are pointing away from the camera, the poly is hidden. If either is pointing towards the camera, the poly is displayed.

            BackfaceCulling() will determine whether a normal is pointing towards the camera. A normal's threshold angle in perspective camera space varies with poly position. In this case, the 'face center' position passed to the function must be correct.

            The position passed with the first normal is averaged from its 3 matrix points. The position passed with the second normal is averaged from poly.a and poly.c.

            All values are calculated in global space before being converted to camera space.

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