Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Lorin Atzberger 0

Pages: [1] 2
1
Hello

I'm using Automation Toolkit 2018.3.0

Somewhere in my code, I have the following line:
Code: [Select]
output = graph.createOutputNode(aIdentifier = identifier, aUsages = usages)usages is defined as:
Code: [Select]
{
pysbs.sbsenum.UsageEnum.HEIGHT: pysbs.sbsenum.ComponentsEnum.R,
pysbs.sbsenum.UsageEnum.METALLIC: pysbs.sbsenum.ComponentsEnum.G,
pysbs.sbsenum.UsageEnum.ROUGHNESS: pysbs.sbsenum.ComponentsEnum.B,
pysbs.sbsenum.UsageEnum.AMBIENT_OCCLUSION: pysbs.sbsenum.ComponentsEnum.A
}
This throws this error:
Code: [Select]
[ERROR][pysbs.api_decorators] Exception of kind AttributeError in pysbs.sbsgenerator, line 564: _resolveUsage()
[ERROR][pysbs.api_decorators] Exception of kind AttributeError in pysbs.sbsgenerator, line 623: createOutputNode()
[ERROR][pysbs.api_decorators] Exception of kind AttributeError in pysbs.graph.graph, line 1585: SBSGraph.createOutputNode()
Traceback (most recent call last):
  File "fixSbs.py", line 146, in <module>
    fixSbs(inputPath, outputPath)
  File "fixSbs.py", line 136, in fixSbs
    pysbs.sbsenum.UsageEnum.AMBIENT_OCCLUSION: pysbs.sbsenum.ComponentsEnum.A
  File "fixSbs.py", line 58, in createOutput
    output = graph.createOutputNode(aIdentifier = identifier, aUsages = usages)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pysbs\api_decorators.py", line 54, in wrapper
    return function(*args, **kwargs)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pysbs\graph\graph.py", line 1585, in createOutputNode
    aVisibleIf = aVisibleIf)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pysbs\api_decorators.py", line 54, in wrapper
    return function(*args, **kwargs)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pysbs\sbsgenerator.py", line 623, in createOutputNode
    outputUsages = [_resolveUsage(usg, usageDict) for usg, usageDict in aUsages.items()]
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pysbs\sbsgenerator.py", line 623, in <listcomp>
    outputUsages = [_resolveUsage(usg, usageDict) for usg, usageDict in aUsages.items()]
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pysbs\api_decorators.py", line 54, in wrapper
    return function(*args, **kwargs)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pysbs\sbsgenerator.py", line 564, in _resolveUsage
    colorspace = usageData.get(sbsenum.UsageDataEnum.COLOR_SPACE, None)
AttributeError: 'int' object has no attribute 'get'

I'm not sure why this happens because according to the documentation present here: https://docs.substance3d.com/sat/pysbs-python-api/api-content/substance-definition/graph
the usages argument is defined like this:
Code: [Select]
aUsages (dictionary {UsageEnum : ComponentsEnum}, optional) – usage of this output
This was working perfectly fine when I was using the Automation Toolkit 2018.1.0.

I also checked, and removing the argument will stop the error from being thrown.

Is this a bug or am I not using the API correctly?


2
Please check your PM
Thanks

3
Hello. Any news on this?

4
There are only 3 instances of the tile_random in the graphs and none of them use the background parameter or even the pattern input. I've verified this by looking at the xml as well and there's no mention of the background parameter there.

Code: [Select]
<compInstance>
<path v="pkg:///tile_random?dependency=1290776988"/>
<parameters>
<parameter>
<name v="y_amount"/>
<relativeTo v="0"/>
<paramValue>
<constantValueInt32 v="5"/>
</paramValue>
</parameter>
<parameter>
<name v="x_amount"/>
<relativeTo v="0"/>
<paramValue>
<constantValueInt32 v="2"/>
</paramValue>
</parameter>
<parameter>
<name v="shape_scale_random"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.00999999978"/>
</paramValue>
</parameter>
<parameter>
<name v="pattern_color_random"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="1"/>
</paramValue>
</parameter>
<parameter>
<name v="split_threshold"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.519999981"/>
</paramValue>
</parameter>
<parameter>
<name v="interstice_amount"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.099999994"/>
</paramValue>
</parameter>
</parameters>
<outputBridgings>
<outputBridging>
<uid v="1402602629"/>
<identifier v="output"/>
</outputBridging>
</outputBridgings>
</compInstance>

