Double Sided - Flip backface normals

Node-based Shader Editor
Post Reply
NicolasD
Posts: 4
Joined: Wed Dec 05, 2018 3:31 pm

Double Sided - Flip backface normals

Post by NicolasD »

Hello,

I'm making a double-sided shader and I want to flip the normals of the backfaces in order to have a correct lighting.
I'm aware of the Switch by face and Face nodes but I can't feed them to the Local Vertex Normal ports (console info : doesn't work properly with Vertex ports).

I'm wondering if there's another way to flip the normals of the backfaces ?

Nicolas
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Double Sided - Flip backface normals

Post by Amplify_Borba »

Hello, you can invert the Vertex Nomals as per the example below:

Image
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!
NicolasD
Posts: 4
Joined: Wed Dec 05, 2018 3:31 pm

Re: Double Sided - Flip backface normals

Post by NicolasD »

Thank you for you anwser.

However my question wasn't how I can invert the normals of a shader with Cull mode = on, but how I can invert the normals of the backfaces created by a shader with the Cull mode = off while keeping the normals of the frontfaces unchanged.
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Double Sided - Flip backface normals

Post by Amplify_Borba »

Apologies for not understanding at first, in that situation you'll have to manually handle the trigonometry through a dot between the view dir and world normal, here's a simple example:

Image

Please note that this setup should work with the vertex offset / normal ports.
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!
Post Reply