Home Adobe Substance

Exporting from Substance Designer to Unity

polycounter lvl 6
Offline / Send Message
rorozilla polycounter lvl 6
Hey everyone!
I'm knee deep in learning Designer and Painter and I'm a little confused when it comes to exporting my assets to unity. I get strange results depending on the exporting method I choose.

Here it goes:
If I bake Normals using DirectX and export my outputs as textures. My normals look awful in Unity. Makes sense since I believe it uses OpenGL. BUT if I publish my substance and apply it in Unity to my model. Everything is fine... OK so Substance is cool and somehow adapts to Unity's settings. Publishing a substance and how it works in Unity is black magic to me. If there is any kind of info on how everything connects up, I would love to get my hands on it!

But here is the second BUT. If I decide to bake my normals using OpenGL in Designer, exporting the texture looks fine in Unity, but publishing the substance now look bad. I get the same result exporting my roughness maps. I think unity uses white as the roughest and black as glossy, which seams to be the opposite in Substance. again, publishing the substance to unity seams to work fine, but the moment I export a texture out of Substance Designer or Painter it give me opposite results.

How can I arrange my settings so that both export techniques work without having them flip like that?

Also, what are the pros and cons of using the publish substance feature into unity VS exporting the outputs and creating your own material?

Replies

  • rorozilla
    Offline / Send Message
    rorozilla polycounter lvl 6
    not to mention that the roughness never seams consistent form Substance to Unity. everything is always glossier in Unity
  • rorozilla
    Offline / Send Message
    rorozilla polycounter lvl 6
    Here is an example :

    On the left is what I get when I publish my substance, on the right is when I export the outputs as Targas and link them to a material appropriately.

    As you can see not only the normal are weird but the roughness is just completely off!

    Ps: The gray is not transparency, its simply the reflection of the unity environment.

    lkc767z.png?1
  • Jerc
    Offline / Send Message
    Jerc interpolator
    What version of Unity and what shader are you using?
  • rorozilla
    Offline / Send Message
    rorozilla polycounter lvl 6
    here is an example of the roughfness maps:

    On the left is the published substance, middle is exporting the outputs as bitmaps (TGA) and adding the maps to a new material, and the right is what it looks like in substance.

    Granted the lighting is different, but you can see its the opposite of what it looks like in unity. Also it seams that the roughness map didn't export at all on the Published asset.

    Any thoughts?


    A note: i do have to manually add the roughness map to my metallic map in Photoshop in order for it to display on my manually created material. Is there a way to force Substance to export the roughness map as the alpha of my metallic texture?

    V3MN90D.png
  • rorozilla
    Offline / Send Message
    rorozilla polycounter lvl 6
    Unity 5 and standard shader!

    Thanks Jerc for your swift responce! let me know if you need more clarification.
  • rorozilla
    Offline / Send Message
    rorozilla polycounter lvl 6
    And the plot thickens!

    So here you have a screenshot of my attempt to add my roughness to the alpha channel of my metallic texture in Substance Designer.


    1 is the result of publishing my substance in Unity
    2 is by exporting my textures as bitmaps (TGA) and merging the roughness by hand into my metallic's alpha in photoshop and creating Standard Shader material in Unity.

    They look the same! Yeah!!

    BUT:
    3 is what I see in Substance Desinger's 3D view now that my metallic and roughness are merged....

    So I now cant see my results in Substance but everything is starting to match up in unity expect for the fact that the roughness is still inverted from substance to unity, Even though you can really see it in this screen shot.

    I also still haven't figured out why my normals get reversed when i publish a substance.

    here is how I merged the alpha in case you where curious:
    A is my metallic texture
    B is my roughness
    C is a RGB-A merge node
    D is the output. you can see that set the format to RGBA, I added roughness to the usage and set it to A and made sure Metallic was set to RGB.

    Note: I did delete my original Roughness output, since I didn't think i needed it now that it was merged with Metallic.


    Thoughts, comments, suggestions are all welcomed!


    LJrGLFh.png
  • Jerc
    Offline / Send Message
    Jerc interpolator
    What beta build of Unity are you using?

    If you are using the latest RC, the packing and roughness inversion should be handled automatically when you import your substance in Unity, no need to do anything specific in Substance Designer.

    The Usage of an output in Substance Designer should always be set to RGBA with a single usage. Modifying this will most likely do nothing or make your substance incompatible with Unity or other engines. Best way to avoid mistakes is to use the PBR template and not modify the original outputs.
  • rorozilla
    Offline / Send Message
    rorozilla polycounter lvl 6
    Hello Jerc,

    I'm using an old version! Didn't notice, so i'll update right away and let you know how it goes.


    In the mean time, why is it that you have the possibility to add more then one usage? is there a time where it is needed?
  • Jerc
    Offline / Send Message
    Jerc interpolator
    We've added this possibility so that people doing their own engine integration can use it if needed, but it's not used in any of the current public integrations yet.
  • rorozilla
    Offline / Send Message
    rorozilla polycounter lvl 6
    ok, that make sense!

    I have a couple questions:

    A)
    is it supposed to mess up the 3D view in Designer when I do use more then one usage?

    B)
    Also is there any other way to export textures with special RGB-A values then to add a usage? because right now its the only way I found to make sure my Metallic/Roughness exports correctly using the "save output to Bitmap" option without having to manually add the roughness into Photoshop.


    thanks a bunch for all your help! :D
  • Jerc
    Offline / Send Message
    Jerc interpolator
    With the latest Unity version, the plugin takes care of shuffling everything and merging the roughness and metallic. If you want to merge the maps in SD, the RGB-A Merge node you used is the right way to do it, but you shouldn't have to touch the usage at all.

    Having multiple usages won't affect SD, but it may affect some integrations.
  • rorozilla
    Offline / Send Message
    rorozilla polycounter lvl 6
    Unfortunatly Jerc, I updated to Unity 5.0.0f3 and it did not change anything for me...it seams to be the latest but maybe you can tell me if there is a newer one? :C

    Here is the status on my problemes:

    1-My roughness still dose not get hooked in by default into the alpha channel of my metallic output.
    2-My rougness is still reversed ( what is shiny in SD is rough in Unity)
    3-And my normals still act strangely. If I bake them as OpenGL in SD, and publish them, they act as DirectX in Unity, and Vice Verca. But if I export them as Bitmaps, they behave as expected in Unity.

    Just an FWI, I don't add anything to the physically based template when I create my new substance, I use the baking system inside of SD to generate all my maps and I don't modify anything in the ouputes befor exporting. In unity, I use the standard shader whenever I need to create my own material. If I publish my substance, I just drag the material it generates onto my desired item in a scene to see the result. I do not modify any of the settings inside of Unity.
  • Uzziel
    Offline / Send Message
    Uzziel polycounter lvl 7
    Hi,

    1- By default Unity 5 Substance integration will adapt the "channel shuffling" to fit with selected shader convention.
    It means that if you use sbsar files, use the PBR metallic roughness template in SD (with "Standard" shader in Unity).

    Once you import your sbsar file in Unity, if you select the "Standard" shader (= PBR metallic smoothness), it will automatically place the invert of the roughness (= Glossiness, or Smoothness for Unity :) ) in the metallic alpha channel.

    If you need to work with bitmaps, let the outputs as they are in SD template (this way you get a correct preview in the 3D view), and use a "Channel shuffle" filter to place the invert of the roughness (= the Glossiness or Smoothness depending on how you call it) in your metallic alpha channel. Then you should get the same result.

    You can also work in "Standard (specular setup)", the Substance integration in Unity will behave in a correct way (just be sure to use the PBR specular glossiness template in SD).

    2- That's because Unity needs "Smoothness" (= Glossiness) in the Metallic alpha channel. It's the invert of the roughness, you can use an "Invert grayscale" node from the library to generate it from your Roughness.

    3- The normal map behavior is difficult to predict as it will not use what you set in Substance but invert it (if you use a sbsar only, not if it's a bitmap) to have the same result in SD and Unity. If you use the default value of the "Normal" filter in SD, the result will be correct in the 3D view and in Unity integration (as it will change the Normal format).
    Be sure you have something correct in SD 3D view (if you need to invert it, you can use a level with the green channel "level out low" and "level out high" values inverted, or the "Normal invert" filter if you use Substance 5.0), you should get a correct result in Unity (the invert).

    I made a small example you can download here.
  • rorozilla
    Offline / Send Message
    rorozilla polycounter lvl 6
    OK! Thank you so much Uzziel,

    Ok so I finally figured it out, thanks to you Uzziel, Its because I was using a colour node for my roughness, its a little weird that it would let you do it and show up in the 3D view if its not going to export properly.

    All I had to do to fix the Roughness is make sure it was set to Gray-scale!

    And like you said, It will invert on its own if I publish my substance so that my SD 3D view and my view-port in unity look the same!

    So when it comes to the Normals, there is really no way elegant way to tell the substance publisher not to reverse the normals? None the less, this is one of the minor problems I was having, I can easily fix it by baking in openGL whenever I need to export as bitmaps. I will be trying out substance 5 today and see if there are any new features that can help me with this, and also try out your "Normal invert" node!


    Thanks a bunch yall!
Sign In or Register to comment.