Code: [Select]
<compInstance>
<path v="pkg:///tile_random?dependency=1290776988"/>
<parameters>
<parameter>
<name v="y_amount"/>
<relativeTo v="0"/>
<paramValue>
<constantValueInt32 v="5"/>
</paramValue>
</parameter>
<parameter>
<name v="x_amount"/>
<relativeTo v="0"/>
<paramValue>
<constantValueInt32 v="2"/>
</paramValue>
</parameter>
<parameter>
<name v="shape_scale_random"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.00999999978"/>
</paramValue>
</parameter>
<parameter>
<name v="pattern_color_random"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.229999989"/>
</paramValue>
</parameter>
<parameter>
<name v="split_threshold"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.519999981"/>
</paramValue>
</parameter>
<parameter>
<name v="interstice_amount"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.119999997"/>
</paramValue>
</parameter>
<parameter>
<name v="pattern"/>
<relativeTo v="0"/>
<paramValue>
<constantValueInt32 v="10"/>
</paramValue>
</parameter>
<parameter>
<name v="pattern_specific"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.199999988"/>
</paramValue>
</parameter>
<parameter>
<name v="pattern_specific_random"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.170000002"/>
</paramValue>
</parameter>
<parameter>
<name v="pattern_rotation_random"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.909999967"/>
</paramValue>
</parameter>
<parameter>
<name v="pattern_symmetry_random"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.229999989"/>
</paramValue>
</parameter>
</parameters>
<outputBridgings>
<outputBridging>
<uid v="1402602629"/>
<identifier v="output"/>
</outputBridging>
</outputBridgings>
</compInstance>
Code: [Select]
<compInstance>
<path v="pkg:///tile_random?dependency=1290776988"/>
<parameters>
<parameter>
<name v="y_amount"/>
<relativeTo v="0"/>
<paramValue>
<constantValueInt32 v="5"/>
</paramValue>
</parameter>
<parameter>
<name v="x_amount"/>
<relativeTo v="0"/>
<paramValue>
<constantValueInt32 v="2"/>
</paramValue>
</parameter>
<parameter>
<name v="shape_scale_random"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.00999999978"/>
</paramValue>
</parameter>
<parameter>
<name v="pattern_color_random"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.229999989"/>
</paramValue>
</parameter>
<parameter>
<name v="split_threshold"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.519999981"/>
</paramValue>
</parameter>
<parameter>
<name v="interstice_amount"/>
<relativeTo v="0"/>
<paramValue>
<constantValueFloat1 v="0.099999994"/>
</paramValue>
</parameter>
</parameters>
<outputBridgings>
<outputBridging>
<uid v="1402602629"/>
<identifier v="output"/>
</outputBridging>
</outputBridgings>
</compInstance>
</compImplementation>

5
Hello,

You are right, this does not concern the renderer. That's further in my pipeline.

So this happens when trying to export. The command goes like this:

Code: [Select]
'C:\\Program Files\\Allegorithmic\\Substance Automation Toolkit\\sbscooker', '--inputs', 'D:/Projects/AssetPacks/Master/Assets/Temp/tmp.sbs', '--includes', 'C:\\Program Files\\Allegorithmic\\Substance Automation Toolkit\\resources\\packages', '--quiet', '--size-limit', '13', '--output-path', 'D:/Projects/AssetPacks/Master/Assets/StylizedWoodPlanksMaterials01//Materials/Substance', '--output-name', 'StylizedWoodPlanksMaterials01'
Not sure if this helps but this is the python script that is called from within Unity
Code: [Select]
import sys
import ntpath
import os
import subprocess

def run_command_popen(cmd):
    sp = subprocess.Popen(cmd, stderr=subprocess.PIPE)
    out, err = sp.communicate()
    if err:
        print(err.decode('ascii'),file=sys.stderr)
    sp.wait()

def exportSbsar(sbsPath, outputPath, outputName):
    batchtools_path = 'C:/Program Files/Allegorithmic/Substance Automation Toolkit/'
    batchtools_path = os.path.normpath(batchtools_path)
    tool_names = ['sbsbaker', 'sbscooker', 'sbsmutator', 'sbsrender']
    exe_path = {exe: os.path.join(batchtools_path, exe) for exe in tool_names}
    sd_resources_path = os.path.join(batchtools_path, 'resources', 'packages')

    cook_sbsar_cmd = [
    exe_path['sbscooker'],
    "--inputs", sbsPath,
    "--includes", sd_resources_path,
    "--quiet",
    "--size-limit", "13",
    "--output-path", outputPath,
    "--output-name", outputName
    ]
    print(cook_sbsar_cmd)
    run_command_popen(cook_sbsar_cmd)

