Getting the Half-Vector

Node-based Shader Editor

Getting the Half-Vector

Postby Liraco » Tue Sep 26, 2017 1:33 pm

I know that in Unity there's a way to get the half-vector but didn't find a node for it in ASE. I come from Shader Forge and was doing a test and that one has a node for it. So any help to get a half vector would be appreciated.
The half-vector (halfway between lighting direction and view vector) is computed and normalized per vertex, and the lighting function receives the half-vector as a parameter instead of the view vector.
https://docs.unity3d.com/Manual/SL-ShaderPerformance.html
Liraco
 
Posts: 7
Joined: Mon Sep 25, 2017 10:11 pm

Re: Getting the Half-Vector

Postby Ricardo Teixeira » Tue Sep 26, 2017 1:59 pm

Liraco wrote:I know that in Unity there's a way to get the half-vector but didn't find a node for it in ASE. I come from Shader Forge and was doing a test and that one has a node for it. So any help to get a half vector would be appreciated.
The half-vector (halfway between lighting direction and view vector) is computed and normalized per vertex, and the lighting function receives the half-vector as a parameter instead of the view vector.
https://docs.unity3d.com/Manual/SL-ShaderPerformance.html


Hello,

Thank you for using ASE, we really appreciate it. I strongly recommend checking the Custom Lighting sample included in the Official Example folder. There's no specific node for that purpose but you can get that value by using the dot product of the lighting direction and view vector.

Image

Let me know if the information above helps, we would be happy to help.

Thanks!
Sales & 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
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Getting the Half-Vector

Postby Liraco » Tue Sep 26, 2017 4:32 pm

Ricardo Teixeira wrote:There's no specific node for that purpose but you can get that value by using the dot product of the lighting direction and view vector.

Yes, I believe I had to set the view vector to tangent to get it to work. I imagine it doesn't see much use which is why there's no node.

I don't know if I should open a separate thread but is the bitangent node the same as getting the binormal direction?
Liraco
 
Posts: 7
Joined: Mon Sep 25, 2017 10:11 pm

Re: Getting the Half-Vector

Postby Ricardo Teixeira » Tue Sep 26, 2017 9:33 pm

Liraco wrote:
Ricardo Teixeira wrote:There's no specific node for that purpose but you can get that value by using the dot product of the lighting direction and view vector.

Yes, I believe I had to set the view vector to tangent to get it to work. I imagine it doesn't see much use which is why there's no node.

I don't know if I should open a separate thread but is the bitangent node the same as getting the binormal direction?


Hello,

Glad to know it's working, you can always create your own node with Shader Functions.

Which node exactly?

Thanks!
Sales & 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
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Getting the Half-Vector

Postby Liraco » Tue Sep 26, 2017 10:18 pm

Yes, I was thinking of SFs as a way to make something resusable.

As for my other question, ASE has this node: http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Vertex_Bitangent

I wanted to know if it works like the binormal described in the Unity documentation (since the node's Wiki doesn't go in depth as to what goes into making it)
https://docs.unity3d.com/Manual/SL-VertexProgramInputs.html
Liraco
 
Posts: 7
Joined: Mon Sep 25, 2017 10:11 pm

Re: Getting the Half-Vector

Postby Ricardo Teixeira » Wed Sep 27, 2017 9:49 am

Liraco wrote:Yes, I was thinking of SFs as a way to make something resusable.

As for my other question, ASE has this node: http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Vertex_Bitangent

I wanted to know if it works like the binormal described in the Unity documentation (since the node's Wiki doesn't go in depth as to what goes into making it)
https://docs.unity3d.com/Manual/SL-VertexProgramInputs.html


They are fairly similar but our node includes a few extra corrections that the Unity sample does not. Be sure to let us know if you run into any issues, any feedback would be extremely welcome.

Feel free to create a new thread dedicated to any problems that you might encounter.

Thanks!
Sales & 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
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 16 guests