Page 1 of 1

Rotate about Axis - Weird scale is applied

PostPosted: Wed Nov 14, 2018 8:45 pm
by cAyou
Hi there ! I'm trying to make a shader that will rotate the vertex around an axis. Using the built-in node "Rotate About Axis" seems to work except that I have a weird scale applied to the vertex. When setting the rotation to 0, my object is scaled twice, and putting a value of 180 degres (converted to radian first) the object is too small to be visible.

Any idea? I will try to create my own rotation matrix by using the Custom code node, see if I get better results.
Here's the result in video: https://streamable.com/9gtl6
and the shader is attached with the post.

Thanks !

Re: Rotate about Axis - Weird scale is applied

PostPosted: Wed Nov 14, 2018 10:41 pm
by cAyou
Never-mind ! I found out that subtracting the result with the vertex position will give the result I wanted. Case closed !

Re: Rotate about Axis - Weird scale is applied

PostPosted: Thu Nov 15, 2018 9:36 am
by Amplify_Borba
Hello, thank you for letting us know that you've found a solution!

Re: Rotate about Axis - Weird scale is applied

PostPosted: Thu Nov 15, 2018 2:17 pm
by cAyou
No problem :) Did you know the solution? It would be cool to add a note on the node documentation. I mean, I was expecting to have correct rotation on the object out of the box when using this node. I know that it might be trivial for some people, but I've struggled for a long time haha :D

Re: Rotate about Axis - Weird scale is applied

PostPosted: Thu Nov 15, 2018 4:37 pm
by Amplify_Borba
Apologies for not elaborating on this, but the Vertex Offset port receives, as the name suggests, an offset, that will be added to the current Vertex Position internally.

This solution is expected and specific to the fact that you are connecting the final output to this port, which is the standard for the Template you're using, however, on Standard Surface shaders, you can choose the Vertex Output to be either Absolute, which won't require you to do this same procedure, or Relative, which will require said offset.

In short, it won't be applicable to every case, as it is expected that you add/subtract the Vertex Position when you're using a Vertex Offset.

On a side-note, we're planning on adding this option to templates in the near future.

Re: Rotate about Axis - Weird scale is applied

PostPosted: Mon Nov 19, 2018 2:48 pm
by cAyou
Very clear and detailed answer, as always :)
I got used to think on "offset" instead of "absolute position" after playing with it for a while.

btw I have quite a lot of weird behaviors with the HDRP, I will post a separate thread, maybe you are aware of all these issues.

Re: Rotate about Axis - Weird scale is applied

PostPosted: Mon Nov 19, 2018 3:05 pm
by Amplify_Borba
Thanks, always happy to help!

Regarding the HD RP issues, we appreciate that you're opening a new thread, be sure to include HD RP and Unity versions together with the issue description and, if possible, a screenshot of the erratic behavior.

We've also addressed a few issues on the Unity Forum ASE Thread, so you might find additional information there.

Re: Rotate about Axis - Weird scale is applied

PostPosted: Fri Nov 23, 2018 2:34 am
by cAyou
Good to know, I will ! (already did in fact haha)
We are using the HDRP for an in-house prototype that requires a lot of fancy shaders and good looking graphics. I committed 100% on ASE instead of Shadergraph, but it was an unpopular opinion on the dev team (they prefer built-in stuff, avoiding any third party plugins as much as possible), so I need make things work with your plugin. We can also mix both techniques on the same project, which is cool !