Author Topic: drive hue with noise? Inputs, outputs, functions, docs  (Read 5887 times)

Hello, new user here.

How can can I drive an exposed input, for example Hue in the hsl node with the result of another node - such as the luminance of a noise?

I suspect if its possible, I need to use functions with samplers, but I'm not finding the documentation for this area of the program very helpful.

Also, is there a reference for function elements and library functions? Some are obvious, others less so. There are lots of useful looking pre-made functions in the library, but I can't seem to figure out how to use them.

You can't use an image to drive a parameter yet. The only way to do this is to do it inside of an FXMap, which is kind of a hack and will be very slow.

Hi Jeremie,
 too bad its not a proper feature, but a hack is better than nothing.
I'm for now only using substance as an authoring tool and baking out the textures so even a very slow node is probably acceptable.

I had found a reference to the fx map method here:

I think I its almost working:
I have an fx map with enough quadrants to match the input image resolution.
Pattern on the bottom quadrant set to squares, size 1x1.
Colour on the bottom quadrant set to empty function, then inside the function:
get float2(position), connected to sample grey/colour(with slider set to match input image, e.g. 0 for background).

It almost works except the image sampler seems to only sample either 1 or 0 for any channel - e.g. full white, full red, full blue, full green or full black.

Any ideas?
An example would be much appreciated if possible.


What you describe is exactly how this should be done. I just redid it on my side and it works as expected.
The input image index does not start with the background though, so 0 will be the Image input 1, not the background which you can't sample in a function.

Make sure you adjust the Global Opacity of the FXMap accordingly to the number of quadrants you have. The more quadrants, the higher the opacity.

Ok, tried again and it works. Not sure what i did wrong before. Now just trying to figure out how some of the functions work.

Its really a shame this area of the program isn't better documented - it seems tremendously powerful, but there's only so much time a person can spend experimenting blindly. IMHO an undocumented feature is more often than not a wasted feature - if none or few can use it, why spend the time coding it...

Regardless, I'm really liking substance, and thanks for the help.

Well, writing docs for fxmaps is now officially one of my new year resolutions. I'll keep you posted.

Product Manager - Allegorithmic

Here is an fxmap template for creating a per pixel function node.
It will use the correct amount of quadrant depending on the node resolution.

But keep in mind that this kind of filter will be slow to process, avoid using this kind of node for real time purpose.
Product Manager - Allegorithmic

And here is quick implementation of a hue from input filter.

In this case I add the value from the grayscale image to the hue of the color image.

Note that for this kind of filter, the CPU engine might be faster than the GPU engine (depending on your hardware of course): no matter the rendering engine, the functions are always evaluated by the CPU. If you use the GPU engine, functions data have to be sent from the CPU to the GPU through the pci-e bus whereas when using the CPU engine, data stay on the CPU (which is a lot faster).

When CPU and GPU memory will be unified, GPU should be faster for this kind of task.
Last Edit: January 10, 2014, 06:53:30 pm
Product Manager - Allegorithmic

Great stuff, thanks. Will enjoy studying those.
I had a go at it myself earlier and came up with a kind of channel shuffle on steroids. Will post the sbs when I figure out how to package it in a useful manner.

As promised, the sbs files. In the end the realization struck that I'd got carried away seeing what was possible and playing in the function editor, and forgot my goals - but learned quite a bit :)
Anyway the result is two substances:

1 is, thanks to the examples, a much tidied and improved version of what I showed in the previous post. It takes 1 or 2 inputs, separates all their channels r,g,b,a,h,s,l and lets you process and recombine them however you want. It includes an add with some extra control useful for hue operations. The down side (apart too slow for run-time use) is you have to edit the actual function to use it, so its just a single node to copy into graphs as needed. Of course, most of what anyone would want to do is possible with existing nodes in the main substance graph so...

2 is a simple rgb-hsl (and back) converter that provides outputs of the individual channels as well as a combined image, controlled with a single exposed bool.

tried your RGB-HSL out but as soon as there is no blue part in the input image it does not work for some reasons.

Think that's sorted now. I noticed some other unpredictable quirks that appear to relate to the else-if that controls the direction of the conversion, so its now 2 separate nodes - 1 for each conversion direction. Appears to works so far. Keep in mind the node wont respect alpha.

The big channel processor monstrosity actually seems a bit more robust. Having to copy the node/edit the function for each use might be bothersome, but the function itself is pretty straightforward, and easy to work with.

Just playing at the minute, not testing robustly, so these may fall apart at any moment, but happy to keep improving them.

Great job ! I was looking for a way to get HSV values from a RGB and your node save me so much time !

they have added functions to use within the pixel processor by now which can do that as well.

Thanks a lot, much more easy. And with all the formulaes already built-in in Pixel processor, a good place to check in the future.