if __name__ == "__main__":
    inputPath = sys.argv[1]
    outputPath = sys.argv[2]
    outputName = sys.argv[3]
    exportSbsar(inputPath, outputPath, outputName)

In retrospect this could've been called directly from within Unity skipping the python part but I have other scripts where I actually edit the graph before exporting it as a sbsar.

I also tried exporting the sbsar from within Substance Designer having the exact same sbs file as a source and that works well.

6
Hello

When trying to perform rendering with automation toolkit 2018.2.0 on a substance saved with Substance Designer 2018.2.2 I get the following:

Code: [Select]
[ERROR][SBSCooker]Variable type mismatch:

      Variable Name: background_color

      Of Type: Float

      Accessed By: Get Float4

      While Evaluating Parameter: background

      In Graph: pkg:///tile_random?dependency=1290776988

      Node ID: 1207746925

   ... (repeated 2 more times)

[ERROR][SBSCooker]Cooking fail [Error 13]

The error seems to be within the the files made by the substance team.

I cannot update since this is the max my license allows. This was working fine with some older versions (2018.1) so it looks like a regression.

Could anyone help me out here? Should I edit pkg:///tile_random?dependency=1290776988 manually somehow?

7
It's explained at the bottom of the 1st page of this thread.

Hello, sorry to be resurrecting this thread but as far as I can tell the problem is not resolved at all. You did explain what happened but not actually how to fix it.

I have a document that is shown correctly in Substance Designer but when trying to use the sbscooker through the automation kit, I get the error

Code: [Select]
[ERROR][SBSCooker]Variable type mismatch:

      Variable Name: background_color

      Of Type: Float

      Accessed By: Get Float4

      While Evaluating Parameter: background

      In Graph: pkg:///tile_random?dependency=1290776988

      Node ID: 1207746925

   ... (repeated 2 more times)

[ERROR][SBSCooker]Cooking fail [Error 13]



I'm using substance 2018.2.2 and Automation toolkit 2018.2.0 (since there's not toolkit 2018.2.2 available).
As far as I can tell the solution is to just update but for me this is not an option as my license is fixed. Should I understand that for my particular license, Automation toolkit is not actually compatible with the Designer?

I had this setup working before with Substance Designer 2018.1.0 and an older version the automation toolkit but I received some sbs files that were done with 2018.2.2 and so I had to upgrade.

Other than renewing the license here I'm not sure what my options are.

8
Hello,

I'm working on a little automation tool to get my substances from the pretty things I see in SD all the way to unity using my own shaders and my own texture layouts all with a single click.

I wrote a python script that modifies the sbs to change the last bits and pack maps together. Another one converts the sbs to a sbsar, another one renders the textures.

I create native materials for people who do not use substance and I'd like to have the substance materials generated correctly as well. I used dotpeek to look at how the editor code for substance looks and I sort understood what's happening. So, I get the materials from the graph, change the shader and the textures bindings. Then I call the commit functions from SubstanceImpoter, mark the substance as dirty and refresh the asset database. This works but only until for some reason the whole substance is reimported and my changes are discarded.

I get that the substance integration is supposed to be bare minimum and I should not expect fancy features like editor integration but could I still do this?

Regards,
Lorin

9
Sorry to be resurrecting an old thread but did you find anything else on this topic?

10
Hello,

I'm trying to set up a workflow where I use substance designer to create a terrain generator outputting heightmap and biome information.

I set the outputs in substance designer to 32bit floats but in Unity it seems the textures are always RGBA8.

Is there any way to get the raw texture information from a graph after rendering it?

11
Yes but that first part "Should be able to determine which output you want to connect to" is the one I can't figure out. I do know how to connect nodes as seen in my example code. As far as I see in the documentation there's no way to get the output/input names from the connection.

12
Hello.

I'm trying to write a python script that fixes the unity issues related to smoothness and metallic.

I wrote a script that finds the metallic and roughness outputs, gets the connections to the left and then connects those nodes to a bunch of new nodes (invert, channel shuffle, a new output).

This works really well when the nodes the outputs are connected to are simple things, like a levels, or a blur and so on. Now, I've stumbled upon a case where the node on the left hand of the connection has multiple outputs (in fact, it's a whole material).

The issue is that since I don't specify what output to connect to, they always get connected to the first one (a diffuse in this case). Is there any way to know what output from a node a connection is made to? I might not be understanding this so well since I'm a bit new to python but I'm "fluent" in c++ and other more normal languages.

Here's the code that handles this roughness/metallic->metalSmoothenss issue:

