Results 1 to 7 of 7

Thread: MentalRay bug: incorrect tangent normal map calculation

  1. #1
    Join Date
    May 2016
    Location
    Germany
    Posts
    5

    Default MentalRay bug: incorrect tangent normal map calculation

    Hello,

    ps. i have no idea how to attach Images in a way they are not cropped, so please either click the link i supplied to see them or scroll the Image left-right to see the whole study screenshot.

    During our shader programming, we have spent weeks trying to understand why MentalRay sends us degenerated results when calculating normal maps.
    At first we have thought that our work was based on wrong calculations, until someone here came to the idea to test 3dsMax with a generic sphere and a simple tangent normal map. The result is quite disturbing. It is hard to explain what is happening, but if this is the way how MentalRay renders, than it is very certain our all images since 2012 are rendered with incorrect normal maps calculation.
    After double and triple checking all parameters, SDK, google and other software, we can only hope somebody here will shout "hey, press the x check-box then it works correct!".


    What software in this case delivers wrong results?
    - MentalRay (Max 2012-2016, very likely Maya too)
    What Software does correct calculations?
    - IRay
    - Vray, FinalRender, Scanline Renderer, Maxwell Renderer, Blender (all other renderes i own and can engange in 1:1 testing)
    What questions you may exclude for possible Error tracking?
    - Gamma (we have tested it with all vaules, it does not repair)
    - Flipping Axes (is not needed, since it would chage the result on both test obejcts: the original and the rotated)



    What is wrong with MentalRay tangent normal map calculation?


    Any user can very simply verify the correctness of the tangent map normal rendering. It is so obvious that almost no explanation is needed. Here are few steps how to test it:

    Step 1:
    Create a simple sphere, and light above it (or wherever).
    Assign Arch&Design or Standard Shader (better standard so you can switch to other renderer for verification) to it and add into Bump/Normal a Tangent Space normal texture (things you do million times a day)

    Full Image: http://www.3d-plugin.com/wp-content/...als_bug_01.jpg


    simple scene setup

    Step 2.
    Duplicate the object. Now, move it in the scene away, and translate it (Rotate around, move around, important is that the mesh has change the world space position and orientation). DO NOT Mirror it, just move and rotate it in the scene, away from 0,0,0. What you see in the Image below

    Full Image: http://www.3d-plugin.com/wp-content/...als_bug_02.jpg


    Copy and translate/rotate object

    Step 3.
    Render the scene with MentalRay.
    What you see is at the first glance a good image, until you look exactly at what has happened.
    On the copied and translated mesh, MetalRay has altered the look of the Normals. The Tangent are not correct anymore, the "cap" is on the original image "extruded, elevated", while the same area on the rotated object is inseted, dented. As if the normals were inverted, which they are apparently. This is actually wrong - after rotating object the "hills" should elevate outwards. Observe the copied mesh and look at this kind of "negative" tangent space values (or whatever MentalRay has calculated). This may look like a nice relief, yet after short thinking you will notice an absurd error.

    Full Image: http://www.3d-plugin.com/wp-content/...als_bug_03.jpg


    Copy and translate/rotate object

    Step 4.
    Change the renderer from MentalRay to Vray. Render the image and examine the results.
    You will prompt see that Vray has rendered the normal maps in correct way. The copied mesh does not have inverted tangent normals. The "cap" look of the normal map is in both cases "beveled".

    Full Image: http://www.3d-plugin.com/wp-content/...als_bug_04.jpg


    MetalRay - Vray comparison

    Step 5.
    I have re-rendered the same scene with all 4 Max Render engines i have:
    - MentalRay
    - Vray
    - FinalRender
    - Scanline
    All render engines save MentalRay have rendered the normal map on the translated object in correct way.
    (yes, i have tested with different gammas, resetXFroms, materials, lights, etc; it does not affect the incorrect output)

    Full Image: http://www.3d-plugin.com/wp-content/...als_bug_05.jpg


    MetalRay - Vray - FinalRender - Scanline comparison

    This is very weird!
    At the end, i have done the same thing in Maya 2016 Ext2 and rendered the scene with Maya MentalRay. And the things here start to get very strange: Maya makes suddenly the same error.

    Full Image: http://www.3d-plugin.com/wp-content/...als_bug_06.jpg


    MetalRay Maya 2016 Ext2

    This is almost paradoxical: we have been working since 2012 with wrong tangent map representation (I do not have Max2011 anymore, so i can't check if it goes deeper).

    Either no one cares about how his normal maps look like, or no one uses MentalRay at all. I hope the second is true. Otherwise you have already noticed that the wrinkels on your 3d characters face are inverted when you translate and rotate his head!

    Even if all 3d artists do not care how their NormalMaps look like on different randomized objects in the scene, what about game-designers? Have you baked normal maps with MR lately? Did you notice that render-to-texture (texture baking) with MentalRay delivers flipped, twisted and wrong Tangent Normal Maps, which make your realtime models look strange and wrong? All this is based on the core anomaly you have seen above. (my second bug Report will go into it in Detail, since it is another major brakedown - you can't get your work done in proper way).


    There is still a hope some technical guys here will point me at some fundamental logical error, otherwise you can trash the whole renderer.

    thanks for your inputs in advance!

    best regards
    Igor Posavec
    www.3d-plugin.com

  2. #2
    Join Date
    Dec 2004
    Location
    Marina Del Rey, California
    Posts
    4,143

    Default

    Could you please send the Maya scene and the max scene? Or minimally, the normal map.

    Tangent space normals are supplied by the application's shaders, so I'm very surprised that both 3ds max and Maya have the same issue. They have different routines to translate the tangent space normal into the actual normal used by the render. There must be something else going on with how the tangent space texture mapping to texture coordinates follows the transformation.

    But very difficult to debug without the scene. Or even just the tangent space normal map. i just did a similar thing with duplicate spheres in Maya and it worked fine. I didn't try baking, but it seems you had the issue prior to any baking right?

    What kind of shaders are you programming by the way? There is a place in this forum to talk about shaders. We could have helped you much earlier. Once we figure this out, I encourage you to let us help you write what you want to write. A lot of new techniques are being created, so we'd want you to keep up with that if your coding is in any of those new areas.

    P.S. The images I see are not cropped. Anyone's first post here needs to go through moderation, and perhaps that is what you ran up against.
    Last edited by bart; May 8th, 2016 at 01:33.
    Barton Gawboy

  3. #3
    Join Date
    May 2016
    Location
    Germany
    Posts
    5

    Default

    Dear Barton,
    thank you for your responce!

    We have packed both Scenes (Max+Maya) for you:
    http://cg-prototype.com:8000/f/26fb6a4684/

    Please load them, the results are, at least what max concerns, absolutely reproducable.

    To see the Video of how to easly reproduce it, please download this Video (MP4):
    http://cg-prototype.com:8000/f/2cad170501/

    In Max it is very obvious and there almost no doubt, in Maya, due to my inexperience, it may be some missing shader setting. Please use in doubt the reference Video i have attached.


    To your question: We have programmed/ported one of the most impressive fractal/procedural shader librararies to MaxMaya MR. We have been working on it for 2 years and the product was sale-ready. Everything is since 2015 finished and works, but we could never release it beacuse we could not solve the Tangent Normal Space calculation. We have written many many times to ADN, Sparks etc, delivered the emprical cases with code about what is wrong, yet no one sent us a responce. At the end we have freezed the production since it was, as our developer said, malfunctional on our side - we do not understand how MantalRay comunicates with Max and Exchange the data.
    But last week, due to a coincidence, we have stumbled over this anomaly, which actually shows that our calculations work perfect - but MR deviates the data.

    I hope you may have now a sharp eye and clear mind to recognise prompt what is wrong



    thanks!
    best regards
    Igor Posavec
    www.3d-plugin.com

  4. #4
    Join Date
    Sep 2016
    Posts
    5

    Default

    Any news about this? Today I was baking some normal map in 3dsmax 2016 with the scanline renderer. Switching to MR for rendering, I found the same problem: the normal bump of my low poly object was very strange (the result was not what I was expecting). Switching back to Scanline or Vray it worked great (without changing any other parameter, gamma, lights or material...).

  5. #5
    Join Date
    Mar 2017
    Posts
    1

    Default

    Same problem here:
    Untitled-5.jpg

  6. #6
    Join Date
    May 2016
    Location
    Germany
    Posts
    5

    Default

    Hello Nvidia, all,

    your last 2018 Version did not fix anything. It is still damaged. Mental ray still can not render normal maps. I am wondering how anybody can work in the year 2017 with a renderer without normal map Support?

    What a pity.

    best regards
    Igor Posavec
    3d-io

  7. #7
    Join Date
    Dec 2004
    Location
    Marina Del Rey, California
    Posts
    4,143

    Default

    Digging into this again, I am able to reproduce what you see. But in trying to isolate the issue, there are a few things to note.

    In the Maya scene, Use Default Lighting was on in the viewport, so that is why it didn't match. I switched to a simple plane mapped with your map, a directional light and Use All Lights instead of the Default Lighting. Then, I got a match between vp2 and mrvp, switching back and forth, moving the v offset, and rotating the uvs of the map. This picture shows a v offset of 0.8, very similar to the original 0.71, but the lighting now matches.



    So this leads back to trying to isolate perhaps the normal mapping shader in 3ds Max.
    Last edited by bart; May 22nd, 2017 at 22:25.
    Barton Gawboy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •