Double Sided - Flip backface normals

Node-based Shader Editor

Double Sided - Flip backface normals

Postby NicolasD » Wed Apr 03, 2019 5:51 pm

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

Re: Double Sided - Flip backface normals

Postby Amplify_Borba » Fri Apr 05, 2019 10:48 am

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!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Double Sided - Flip backface normals

Postby NicolasD » Fri Apr 05, 2019 7:01 pm

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

Re: Double Sided - Flip backface normals

Postby Amplify_Borba » Tue Apr 09, 2019 1:56 pm

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!
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 5 guests