PBR Fresnel Effect?

Is there a way to create a fresnel effect with two colors in PBR?

I’m trying to get yellow and orange to appear at different angles like in this pic:

You would need to use Node Material for that or a custom PBR Material. Adding @PatrickRyan if he gets another idea ?

2 Likes

@adam, you will want to stack several fresnel operations lerping between colors using the fresnel as the gradient. So you can end up with something that looks like this:

This is using two fresnel operations, one to mask out just the very edge and lerp between the edge colors (orange and pink) and the base color (red) and the second fresnel operation is masking the lerp between the previous colors (orange/pink and red) and the center highlight (yellow).

The masks look like this:

Edge Fresnel

Center Fresnel:

And then to control the fade of the colors on the edge, I am using the dot product of the world normal of the surface and the down vector (so the edge reflections blend to imply reflected light) and that mask looks like:

Lastly, I am also taking a rotation of the view direction to the right by using camera.view (z, 0, -x) and dotting that with the world surface normal to get a mask that looks like:

Which is then multiplied with the second fresnel for the yellow hightlights to produce a mask that looks like:

The final shader looks like:

You can find the shader here as a reference. The effect will benefit from a model with a normal texture as well since you will have a more interesting surface normal to mask. Hope this gets you started but feel free to drop questions here.

5 Likes

You always impress me @PatrickRyan !!!

1 Like

Ditto!

1 Like

One thing I forgot to mention in my last post is that for PBR, you would use the base color texture in place of baseColor in the shader and then rather than wiring the final mix into the fragOut, you would wire that into the baseColor input for the PBR node. One thing to note is that the baseColor input expects linear color, so you would want to set convert to linear space on all of your color3 blocks as well as your texture block:

image

Thanks, Patrick. This looks very promising. I am currently using the regular PBRMaterial with an albedo texture (that I create using CustomProceduralTexture), a bump texture, and a reflectivity texture. I’m hoping I can simply redefine my PBRMaterial to a PBRCustomMaterial and then use the shader code from your node material example (which I will then tweak to my needs).

1 Like