lwjglgamedev / lwjglbook-leg

Source code of the chapters of the book 3D Game Development with LWJGL 3
https://ahbejarano.gitbook.io/lwjglgamedev/
Apache License 2.0
560 stars 202 forks source link

Bug/missing light intensity specular component #102

Closed neomonkeus closed 2 years ago

neomonkeus commented 2 years ago

The frag shader here is missing the light intensity

Based on the the book here - https://ahbejarano.gitbook.io/lwjglgamedev/chapter10#specular-component specularColour ∗ lColour ∗ reflectance ∗ specularFactor ∗ intensity

even though it later also provides the following sample code. specColour = speculrC * specularFactor * material.reflectance * vec4(light.colour, 1.0);

The function is later corrected in chaper 11 where common functionality is refactored out for calculating the components for Point + Directional lights. https://github.com/lwjglgamedev/lwjglbook-bookcontents/blob/266d58d8270be6f29ab19ee3ac6f22f19ab16d40/chapter11/chapter11.md?plain=1#L162

lwjglgamedev commented 2 years ago

Thanks!