Code: [Select]
          #Get Metallic and RoughnessNodes
          metallicOutput = graph.getGraphOutputNode(aOutputIdentifier = 'metallic')
          metallicNodeUid = graph.getNode(metallicOutput.mUID).mConnections[0].getConnectedNodeUID()
          metallicNode = graph.getNode(metallicNodeUid)


          roughnessOutput = graph.getGraphOutputNode(aOutputIdentifier = 'roughness')
          roughnessNodeUid = graph.getNode(roughnessOutput.mUID).mConnections[0].getConnectedNodeUID()
          roughnessNode = graph.getNode(roughnessNodeUid)
         

          #Create MetallicSmoothness output
          invertedRoughness = graph.createCompFilterNode(aFilter = pysbs.sbsenum.FilterEnum.LEVELS,
                                                         aParameters = {
                                                             pysbs.sbsenum.CompNodeParamEnum.LEVEL_IN_LOW : '0.0 0.0 0.0 0.0',
                                                             pysbs.sbsenum.CompNodeParamEnum.LEVEL_IN_HIGH: '1.0 1.0 1.0 1.0',
                                                             pysbs.sbsenum.CompNodeParamEnum.LEVEL_IN_MID:  '0.5 0.5 0.5 0.5',
                                                             pysbs.sbsenum.CompNodeParamEnum.LEVEL_OUT_LOW: '1.0 1.0 1.0 1.0',
                                                             pysbs.sbsenum.CompNodeParamEnum.LEVEL_OUT_HIGH:'0.0 0.0 0.0 0.0',
                                                             pysbs.sbsenum.CompNodeParamEnum.CLAMP_IN_TERM: '1'             
                                                             }
                                                         )

          graph.connectNodes(aLeftNode = roughnessNodeUid, aRightNode = invertedRoughness)
         
          metallicSmoothMerge = graph.createCompFilterNode(aFilter = pysbs.sbsenum.FilterEnum.SHUFFLE,
                                                           aParameters = {
                                                               pysbs.sbsenum.CompNodeParamEnum.CHANNEL_RED: pysbs.sbsenum.ChannelShuffleEnum.INPUT1_RED,
                                                               pysbs.sbsenum.CompNodeParamEnum.CHANNEL_GREEN: pysbs.sbsenum.ChannelShuffleEnum.INPUT1_RED,
                                                               pysbs.sbsenum.CompNodeParamEnum.CHANNEL_BLUE: pysbs.sbsenum.ChannelShuffleEnum.INPUT1_RED,
                                                               pysbs.sbsenum.CompNodeParamEnum.CHANNEL_ALPHA: pysbs.sbsenum.ChannelShuffleEnum.INPUT2_RED
                                                               })
          graph.connectNodes(aLeftNode = metallicNodeUid, aRightNode = metallicSmoothMerge, aRightNodeInput = pysbs.sbsenum.InputEnum.INPUT1)
          graph.connectNodes(aLeftNode = invertedRoughness, aRightNode = metallicSmoothMerge, aRightNodeInput = pysbs.sbsenum.InputEnum.INPUT2)
         
          outMetallicSmoothness = graph.createOutputNode(aIdentifier = 'metallicSmoothness',
                                                         aUsages = {pysbs.sbsenum.UsageEnum.ANY: pysbs.sbsenum.ComponentsEnum.RGBA})

          graph.deleteNode(graph.getNode(metallicOutput.mUID))
          graph.deleteNode(graph.getNode(roughnessOutput.mUID))

If anyone of you could help me out with this, I'd greatly appreciate it.

Also, on a more unrelated note, when using sbsrender it would be great if there would be an option to invert the normals(only the ones in the output since others might be used for curvature sobel or something). So far I've had to do this from within Unity and it's rather tedious to figure out how the TextureImporter works.

Regards,
Lorin

13
Hello all,

I'm fairly new to Substance Painter. I've been using a lot of Substance Designer before though.

I've done the PBR Material Layering tutorial and I'm impressed by the results but some things are unclear.
Is there any way to bake the textures used from material layering to a normal pbr shader? I know this workflow is meant for something else but it would still be a nice feature.
I also tried getting the same results without using the pbr layering shader and I was successful for the most part but I'm not sure how to go about creating the normal from masks using this method.

Thanks,
Lorin.

14
And a couple more from the bricks and stone walls pack:

15
Thank you all!

Here's another one I've been working on this night. I'm not exactly happy with it yet but it's going in the direction I want. Any constructive criticism would be appreciated:

Pages: [1] 2