OpenGL 3D Game Tutorial 11: Per-Pixel Lighting

Channel:
Subscribers:
244,000
Published on ● Video Link: https://www.youtube.com/watch?v=bcxX0R8nnDs



Category:
Tutorial
Duration: 14:34
113,137 views
1,917


LWJGL tutorial series on how to create a 3D Java game with OpenGL!

This week we add per-pixel diffuse lighting to the game, making everything look that little bit more epic!


Common Problems:

- Make sure that you are calling bindAttributes() *before* glLinkProgram() in the ShaderProgram constructor. Also, check that you spelled the "in" variable names correctly in the "bindAttributes()" method in the StaticShader class.

-If your dragon seems to have lots of white and black patches then it could be one of 2 problems:

1. Your texture dimensions might not be powers of 2 (64x64, 128x128, 256x256 etc.)

2. If they are powers of 2 then try adding the following lines to the end of the loadTexture() method, just before returning the texture ID:
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);


Stanford Dragon Model: https://www.dropbox.com/sh/gscenjij7ny3xz1/AADQ3u6Ve96PP3ajyJP81ETSa?dl=0
Source: Stanford University Computer Graphics Laboratory

Vector maths basics:
http://www.bbc.co.uk/bitesize/higher/maths/geometry/vectors/revision/1/

Dot product:
http://betterexplained.com/articles/vector-calculus-understanding-the-dot-product/


Support the series on Patreon: https://www.patreon.com/thinmatrix

Facebook Page: https://www.facebook.com/thinmatrix
Tumblr: http://thinmatrix.tumblr.com/
Instagram: http://instagram.com/thin_matrix
Twitter: https://twitter.com/ThinMatrix
Check out my game on IndieDB: http://www.indiedb.com/games/equilinox

End of video music- Kai Engel, "Waking Stars":


http://freemusicarchive.org/music/Kai_Engel/Evening_Colors/01_-_Waking_Stars







Tags:
opengl tutorial
lwjgl tutorial
java 3d game tutorial
3d game tutorial
opengl 3+
opengl 3d game
glsl tutorial
world matrix
shaders tutorial
opengl 3D tutorial
3d game
java game
lwjgl
opengl
java
opengl beginners tutorial
game development tutorial
3d game development
glsl
game engine
java game tutorial
java 3d
Tutorial
opengl lighting
diffuse lighting
glsl lighting
per pixel lighting
diffuse lighting explained
glsl per pixel lighting
3D lighting