Hi, not sure what is happening there, trying to drive the blending mode by an input user value:
if the value is negative, I want to use the Linear Add mode, if positive, the Substract mode.
It works when I am trying it in the Parameters tab, but not in the Preview (same in Painter). Looks like the condition always answers False in the preview tab (and painter) but not in the parameters tab.
What I am missing here?
Preview modes in any rendering app will almost always look for the fastest run through of any filter or layer effect you build. If you have a testing block, you will have to open the filter up and actually change the value at least once in a preview tab or in painter, then rebuild the preview. Without knowing how you built your test, I cannot really say whether there is a problem there or not.
What happens when less than zero? What happens when greater than zero? What happens when zero?
There are three paths the zero value can take, and if you only test for positive, or only for negative, without including the zero value on either side, you will get your system default for which side zero is considered on. Most consider it positive, but some systems actually leave it out, answering false to both tests.
Here is my if test:
If input < 0: do something
else if input > 0: do something else
else: do something for default
If your testing looks similar to the above, check your default path. Check your tests and make sure they conform. When you first run the preview, you'll probably get a FALSE to at least one test, leaving a default in there will give you a way to track that down. Maybe add a third blend mode just for testing, then remove or replace it how you wish. Once you know it is taking the default pathway, you should change the value and rebuild the preview from in the preview pane. If this still takes only the default path, I'm at a loss. If you only do a simple if test, you will probably get false every time it opens the tab, and it may be reruning the filter with the default setting of 0. You may have to tell the nodes to rebuild the preview in your filter so that it uses the value set from input. In the standard tabs, this doesn't matter, since you are building the view as you go, actively, and everything is built on top right as you adjust it. In preview tabs and in painter, it waits for a render message to alter the preview.
Hey, thank your for your answer and the time you took, however I was pretty sure the image was descriptive of the condition, I tried mutiple times, mutiples things, even publish to try it in painter.
if GU <= 0: return 1 else: return 2
In the list of the blendmode's dropdown, 1 = Add and 2 = Subtract,
Doing this function to drive the Blending Mode, I thought it would work.
There is something happing there with the GU variable (gloss unit incrementation slider on the images), because it works if I put a constant float.
However I tried the same function in a value processor that return the right integer, so I still really don't know what I am doing wrong.
Even with a simplified test with a value processor that has the exact same function as the blending mode of the blend node. it returns the right integer when the blending has not change to the Add and return the integer 2
However I made a work around by using two blending node (one in subtract mode, and the other in add). Blend them together and paste the function below in the opacity, that does the job even not elegant
if GU <= 0: return 1 else: return 0
Thank you for your answer that guide me to use several blending nodes even if I think I'm not supposed to do so.
Certain parameters cannot be exposed in SBSAR (they appear to work in Designer but are fixed in the resulting SBSAR). This includes blend modes. I usually use multiple blend modes and a switch node.
The limitation is described in the documentation for Designer:
I did not expose the parameter itself, but seems has the same limitation.
Yes I eventually made the two option blend node (one with subtract, and one witthe had), driven by the function in a switch. Does the job.