Page 1 of 1

How to exactly control Fresnel colours

PostPosted: Mon Jul 02, 2018 3:20 pm
by Monobanda
Hello all,

Using ASE, I created a shader that uses the Fresnel node.
I want to achieve the effect of having different colours for the base of an object, and the rim. So for instance a cobalt blue sphere with a bright red rim as a result of Fresnel effect.

So far, this is what I've achieved:
Image

Unfortunately this setup appears to make the rim a "mix" from both colours. So Instead of red, it produces a fuchsia pink colour, like this:
Image

How can I make sure I can have total control over both colours?

Cheers and thanks!

Re: How to exactly control Fresnel colours

PostPosted: Mon Jul 02, 2018 3:55 pm
by Amplify_Borba
Hello, thank you for getting in touch!

Unfortunately, the images seem to be broken, could you please try uploading them to a free image service such as imgur, and share a few additional details regarding the effect you want to create?

Do you want the rim coloring to disregard the base color from the object?

If so, you could consider using the Fresnel's output as the alpha of a Lerp between two colors, for example.

Image

Thanks!

Re: How to exactly control Fresnel colours

PostPosted: Wed Jul 04, 2018 9:25 am
by Monobanda
Hi, thank you for answering.

My images were already uploaded on Imgur, kind of lame that they don't show...
But anyway, the problem is fixed, thanks to your setup.
Great job! Thank you!

Re: How to exactly control Fresnel colours

PostPosted: Wed Jul 04, 2018 10:27 am
by Monobanda
Whoops - too soon. Turns out it didn't completely solve the problem. Some colours still don't display as desired.

Take a look at the two images... (also if for some reason the images are broken again - just right-click and open them in a new tab, works for me!)
Image
Image

See how the picked colours in the Inspector don't match up with the colours in my Scene (mostly the rim colour)?

Not sure what I've done wrong... Also I sometimes use the Saturate node when I have a feeling the colours get out of hand, but whether I plug it in or not, this time it doesn't change anything.

Any ideas?

EDIT: I don't use any lighting in my Scene other than the default environmental lighting.

Re: How to exactly control Fresnel colours

PostPosted: Wed Jul 04, 2018 12:02 pm
by Amplify_Borba
The values might need some further tweaking in order to accommodate to different situations, please refer to the example setup below:

Image

I've connected the node setup to the Emission, since it controls the colour and intensity of light emitted from the surface regardless of the lighting conditions, in order to preserve the colors.

Adding the Saturate node and a Round node to the Fresnel's output can also ensure that the values remain at either 0 or 1, so that the Mask passed into the Lerp Alpha has no values in-between, which would cause the colors to blend.

Please let me know if this helps, thanks!

Re: How to exactly control Fresnel colours

PostPosted: Wed Jul 04, 2018 12:22 pm
by Monobanda
That seems to do the trick! Thank you.

Re: How to exactly control Fresnel colours

PostPosted: Wed Jul 04, 2018 1:06 pm
by Amplify_Borba
Glad to be of assistance!

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!