Save 50% off your first month of Outgang when buying a monthly membership and using the discount code OUTGANG2023 at checkout. Valid for a limited time.

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

This class is reserved for members.

Discussion

6 comments

  1. 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.

  2. 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.

  3. 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