Skip to content

Update 4-directional-lighting.md #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions getting-started/4-directional-lighting.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {

// 0.2 will be the *minimum* light for objects facing away from the sun. You can mess with this value.
// The sun/moon position must be normalized.
float NdotL = max(0.2, dot(normal, normalize(shadowLightPosition));
float NdotL = max(0.2, dot(normal, normalize(shadowLightPosition)));

finalColor.rgb *= NdotL;
}
Expand All @@ -41,4 +41,4 @@ Congrats! You now have cool shading on entities.

However, take a look at the sky. You may see the sun is a bit... wider than usual. This is because the vertex position for the sky is nonsense.

To fix this, we will need to make another copy `gbuffers_skytextured`, and remove the fog calculation. (Don't forget to remove directional lighting too; you don't want the sun shading itself!)
To fix this, we will need to make another copy `gbuffers_skytextured`, and remove the fog calculation. (Don't forget to remove directional lighting too; you don't want the sun shading itself!)