sobotka / olive

NLE video editor
GNU General Public License v3.0
2 stars 1 forks source link

[NODES] Channel Separation Options #122

Open sobotka opened 4 years ago

sobotka commented 4 years ago

Summary

Nodes should permit selection of application.

For example, the math node should have some sort of UI selection available that permits the creator to choose which channels are applied to. Given that Olive uses a table to pass values and arrays down the chain, it is likely that this channel selection needs to be dynamic.

itsmattkc commented 4 years ago

I feel a little uncertain of the exact behavior of this.

Let's say we had a blur node and then selected only the red channel. Which of these would be the expected output?

image (i.e. red channel blurred, rest of the image intact)

image (i.e. red channel blurred, no other channels)

sobotka commented 4 years ago

It would only apply to the selected data.

A blur with an RGBA+ancillary appends, it would be feasible to apply to only the RGB, or any of the data.

Nodes by nature should be "dumb" and not interpret or shim in any operation that isn't requested. So for example, with an associated alpha image, if a node routes an RGBA to a colour manipulation, it's going to produce wrong output, and it likely should produce wrong output. Otherwise it heads down a neverending rabbit hole of "smart software" checks, which as you can guess, becomes untenable with all possible combinations.

A checkbox table allows for discrete application of the node, in a relatively sane manner. Only want the blur applied to blue, green, and alpha? No problem.

In your example, I'd expect that if we dumped the image raw to the viewer, the result would be the totality of the buffer, RGBA, with the R channel blurred as chosen. As in if the node is passed A B C D X1 Y1 Z1 F Foobar, and Foobar is selected, the node should blur the Foobar and pass down the identical table with the Foobar blurred. In the Viewer node, if only the R of the R G B A Foobar was selected, we'd see only R as with your second image. Of course, it would also be entirely legitimate to select Foobar and dump the results to the viewer.

Ultimately it is up to the nodes to determine what their default action is. That is, in your example, passing R G B A Foobar to the Viewer, the viewer will look for the known defaults of R G B A and display the result, which in this specific example would be the blurred R with unblurred G B A.

TL;DR Nodes should not delete tables without (perhaps?) a delete node. Otherwise it simply passes the table data along, nodes look for specific default labels, and crunch the numbers. Answer to your specific question: Depends on the node that is displaying the data.

itsmattkc commented 3 years ago

Sure I get that, so what happens in a scenario like this:

Say we're adding two textures together and the channels are selected like this:

Input 1:        [x] R        [ ] G         [ ] B
Input 2:        [x] R        [x] G         [ ] B

How are these "added" like this? Obviously we could say add the two reds, keep the green from 2, and discard green 1 and the blues, but that's not the behavior of the second blur image, not the first.

sobotka commented 3 years ago

My sensibility suggests that the values added are dictated by the check, as in the table parameter.

Consider two tables:

R G B F X Y Z
R G B F A O Z

The selection would be the union of parameters:

R G B F X Y Z A O Z

And the operation would consider all values of that parameter, and apply. In the case where only one buffer has a parameter, consider NULL and pass through.

Blur with R G B A and all four channels selected would blur all four. With only R selected, blur applies to R and the others pass through.

Thoughts?

sobotka commented 3 years ago

Thinking about it more, I think your approach is more useful, to permit channels to cross talk.

itsmattkc commented 3 years ago

I'm not really proposing or advocating for any approach, this is just the puzzle I ran into while trying to figure out how to actually implement this.

To be honest, I like Blur Example #1 where you could simply select channels to operate on and the rest would pass through, but it becomes complicated whenever more than one input texture is involved (As in the "add" example, what does it mean for two blue channels to get passed through? How does one green channel get added to nothing and the other green channel passes through?)

I feel like the dilemma is kind of like this:

Perhaps both options need to be available to the user.

sobotka commented 3 years ago

I believe what might be able to work is:

  1. A list box in the Parameters with a + / - selection.
  2. Add a line to the list box. Two columns.
  3. Left column enumerates the input buffer parameters, in a group box.
  4. Right side column enumerated the output buffer parameters.

The input then is applied to output. If the goal were to add the R to F, G, and H, three rows, with R selected for each on the left, and F G H respectively on the right.

The others pass through.

I’m guessing that an Append node would add on selected parameters. For example, if an input table contains D E F and the output only has A, the append node could work with the above UI and permit the audience to append any to all of the three from the input.

Seems like a relatively powerful matrix. Nodes that do typical things, could perhaps have a set default series of enumerated matrix elements already predefined, subject to addition or removal as required.

The first example with the image:

  1. Add Filter node.
  2. Select input table R from the enumeration.
  3. Select output table parameter from node on right. Lanczos, Cubic, Box, Prefilter, etc.

Done!

This matrix approach also strikes me as powerful because it would allow a node to perform any and all of its operations to specific channels, and encode them as such.

Perhaps it’s three columns. Input on left, operation next, and output table encoding on right?