Rotate about Axis - Weird scale is applied

Node-based Shader Editor

Rotate about Axis - Weird scale is applied

Postby cAyou » Wed Nov 14, 2018 8:45 pm

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 !
Attachments
weird_rotation.jpg
weird_rotation.jpg (136.94 KiB) Viewed 4367 times
cAyou
 
Posts: 39
Joined: Mon Oct 29, 2018 7:12 pm

Re: Rotate about Axis - Weird scale is applied

Postby cAyou » Wed Nov 14, 2018 10:41 pm

Never-mind ! I found out that subtracting the result with the vertex position will give the result I wanted. Case closed !
cAyou
 
Posts: 39
Joined: Mon Oct 29, 2018 7:12 pm

Re: Rotate about Axis - Weird scale is applied

Postby Amplify_Borba » Thu Nov 15, 2018 9:36 am

Hello, thank you for letting us know that you've found a solution!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Rotate about Axis - Weird scale is applied

Postby cAyou » Thu Nov 15, 2018 2:17 pm

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
cAyou
 
Posts: 39
Joined: Mon Oct 29, 2018 7:12 pm

Re: Rotate about Axis - Weird scale is applied

Postby Amplify_Borba » Thu Nov 15, 2018 4:37 pm

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.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Rotate about Axis - Weird scale is applied

Postby cAyou » Mon Nov 19, 2018 2:48 pm

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.
cAyou
 
Posts: 39
Joined: Mon Oct 29, 2018 7:12 pm

Re: Rotate about Axis - Weird scale is applied

Postby Amplify_Borba » Mon Nov 19, 2018 3:05 pm

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.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Rotate about Axis - Weird scale is applied

Postby cAyou » Fri Nov 23, 2018 2:34 am

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 !
cAyou
 
Posts: 39
Joined: Mon Oct 29, 2018 7:12 pm


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 28 guests