Home Adobe Substance

Substance Painter 1.3 MikkT tangent basis

triangle
Offline / Send Message
Son Kim triangle
It not quite sync with MikkT Tangent basis yet. I tried the same the mesh and normal map in UE4.7.1. it looks perfect from all angles. You can download the file(tangent space normal map, low,high) to test here: https://copy.com/mQGH1aNYud0vaM1e

this was baked in Modo as OS normal map, converted to tangent space normal in Xnormal.

UE4.7.1. bff35704b133e26ee9afe009e402db76.jpg

SP 1.3 a56cde76106751ecf1c163562355a38c.jpg

Replies

  • venain
    Offline / Send Message
    venain polycounter lvl 12
    Just did a quick test myself. It appears to be synced to itself perfectly if you bake within painter, but not synced to anything else I tried (UE4 and Marmoset).

    I'd also love an option to dither textures on export so I can skip the photoshop conversion step.

    Update is awesome so far though!
  • WarrenM
    Yeah, I baked a test in Painter and it looks perfect in UE4 as well.

    WIP033.jpg
  • wes.sau
    Son Kim & venain, for your model are you exporting and importing the Tangents & Bitangents, or just Normals?
  • Son Kim
    Offline / Send Message
    Son Kim triangle
    wes.sau, Modo can't export tangents & bitangents. So for UE4 I just import Normals.

    @Warren, nice! I haven't tried baking within SP or SD, good to know it works. I think Jerc mention the viewport in 1.3 would sync to MikkT...

    I'll give baking in SP a try, though for many of my bakes I need to stick to modo because I use the round edge shader.
  • oblomov
    Offline / Send Message
    oblomov polycounter lvl 8
    Son Kim wrote: »
    I think Jerc mention the viewport in 1.3 would sync to MikkT...

    It should work in 1.3, and it seems to work with some meshes, but apparently it's still not 100% perfect as you have found a problem with that test mesh from hell. It could be due to some changes done by Painter on the geometry to remove edge cases like 0-area triangles, counter-clockwise orientation or non manifold edges, because we just integrated the MikkT code without any change applied to it.

    Strange thing, I'm pretty sure we used the same mesh to double check that the tangent basis were correctly sync'ed. Maybe we did not look hard enough.

    Did you triangulate that mesh before exporting it ? We can only guarantee the tangent basis to be synced with triangle meshes, because we don't know how UE4 will split non-triangular polygons.
  • Son Kim
    Offline / Send Message
    Son Kim triangle
    oblomov,

    yup it's triangulated before exporting(you can download the file in my first post to test/check out). I understand syncing issue being not perfect at the start, I believe Marmoset 2 had the same issue with their initial support for MikkT.
  • venain
    Offline / Send Message
    venain polycounter lvl 12
    Yes - Tangents and binormals on a triangulated mesh.

    Normal appears perfect within painter itself, but in marmoset and UE4 it does not. I'm attaching an image comparing an xnormal bake (with compute binormal in the pixel shader option ON) vs painter. This is in the marmoset viewport, but the same issues happen in unreal.

    This is a cube with a single smoothing group and a single uv island.

    PainterTest.jpg
  • Son Kim
    Offline / Send Message
    Son Kim triangle
    @venain, confirmed! It looks perfect in SP but it's not sync to UE4.7.2.

    I don't have any textures to hide any error. The reflections should be flat.

    Compare_Bakes.jpg
  • Froyok
    Offline / Send Message
    Froyok greentooth
    With which file format did you do your tests ?
    Can you try with an obj file (triangulated of course) ? Just to be sure there is no tangents/binormals in the file before importing it in Painter.
  • Son Kim
    Offline / Send Message
    Son Kim triangle
    I just tried it with a OBJ, same deal looks perfect in SP viewport but doesn't sync with UE4.7. OBJ actually looks worse than FBX for some reason. Modo does not export tangents and binormals.

    Test2.jpg
  • Froyok
    Offline / Send Message
    Froyok greentooth
    Indeed, neither Designer or Painter seems to be perfectly sync. I have reproduced the issue on my side, we are currently looking into it.
  • oblomov
    Offline / Send Message
    oblomov polycounter lvl 8
    So after investigating, it appears that Designer and Painter are in fact using MikkTSpace properly but it is not sufficient to be synced with Unreal 4 : UE4 computes the binormal of its tangent basis per fragment instead of per vertex like we supposed every engine would do (because it's cheaper).
    There is an option to set that in the XNormal MikkTSpace plugin. It is conveniently set by default to "compute binormal in pixel shader" so that it works by default with UE4. If you set it off you will get the same result you currently get with Designer/Painter. We'll have to expose that option also in Designer and Painter (and set it by default to "on").
  • Son Kim
    Offline / Send Message
    Son Kim triangle
    oblomov wrote: »
    So after investigating, it appears that Designer and Painter are in fact using MikkTSpace properly but it is not sufficient to be synced with Unreal 4 : UE4 computes the binormal of its tangent basis per fragment instead of per vertex like we supposed every engine would do (because it's cheaper).
    There is an option to set that in the XNormal MikkTSpace plugin. It is conveniently set by default to "compute binormal in pixel shader" so that it works by default with UE4. If you set it off you will get the same result you currently get with Designer/Painter. We'll have to expose that option also in Designer and Painter (and set it by default to "on").

    Indeed I have "compute binormal in shader" ON,per UE4 documentation recommendation. Any idea when we can see a fix for this?
  • Froyok
    Offline / Send Message
    Froyok greentooth
    For Painter we should have an update in one or two weeks (along a number of other fixes).
    For Designer, giving an ETA is complicated as we will have to update multiple things inside Designer. We can't simply switch the computing, we need to update the bakers and the shaders but keep some compatibility at the same time for other users and other tangent spaces (such as Unity). We will do our best to give a proper solution as soon as possible.
  • ericktjoe
    Offline / Send Message
    ericktjoe polycounter lvl 4
    I haven't compared any of them with sp because I only evaluated sd. If you look carefully in latest unreal doc for fbx workflow, you must uncheck binormal when exporting to fbx. The latest unreal has used MikkT and I didn't find any issue with normal map between sd and unreal.

    I've noticed that you haven't split your uv where you used hard edge. Maybe this can be the cause for your issue. Try it.
  • Son Kim
    Offline / Send Message
    Son Kim triangle
    ercktjoe,

    uncheck "tangents and binormals" was a reference for exporting out from a 3D app, AFAIK that's different from turning ON "compute binormal in pixel shader" for Xnormal,which is still recommend by the Unreal Engine programmer.

    In a sync workflow you won't need to split UV at hard edges, beside I don't have any hard edges for both of my example, they both use 1 smoothing group,which should work if it was properly sync. If you try to bake the same cube example with 1 smoothing group and cross UV in SD, you'll probably get a normal error in UE4 too.

    Anyway, as Froyok mention this issue will be resolve in the next update to SP.

    edit: it might be fix already in 1.3.2? I'll have to run some test tomorrow.

    "[Bakers][3D View] Use Mikkt tangent space computation if no tangents/binormals are found"?
  • Froyok
    Offline / Send Message
    Froyok greentooth
    No, it's not fixed in 1.3.2.
    The part of the changelog you mention only means we changed our custom tangent space to mikkt. We still perform the computation in the vertex shader, which makes the sync not correct for the moment.
  • ericktjoe
    Offline / Send Message
    ericktjoe polycounter lvl 4
    Ah i see what you mean Son Kim. I'll try to generate the issue and see it as well because normal map is important for me. My trial has expired, I need to buy it tomorrow. Thanks mate.
  • Dethling
    Offline / Send Message
    Dethling polycounter lvl 11
    I had the same issue but maybe find a way around it (it's surely not the best way).
    When opening the exported normal map from Substance Painter in PS I recognize the pixel densitiy was odd (72,099999 px/zoll).
    I opened a new document with a normal ration (e.g. 72 px/zoll) and dublicated the SP Normal into it.
    After saving this new file as .tga the issue was gone.

    Screenshots are from 3Do with normal map only.

    With .png file direct from Substance Painter
    screen01_by_dethling-d8mk24z.png?1

    Normal map copied to .tga file with 72 px/zoll resolution:
    screen02_by_dethling-d8mk25w.png

    Still not perfect but much better, or not ?
  • dzibarik
    Offline / Send Message
    dzibarik polycounter lvl 10
    @Dethling better but still doesn't look good. Basically every border edge looks wrong and it can be fixed by baking with hard edges, split UVs etc etc but synced workflow is about getting good results without going through all these motions.
  • ericktjoe
    Offline / Send Message
    ericktjoe polycounter lvl 4
    @Dethling maybe flip the green channel?
  • Dethling
    Offline / Send Message
    Dethling polycounter lvl 11
    Thanks for the tip. Tried this on one of my test-models and it worked. :)
    It's official: I'm a normal-map noob. :)

    I also improved the quality a little by baking directly to .tga and removing the alpha channel with PS.
Sign In or Register to comment.