Author Topic: Two technical questions: Exporting alpha and python  (Read 1619 times)

I have two semi technical questions that would be awesome to get some help on.

First one is about exporting textures. Is there a way to export a texture with control of what you pack in the alpha channel? When I export something with alpha this is what I get:


When I actually want this:

with this packed into the alpha channel of the texture:



Second one is about setting up proper dependencies when using python externally. So I am working on a tool that is basically a single button click baker that you run from Maya, exports the meshes, hooks them up in substance designer, and bakes all the maps. In my prototype I have a template .sbs file that I just replace the file locations and it works for now, however I am a little concerned about dependencies on a larger scale project. In the .sbs file all the resources get a uid#:
Code: [Select]
<group>
      <uid v="1257415565"/>
      <identifier v="Resources"/>
      <content>
        <resource>
          <identifier v="test_cage"/>
          <uid v="1257415566"/>
          <type v="4"/>
          <format v="fbx"/>
          <filepath v="Bake/test_cage.fbx"/>
          <lastModif v="2016-06-08T01:46:57"/>
          <checksum v="3cefe6ce3e2f5be6009f9b91df10b832"/>
        </resource>
        <resource>
          <identifier v="test_highpoly"/>
          <uid v="1257415567"/>
          <type v="4"/>
          <format v="fbx"/>
          <filepath v="Bake/test_highpoly.fbx"/>
          <lastModif v="2016-06-08T01:47:35"/>
          <checksum v="d27a54ff78587c25d5cf2b691185cad5"/>
        </resource>
        <resource>
          <identifier v="test_lowpoly"/>
          <uid v="1257415568"/>
          <type v="4"/>
          <format v="fbx"/>
          <filepath v="Bake/test_lowpoly.fbx"/>
          <lastModif v="2016-06-08T01:46:48"/>
          <checksum v="1d9c838d237a4c0ba331851500bcc6cf"/>
          <options>
            <option>

But I don't really know how that is generated, and I think it will be a problem having a bunch of sbs files with the same uid numbers as the other files. Is there a way to have substance create those uid numbers for me on the fly and to make sure they always stay unique across a large project? Or do they even have to always be unique across a project?

Thanks for any help!

First, you can use the RGB-A merge node to put something in the alpha channel of a texture.
As for the Python scripting, we are working on a Python API allowing you to generate substance files while handling uid correctly etc, but we have no ETA on when this will be made available yet.

Thanks for the info about the scripting stuff.

For the alpha problem I am using the RGB-A merge node.


I am using the latest SD 5.4 as well.

If I understand your alpha question correctly, the thing you want is actually what you already have. The alpha channel of an RGBA texture, when looked at alone, is really just the equivalent of a greyscale map with white as fully opaque and black as transparent.

If you're needing the A channel explicitly, try adding an output node to your material that is marked as usage "opacity" and connect it to the internal greyscale version of your alpha channel.