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

    Creating custom polygon normals

    SDK Help
    0
    6
    1.0k
    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

      On 09/02/2018 at 03:10, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R19 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      I know that I can call

      Vector32* normalsVal = m_actual_obj->CreatePhongNormals();
      for (int f = 0; f < m_actual_obj->GetPolygonCount(); f++) {
      normalsVal[f * 4 + 0] = Vector32(0, 1, 0);
      normalsVal[f * 4 + 1] = Vector32(0, 1, 0);
      normalsVal[f * 4 + 2] = Vector32(0, 1, 0);
      normalsVal[f * 4 + 3] = Vector32(0, 1, 0);
      }
      DeleteMem(normalsVal);

      But it drives me to a weird effect it still looks smooth (it is a human character) and the normal maps looks ok on the viewport and inverted on the render, or if I switch the normalmap channels that effect is switched (ok on the render but wrong on the viewport)

      Is there any other way to define the normals of my polygon object manually?

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

        On 12/02/2018 at 05:02, xxxxxxxx wrote:

        Hi,

        actually the way to go here is the use of a NormalTag. See also our NormalTag manual.

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

          On 13/02/2018 at 00:17, xxxxxxxx wrote:

          Thank you I figured that but unfortunatly after implementing that solution the problem persists.

          It seems to be related on how tangents and binormals are constructed inside C4D, I cannot manage to have normalmaps on viewport and render working ok, they always seem to be inverted in one of them (ok on viewport and wrong on render or viceversa)

          Regards, Víctor

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

            On 13/02/2018 at 05:12, xxxxxxxx wrote:

            Hello,

            can you provide us with more of your code? We have no idea yet, what's going on or where the cause of the issue could be located.

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

              On 14/02/2018 at 04:31, xxxxxxxx wrote:

              Unfortunatly I cannot share the code since it is related to a commercial project.

              I've faced this problem in the past in OpenGL when the UV tangents/binormals were not properly set but obviously I have no control over them in C4D.

              I'm just creating a polyobject and placing there the uvs, they look ok (diffuse etc are sharing the same uv channel) but the normals seems to be inverted.

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

                On 16/02/2018 at 02:09, xxxxxxxx wrote:

                As it was expected "Use UVW for Bump" fixes this effect but I'm not sure if it could affect third party renderers.

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