Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | sentimetalboy | |
Old Version | Published before Godot 3 was released. |
I understand how to mate a material double sided using the cull_disabled flag. What I want to know is how to use a different material for the back and front faces of a mesh using the “SIDE” Fragment Shader Built-In. In the documentation is says that the SIDE built-in is of type float, so I tried using an if statement to detect if the side was front or back, hoping that 0.0 would be front and 1.0 would be back or something of that nature. I tried many combinations including negative floats but none would give me different results for back and front faces. In fact I would only get the color I wanted when testing if SIDE was == to 1.0. SIDE seemes always equal to 1.0, no matter if it is back or front facing.
The docs say: “SIDE multiplier, for double sided materials”.
How does"SIDE" work? I’m clearly doing something wrong.
Found this in the output tab:
1116: #ifdef METERIAL_DOUBLESIDED
1117: float side=float(gl_FrontFacing)*2.0-1.0;
1118: #else
1119: float side=1.0;
1120: #endif
It seems like the define for METERIAL_DOUBLESIDED is not being set when cull_disabled is flagged. This might be a bug?