Unexpected backface culling

When I distort the geometry of an existing mesh inside a vertex shader, backface culling starts to behave unexpectedly. (My intention: Later, I want to create a complex terrain in my vertex shader instead of doing it on the slow CPU).

See https://playground.babylonjs.com/#89WBI2#1

Scroll down in the source code until you find the line where backface culling is disabled. Enable it and you’ll see what I mean…

What do I need to do to fix this?

Well, what is it you expected backface culling to do when enabled? Now it’s doing what it should: culling the bottom (backface) of the “terrain”

1 Like

Now that you ask me, it makes me think … I expect that backface culling will work for hills and valleys of a terrain.

Maybe the problem in this playground will not occur in a real terrain because I won’t look at it from below, only from above.

1 Like