Website will go down for approximately 15 minutes for a planned upgrade at 10pm Eastern Time tonight. We're switching the video host!

Programming in Substance Designer

Advanced, Practical

Description

This class demonstrates how to program with Substance Designer by building a Kuwahara filter. We cover:

 

  • Converting pixel positions to coordinates.
  • Set/Sequence Nodes.
  • Controlling graph flow and avoiding code spaghettification.
  • Installing and using the Outgang helper function library.
  • Building a Kuwahara filter from scratch.

Kuwahara filter code reference

Access this content with a paid membership.

Discussion

10 comments

  1. Carl Thibeault says:

    Awesome tutorial, it was perfectly explained! Thanks a lot!

    You mentionned near the end the next steps to add a directionnal kuhawara blur, following the tutorial from kodeco. I want to try it myself, I just can’t integrate the Float 2×2 matrix rotation. Do you have ressources I could look at to be able to complete the tutorial?

  2. son jeongmin says:

    Thank you for your great tutorials. I wonder how to export Kuwahara Filter by making Substance Designer as Substance Painter Filter. Though I published it as sbsar and send it to Substance Painter, the filter is not working. I think I missed something. Is there a issue that I missed? Please tell me how to do it….Thanks again.

  3. Nicolas says:

    You could have done it with While loops (a for loop is only a specific case of a while loop)

    1. Yeah but there were no while loops when I recorded the class 🙁

  4. Yapability says:

    Hello Laura, that was great class. I have one question for you. Question about “coordinate_position” and “position_coordinate” in Outgang_funtions.sbs. In the final stages of the graphs, 0.5 floats or float2 are added or subtracted. So what is the purpose of this?

    1. The position of a pixel is the center of it and not one of the corners. Assuming you have that 2×2 pixel grid, the X position of the two top pixels would be 0.25 and 0.75 respectively and not 0 and 0.5. So to convert the position (a float) to the coordinate (an integer), one has to multiply the position by the pixel count (0.25 x 2 and 0.75 x 2) which gives 0.5 and 1.5, and subtract 0.5 from both results, which gives the coordinates 0 and 1 respectively. Instead of subtracting 0.5, one could add 0.5 to start counting coordinates from 1 instead of 0.
      Alternatively (but perhaps confusingly), you could also use the formula: floor(position x pixel count) as opposed to: position x pixel count – 0.5 to get the same result.

  5. Christopher Rotter says:

    You create multiple sequence nodes as to loop over each pixel grid alot with alot of custom functions.

    I’d like to create something like this but not this Kuwahara filter. Do you have any filters you know off or a site ?

    1. All of the filters that come with Substance Designer can be inspected by pressing Ctrl+E. You can reverse engineer the code, which is how I learned a lot of things. It’s great to stimulate ideas as to how to do something new.

  6. Larisa Beliaeva says:

    It was fun! Thanks. Though, I think that it’s the great weakness of SD that it lacks proper for-loops, proper tools for iterative procedures, and the possibility to use a scripting language to shrink a bit these crazy nets of nodes.

    1. I remember Allegorithmic talking about the fact that they purposefully did not want to add for-loops because of the possibility of creating infinite loops and therefore locking up the computer. I get it, but it still sucks that there not there haha, it definitely impacts the creation of more advanced features.

Leave a comment