Accessing Inputs (Studio)

Top  Previous  Next



Node inputs can be accessed from PixelScripts in order to filter an existing image.


result = input(1, x, y);


The first value specifies which node input is to be accessed, while the next two arguments provide the coordinates of the point to be sampled.




real newX = x + sin(y * 20) * 0.05;

result = input(1, newX, y);


Spacial transformations can be created by manipulating the x and y coordinates of the sampling.




color original = input(1, x, y);

result = original * color(0.8, 1.0, 0.2);


Color transformations can be created by manipulating the color returned by the input function.




color col = color(0, 0, 0);

int iterations = 20;

real radius = 0.1;


for (int i = 0; i < iterations; i++)


 real offset = i / (real)iterations - 0.5;

 offset *= radius;

 col += input(1, x + offset, y + offset);



result = col / iterations;


Blurs can be created by sampling an input at various locations and averaging the results.




color col1 = input(1, x, y);

color col2 = input(2, x, y);

result = lerp(col1, col2, x);

Combinations can be created by sampling both inputs and blending the results in some way.  For an explanation of the lerp function used in this example, see Functions and Constants.





Next, learn how to access the node's properties in PixelScript.




Page URL: