Lighting Problems

#1

Shader code

I have two problems with the shader code. I’m trying to get lighting to work and:

  1. Parts of the bunny I’m using the shader on are transparent.
  2. The lighting is static.

This is kinda new for me so I don’t really know how to debug this. Please ask anything, Thanks.
Video

#2

Do the following:

Set your clear color to red.

If you see any red inside the model…
… disable blending or set the 4.th parameter of the output fragment to 1. If that helps, check your alpha values of the model and the resulting alpha values of all involved transformations. if that does not help…
… disable face culling. If that helps, your triangles have different winding orders and you need to fix it. If it does not help
… you are probably not drawing all triangles correctly, which can have different reasons

If you DON’t see any red in the model…
… enable depth testing. If that does not help…
… disable face culling. If that helps, your triangles have different winding orders and you need to fix it. If that does not help…
… you are probably not drawing all triangles correctly, which can have different reasons.

My bet is that you didn’t enable depth testing since as far as I noticed the “transparency” disappears when there are no overlapping geometries.

#3

Depth testing was the problem for the transparent thing, I had forgotten it after setting up a layer stack. However, the lighting problem still persists, it doesn’t change as the bunny moves. What’s wrong with my shader code?

#4

Nevermind, fixed it.