Page 1 of 1

Matrix Array in custom expression for

PostPosted: Tue Aug 21, 2018 12:16 pm
by HammerCG
Hi, i need to send and array of matrix4x4 from script to shader and then pass it to a custom expression and use in "for" bucle.
I send with " oceanMat.SetMatrixArray(waves_shaderPropertyID, matrixGerstnerWaves); "
and shader have his global array node.
ok,no error,i think its correct.

Well the problem its to use in custom expresion,i want connect this array to custom expresion and then use it like

for(int i = 0; i<matrixArray.Lenght;i++){
float4x4 matrix = matrixArray[i];
matrix[0][0]
matrix[1][0]
matrix[2][0]
etc....
}

Then the question is, how i can connect array to a custom expresion, i dont find any compatible type in custom Expression node, i try custom type with no results.
For iterance limit in "for" bucle i can manage in other ways sending extra "int",but i dont know hoy connect the array to use in custom expresion

Thanks, sorry for my english, its low.

Re: Matrix Array in custom expression for

PostPosted: Tue Aug 21, 2018 4:03 pm
by Amplify_Borba
Hello, thank you for getting in touch and for your support!

Unfortunately, it's not possible to pass arrays into custom expression nodes at this time, but you did raise an interesting point and we'll definitely investigate for a possible workaround for this.

Hopefully we'll have a working solution ready in the next build and will get back in touch with you through this post!

Re: Matrix Array in custom expression for

PostPosted: Tue Aug 21, 2018 9:25 pm
by HammerCG
Hey! hi,thanks for answer, good to hear,any improvements are welcome.

I manage a workaround that fits my goal.

Simply, globalArrayNode--->breakComponentsNode, just take one value---->multiplyNode by zero ----> AddNode to something( adding zero,no effects)

With that i get ASE compiling globalArray variable into shader, then i can get the variable from custom expression without problems

I create the globalArrayNode with max Lenght, 16 in my case its enought,put an [unroll(16)] before "for" in my custom expresion, and pass "int" to determine iterations,never excess the max lenght,and its ok if its below for low quality.

Again sorry if my english its low :)

Re: Matrix Array in custom expression for

PostPosted: Wed Aug 22, 2018 8:56 am
by Amplify_Borba
That's an interesting workaround that you've come up with, thank you for sharing it with us!

Nevertheless, we're still going to try and find an easier solution that allows for this type of operations, we'll be sure to get back in touch as soon as we do!

Re: Matrix Array in custom expression for

PostPosted: Thu Nov 22, 2018 4:57 pm
by Amplify_Borba
Hello, I'm getting back in touch to let you know that we've recently added several improvements to the 'Global Array' node, including the addition of a 'Auto Register' parameter to allow passing Arrays into Custom Expressions

Feel free to download the latest ASE build from our website and let us know if you come across any issues, thanks!