Home Adobe Substance

Using Quixel resources in Substance

polycounter lvl 8
Offline / Send Message
Olli. polycounter lvl 8
Restructuring this post a bit:
all the scripts and templates are attached as a ZIP to this post.

General instructions for all scripts:

Requirements:

  1. Photoshop
  2. Quixel Suite
  3. Substance Automation Toolkit
  4. Substance Designer

Instructions:

1. Create a folder where you want these files output. Im using "D:\CG\Database\Quixel2Substance"
2. extract the contents of the ZIP file in to that folder.
3. open the jsx files with any text editor and modify the top path declarations to match yours. The variables you need to set are:
-outputDir: the folder you just created which has the template files, and this is also where the resulting sbs and sbsar files will be exported to.
-toolkitDir: Substance Automation Toolkit installation folder
-substanceDir: path to your substance designer installation folder
-quixelDir: path to your quixel suite installation folder
4. move the jsx scripts to the photoshop scripts folder (Photoshop_Install_Folder\Presets\Scripts)
5. open photoshop and execute the scripts from File>Scripts
6. copy the resulting sbsar files in to your substance shelf.

Scripts:

Quixel Alpha to Substance Alpha

This script takes all the brush alpha JPG files and slots them in to alpha_template.sbs, then compiles that in to a SBSAR.
the compiled SBSARs will be located in "outputDir\Brushes\Compiled"

Known Issues:
the brushes are sometimes slow. I might have been a bit ambitious with the occluder feature, so if you edit the template to just be input>histogramscan>output the brushes should work much smoother. If you do this also remove all the input parameters in the Occluder group.

Modifying the template:
alpha_template.sbs
If you want to modify the template sbs file yourself, make sure you do not rename the input node. Other than that you can make any changes to the template.

Quixel Bitmap to Substance Grunge Bitmap

This script operates on quixel Masking Patterns and converts them to grunge bitmaps for use in Substance.
Quixel has normal Masking Patterns as well, but the script should be capable of detecting them with the _Normal suffix. I havent tested it though, because I dont really use normals in SP
the compiled SBSARs will be located in "outputDir\Alphas\Compiled"

Modifying the template:
bitmap_template.sbs - This template is used for all the greyscale bitmaps
normal_template.sbs - This template is used for all normal bitmaps
If you want to modify the template sbs file yourself, make sure you do not rename the input node. Other than that you can make any changes to the template.

Quixel Material Compiler

when run, the script will ask Parse Whole Folders?
select yes if you want to parse all materials found in the selected folder and its subfolders
if not, you will be prompted to manually select one or more materials. The files you want to select are the XML files!

The script will load up a list of every XML file selected (or every XML it finds in the folders), then for each XML it'll find the corresponding PSB channel textures, save them out as TIFF files, slot those in to the SBS template, then compile the template in to an SBSAR.
The compiled SBSARs will be located in "outputDir\Materials\Compiled"

Known issues:
Most if not all the issues with this script are due to the unoptimized template that I whipped up just to get the script up and running. Maybe i'll make a better template in the future if i ever need better materials, or you can do it yourself.
- Height doesn't work properly. default height seems to be mid gray, when it should be 0,0,0. Allego also does some weird stuff where you can have negative values in the height channel, and I haven't looked in to how any of that works. The height PSBs from quixel seem to be 8 bits, so they'll also need to be converted to 32 bits or 16 bits. I'm not sure which substance uses for height, probably the former.
- SBSARs are slow. This is because I just exposed every parameter I found in the quixel material XMLs. Most of them are not needed, and many of them can be combined in to a single parameter (gloss and roughness params for example are just inverts), so theres definitely room for optimization here.
- The fillOpacity, Opacity and Blend parameters are not supported by how substance materials work. As far as i can tell the only quixel material that uses these should be the Water Droplets material. That you'll have to manually convert to a substance filter if you want to use it in SD or SP

