How to set color components based on position (x,y) within the frame?

I can set an expression for a color component of a whole frame, for example I can set this expression r=0.5+(sin(frame/10.0)/2) for the Red Component of a Rectangle and the color will oscillate over the course of some 63 frames.

But this sets the color for the whole of the rectangle. I want to be able to set an expression which varies the color components within the same frame, e.g. to set components (1,0,0,1) for the pixel at (1,1) and (0.9, 0.1, 0, 1) for the pixel at (2,1).

How can I achieve this?

I suppose you are using SeExprSimple or SeExpr? Please read the doc here: https://natron.readthedocs.io/en/rb-2.3/plugins/fr.inria.openfx.SeExpr.html

What you are looking for is probably the variables x and y

1 Like

I wasn’t using SeExpr when I posted my question - I thought that maybe there was maybe some native Natron functionality. I am just now getting started on SeExpr and have much to learn.

You can also use Shadertoy (see for example the default shader)

1 Like

Thanks, I will try this.