[SparkAR] Shaders textureTransform usage on scripts

Hello everyone,

I have this patch group to scale camera texture to be 1:1 when applied to a plane.

Result with patches:
Screen Shot 2022-05-21 at 15.30.19

I would like to recreate it with scripts and I am having a hard time using Shaders.textureTransform. Asks for ShaderSignal and the transform is giving me TransformSignal. Have not been able to convert or use in any way.

Here is my script for that group:

Please help! I will appreciate it.
Thank you for reading.

Best :tada:

Looks like you need to use a Matrix3Signal as the transform.

transform : shader function(): Matrix3Signal
returns: shader function(Vec2Signal): ScalarSignal , function(Vec2Signal): Vec2Signal , function(Vec2Signal): PointSignal or function(Vec2Signal): Vec4Signal depending on underlying texture shader return type

I actually do not understand this could you explain the meaning :pensive:

You are using a TransformSignal from Reactive.transform(), but Shaders.textureTransform() expects a Matrix3Signal as the second argument.

I don’t know how to create a Matrix3Signal, but it looks like you can get a reference to one from the vertexTransform method in the Shaders module.

I feel like the TransformSignal from any of the vertexTransform outputs should exist as a shader signal, so maybe they inherit from ShaderSignal, unlike the Reactive TextureTransform.

1 Like

Thank you for the explanation Josh, I will continue to work on it :dancer: