Manual Specular Implementation Issue?

Node-based Shader Editor

Manual Specular Implementation Issue?

Postby mehrdad995 » Thu Oct 26, 2017 9:33 pm

Hi everyone.
I've recently switched to amplify from shader forge.
everything seems great but some really simple issues are really giving me headaches.
1) my specular/gloss seems to be calculated in vertex shading!
Image
2) by zooming camera in and out, the specular size change as well!
Image
but in shader forge or even standard shader not only the specular is smooth but its size doesn't change on different zooming levels.
I know there is a node only to calculate lighting when in custom light. that works great but I want to have control over parts and need to implement it manually.

my current shader function
Image

thanks in advance
mehrdad995
 
Posts: 4
Joined: Thu Oct 26, 2017 9:19 pm

Re: Manual Specular Implementation Issue?

Postby Ricardo Teixeira » Fri Oct 27, 2017 10:20 am

mehrdad995 wrote:Hi everyone.
I've recently switched to amplify from shader forge.
everything seems great but some really simple issues are really giving me headaches.
1) my specular/gloss seems to be calculated in vertex shading!
Image
2) by zooming camera in and out, the specular size change as well!
Image
but in shader forge or even standard shader not only the specular is smooth but its size doesn't change on different zooming levels.
I know there is a node only to calculate lighting when in custom light. that works great but I want to have control over parts and need to implement it manually.
my current shader function
Image
thanks in advance


Greetings,

Thanks for getting in touch, we would be happy to help. Are you using the World Reflection node for any particularly reason? Below is the usual setup, be sure to normalize the World Normal position.

Image

If the problem persists, please share a sample so that I can forward it to the ASE developer for further examination.

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: Manual Specular Implementation Issue?

Postby mehrdad995 » Fri Oct 27, 2017 7:04 pm

Ricardo Teixeira wrote:
Greetings,

Thanks for getting in touch, we would be happy to help. Are you using the World Reflection node for any particularly reason? Below is the usual setup, be sure to normalize the World Normal position.

Image

If the problem persists, please share a sample so that I can forward it to the ASE developer for further examination.

Thanks!


Thank you so much Ricardo. I really don't know how to return the favor.
my bad, I had to use "half-direction" for proper blinn-phong specular model.
regarding to this post http://amplify.pt/forum/viewtopic.php?p=1631#p1631
the dot product of "View Dir" and "Light Direction" should result in the "half-direction".
the same shader produced in both Amplify and Shader-forge results in a totally different shadings!
the one generated by Amplify isn't right and again its specular shine's size change on camera position change(seems like projection matrix issue, i'm not sure though).

The Shader forge node setup :
Image
It's result :
Image

The Amplify node setup :
Image
It's result :
Image

Amplify generated shader:
https://mega.nz/#!ghggRa6Z!ympPVOMz0ciCJKSWTvdH2B1UWQBiCfbCzpe_3ZfmIEs

Shader-Forge generated shader:
https://mega.nz/#!JhwzxIiZ!T-jMqfyv7x1q2TCDnlRUHlaPZjGlIPYpmn7-akycnWU
mehrdad995
 
Posts: 4
Joined: Thu Oct 26, 2017 9:19 pm

Re: Manual Specular Implementation Issue?

Postby Amplify_Borba » Sat Oct 28, 2017 9:00 pm

Hello, Borba here, Ricardo is currently unavailable so I'll be replying in his place.

Thank you for the additional information and for providing shader samples, we'll be forwarding these to the developers and will get back to you once we have any new developments on this issue.

Also, did you try setting the View Direction's coordinate space to Tangent?
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: Manual Specular Implementation Issue?

Postby mehrdad995 » Sun Oct 29, 2017 3:50 pm

Thank you so much Borba.
yes I did, It behaves even more weird after that.

world space:
https://www.dropbox.com/s/wx4w6y5bb6xu5th/WorldSpace.gif

tangent space:
https://www.dropbox.com/s/pn5we38md1qsek0/TangentSpace.gif
mehrdad995
 
Posts: 4
Joined: Thu Oct 26, 2017 9:19 pm

Re: Manual Specular Implementation Issue?

Postby Amplify_RnD_Rick » Mon Oct 30, 2017 10:54 am

Hi mehrdad995,

I've looked at the shader you shared and the reason it's giving those strange results is because your half vector is not calculated correctly .
The Blinn-Phong half vector is calculated by summing the view direction with the light direction and then normalizing the result.

Here's your sample with the fixed half-vector:
HalfVector.JPG
HalfVector.JPG (85.62 KiB) Viewed 5380 times


Please don't hesitate on reaching us if you have further questions or stumble into any issues!
Amplify_RnD_Rick
 
Posts: 40
Joined: Wed Mar 01, 2017 6:33 pm

Re: Manual Specular Implementation Issue?

Postby mehrdad995 » Mon Oct 30, 2017 12:27 pm

Hi Rick
I'm at a loss for words, I don't know how to describe how awesome you guys are.
that totally fixed my issue.
thanks you all once again for this precious support <3
mehrdad995
 
Posts: 4
Joined: Thu Oct 26, 2017 9:19 pm

Re: Manual Specular Implementation Issue?

Postby Amplify_Borba » Mon Oct 30, 2017 2:27 pm

mehrdad995 wrote:Hi Rick
I'm at a loss for words, I don't know how to describe how awesome you guys are.
that totally fixed my issue.
thanks you all once again for this precious support <3


No worries, we're always glad to be of assistance!

We're also adding a Shader Function in a future update that will perform the "Half Vector" calculation for your convenience thanks to your feedback, it was extremely helpful and much appreciated!

Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, the Unity Asset Store thrives on user interaction and direct feedback.
Every bit helps, your feedback is extremely valuable to us!

Feel free to get back in touch if you have further issues or questions, thanks!
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


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 0 guests