About execution order in material editor
Hi, all.
I'm new to Lens Studio.
I'm trying to implement like this gif, and animate vertex with shader.
https://i.stack.imgur.com/R6Klp.gif
I've just finished to convert world position to screen position.
But I couldn't animate with vertex shader.
Maybe, it's because of execution order in material editor.
Is there any ways to use stored values in the editor, or alternative ways?
Thanks, regards.
Hi! There's a couple ways of doing this. Order of execution shouldn't really matter in either case.
#1: Animate with a script. You can use our javascript API to translate and rotate the object however you want with a script (in that gif it didn't seem like you necessarily needed a vertex shader for this). Then, make a Graph Material with a Texture Object node to a Texture 2D Sample node. The UV Coords will be a Screen UV Coord node, which automatically converts world space positions to 2d screen coordinates. Connect the output of the texture sample to the Albedo of the PBR. That graph looks something like this:
#2: Animate with Material Editor. Another way to do this is to write a vertex shader in Material Editor like you were talking about. You could use our 3d Rotation subgraph in combination with some sin and cos functions to rotate/translate the object. You could also use the Transform Matrix node if you want to supply your own transformation matrix, like from a script. The fragment shader part is exactly the same as the previous example. Here's one such network you could try for vertex animation:
Hope that helps!
@Kurt Kaminski

Thank you for your reply!
I have already done it on my own. (with script)
Sorry, I have just noticed that now.
Here is my result👍
Thank you!