Modifying the template:
If you want to modify the template sbs file yourself, make sure you do not rename the input nodes or any of the input parameter identifiers. Other than that you can make any changes to the template.
You can't however remove input parameters from the template, because the script will most likely complain when it tries to input data in to nonexistent params. In order to optimize the template by hiding unnecessary input params --switch-to-constant option for sbsmutator.exe will need to be implemented in to the script and I've yet to look in to how that could be done.

Replies

  • LaurentiuN
    Options
    Offline / Send Message
    LaurentiuN interpolator
    Niiiice, is there a possibility for a short video on how to do it? One more thing, are we allowed to do this? I mean to use quixel material in Substance? Would be nice if quixel guys can share more about this. :)
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    if you own quixel and dont re-distribute the resources you rip, i dont see why not.
    Its not like the resources are encrypted somehow.

    I might be able to put together a video later... the explanation before the script in the top post should cover it all though.
    If you get any errors or anything like that, feel free to post here and ill take a look.
  • Tzur_H
    Options
    Offline / Send Message
    Tzur_H polycounter lvl 9
    this is really nice!  thanks for sharing.  could you, theoretically, create something similar to convert all materials to sbsars?  I've done that manually and it was a bitch! :P
    oh and Ubisoft did it on Rinbow Six Siege, used quixel resources with substance painter.   there's a video of a presentation they did on Allegorithmic youtube channel if anyone is keen
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    I already have a script that converts substance materials from the XMLs to sbsars. It was actually the first script I made when I started this little project.
    Its just a 1:1 conversion of the data though, and because of some differences between quixel and substance im not too happy with the result.

    Hopefully ill have time to improve the template sbs and the script so the result is more usable.
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    *moved to top post*
  • [Deleted User]
    Options
    Offline / Send Message
    [Deleted User] insane polycounter
    The user and all related content has been deleted.
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    crap. yeah that was my bad. attached the alpha template to the message above.
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    I've restructured all the scripts in to the original post with a better explanation of how the scripts work.
    Also added the material converter in its current "working but unoptimized" state.
  • kingtobbe
    Options
    Offline / Send Message
    kingtobbe polycounter lvl 4
    Amazing work. Been trying to do  much of this manually, before giving up. Thank you so much!

    Edit: Tried using the Alpha-script but it stops at line 61 with this error message:


  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    I will have a look when I get home today.
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
     cant seem to reproduce that. can you give me some more info?

    did the script run for long before you got the error?
    what folder are you running the script on?
    do you have any custom alphas added to quixel?
  • kingtobbe
    Options
    Offline / Send Message
    kingtobbe polycounter lvl 4
    Sorry for my slow reply, for some reason I was browsing the technical discussion thread but couldn't find he thread until I checked my history just now.

    The script seems to run up until the compiling part as I can see the image files in the correct directories (screenshot of the layout: https://imgur.com/a/R6lDa). Have adjusted the script(s) accordingly. I have no custom alphas, migrated to substance quite soon after I bought Quixel. Should add I've tried running all three scripts since and get the same results on all of them.

    Suspected it might have been due to Photoshop not being the default app for the filetype but after changing that, the issue still persists.
    Never used the Automation Toolkit since installing it, so there might be an issue there as well. Going to re-install system soon so unless something obvious strikes you from this message, I will give it a go again after that. 

    Thanks a lot for your time!
  • LaurentiuN
    Options
    Offline / Send Message
    LaurentiuN interpolator
    I got the same error as @kingtobbe, Error 8000 like him. The folder that i choosed after running the script was the Quixel SUITE

    EDIT: I tried running on the script folder from quixel and that worked for alphas and brushes and for the materials i selected the materials folder from quixel folder.

    EDIT2: After finished i have only the textures from the compiled materilas and no substance files:(.
    EDIT3: When running the Materials script and selecting the smart materials folder from the quixel i get this error. 0 sbsar files


  • Gabriel Nadeau
    Options
    Offline / Send Message
    Gabriel Nadeau polycounter lvl 9
    Hello there! Thank you for this tool Olli., I have followed the instructions carefully, but like kingtobee and s1dk, I'm not getting any sbsar files.
    Can we hope to get a fix soon, I would love to have those Quixel materials inside Substance Painter!

    Thank you!
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    Sorry i kind of forgot this thread exists :D
    So I managed to reproduce the error 8000 with the alpha script, and I fixed it (had to do with inconsistency in the naming of the "thumbs" folder which is supposed to be excluded from processing)

    Also you shouldnt choose the main Quixel SUITE folder, because the script then parses everything in that folder, and that is a lot of stuff, some of which might be misinterpreted as the right kind of file, leading to problems.
    The primary locations of the Alphas, Bitmaps and Materials are as follows:
    Materials: C:\Program Files\Quixel SUITE 2.3\script\presets\Materials\Basic Materials
    Bitmaps: C:\Program Files\Quixel SUITE 2.3\script\presets\Materials\Masking Patterns
    Brush Alphas: C:\Program Files\Quixel SUITE 2.3\x64\3DO\3DO2_Data\BrushCategories

    However the material and bitmap scripts work fine for me, i just tested them again. the line in question basically takes every possible texturechannel name ("Albedo", "Gloss", "Specular", "Normal", "Roughness", "AO", "Height", "Opacity", "Metalness", "AlbedoM") and tries to find it in the XML. if its undefined, then that channel doesnt exist in the material XML so it doesnt parse it.
    What seems to be happening is that your script interpreter isnt recognizing "undefined" as a thing. This might have something to do with photoshop version.

    Could you let me know which version you are using?
    Also if you could run the script on a single XML (click no when it asks if you want to parse full folders, and then navigate to one of the material XMLs)  and let me know exactly what happens on the screen.

    What should happen is first it quickly opens and closes all the texture channels in the photoshop window. Then you should get 2 successive black console window popups, the first one closes in a second or so, and then the second one opens and that one takes longer. Then it should close and the material should be generated.

    Attached is the fixed brush alpha script
  • Gabriel Nadeau
    Options
    Offline / Send Message
    Gabriel Nadeau polycounter lvl 9

    Hey Olli., glad to see you back on this thread and thank you very much for taking the time to look into this.

    So to answer your questions, I'm using Photoshop CC 2017. I tried to run the script on a single XML file and the behavior is pretty much like you described, although it's hard to tell if there is actually 2 successive black console window, I might be getting just one.

    Also, I tried using your new alpha script and I'm now getting an error every time Photoshop opens an alpha.


    Thank you again and I hope you can find a solution!

  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    so the material script works as I described? at which point do you get the error?

    also that alpha script error isnt actually an error, seems like i forgot to remove a debug alert i used to diagnose the issue. Just search for alert(file) and comment the line out with //, or download the attachment where ive done it myself.
  • Gabriel Nadeau
    Options
    Offline / Send Message
    Gabriel Nadeau polycounter lvl 9
    Yes, it works as described. I don't get any error actually, it's just that there are no sbsar files generated. Just the image files!
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    whats the location of your Substance Automation toolkit install? and have you made sure that the path definitions outlined in the instructions are set correctly? specifically the toolkitDir path.

    if thats all correct, then next you could try run an alpha through the mutator manually. Do so by replacing the brackets in this string with your own paths and then running it in the windows console:

    first navigate to the sbsmutator. Just type in the path in to the command prompt. Then run this (but change the paths so they match your own setup):

    sbsmutator.exe edit --input "D:\CG\Database\Quixel2Substance\alpha_template.sbs" --output-path "D:\CG\Database\Quixel2Substance\Brushes\Assorted" --output-name "Dense" --presets-path "E:\Utilities\Substance Automation Toolkit\resources\packages" --connect-image input@path@"D:\CG\Database\Quixel2Substance\Brushes\Assorted\Dense.tif"@tiling@1

    What this does is it takes the alpha_template.sbs, slots in the Dense.tif texture, and saves it as Dense.sbs in Brushes\Assorted folder. It doesnt matter which texture you use.


    edit: also make sure you have stuff in the ..\Substance Automation Toolkit\resources\packages folder. 
  • Gabriel Nadeau
    Options
    Offline / Send Message
    Gabriel Nadeau polycounter lvl 9
    The location of my Substance Automation Toolkit is C:\Program Files\Allegorithmic\Substance Automation Toolkit
    Yes I made sure that the path definitions are set correctly.
    I tried to run an alpha manually like you said and it seems to be working as intended, I did get the sbs file in the end.
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    interesting... I do remember having some trouble with windows 10 having some kind of restriction on running scripts in powershell. Maybe this also affects running console commands from JS.

    You could try opening powershell and running this. 
    Set-ExecutionPolicy RemoteSigned
    I'll have a better look when i get home tonight
    edit: also make sure youre running everything as administrator
  • Gabriel Nadeau
    Options
    Offline / Send Message
    Gabriel Nadeau polycounter lvl 9
    Doesn't seem to help.  :(
  • Olli.
    Options
    Offline / Send Message
    Olli. polycounter lvl 8
    Finally had some time to properly debug this on my work computer. The way i was setting up the windows shell commands was the issue, because I start with C: or E: or whatever drive your substance toolkit is installed on. Mine at home is installed on the E: drive, and when you enter E: in to cmd it navigates the E: root. The issue is if you have yours installed on the system drive, cmd will open in C:\users\you or something, and then when you do C: it doesnt actually navigate to C: root, just stays where it is because its already in that drive.

    The solution is to add cd\ to the beginning of the cmd string builders which forces to the drive root regardless of where you are. I've added this fix and updated the download link on the first post, or you can download it below
  • Gabriel Nadeau
    Options
    Offline / Send Message
    Gabriel Nadeau polycounter lvl 9
    Nice! I've just tried it and I can confirm that it's now working. I am so happy I will finally be able to use those sweet Quixel materials with Substance Painter! Thank you very much Olli! :smiley: 
  • LaurentiuN
    Options
    Offline / Send Message
    LaurentiuN interpolator
    EDIT: It`s working, i had to add "\\" and not just a single "\" , thanks:>

    @Gabriel Nadeau, did you got the smart materials to?

    Hi Olli, thanks for taking the time to fix it, but i still dont get any sbs/sbsar files :(, everything works well without any errors, but when i run the material script, i get no files in the material folder. Using Photoshop 2017.1.1

    This is what i have in the jsx files.

    outputDir = ("D:\Quixel2Substance")
    templateDir = outputDir //Replace this with a path like above if template is in different directory than output
    toolkitDir = ("C:\Program Files\Allegorithmic\Substance Automation Toolkit")
    substanceDir = ("C:\Program Files\Allegorithmic\Substance Designer")
    quixelDir = ("C:\Program Files\Quixel SUITE 2.0")

    Help please :(

    "What should happen is first it quickly opens and closes all the texture channels in the photoshop window. Then you should get 2 successive black console window popups, the first one closes in a second or so, and then the second one opens and that one takes longer. Then it should close and the material should be generated."

    This is what you wrote in a post, so i`m getting the tabs with the textures, but the 2 successive black console windows never showed up.
  • Gabriel Nadeau
    Options
    Offline / Send Message
    Gabriel Nadeau polycounter lvl 9
    Hello!

    Yes, I do get the smart materials but it seems that the maps aren't plugged in the materials. So for now, what I do is that I manually open the sbs in substance designer, plug the maps for each channel and republish the sbsar to get the material working. Not sure if it's just me and if there's anything we can do about it ?

    Thank you!
  • LaurentiuN
    Options
    Offline / Send Message
    LaurentiuN interpolator
    @Gabriel Nadeau, thanks for the info mate.
  • jixueliang
    Options
    Offline / Send Message
    jixueliang polycounter lvl 5
    1. Thanks. How to get Substance Automation Toolkit?
Sign In or Register to comment.