Skip to content
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

Floor's normal may be inverted #277

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Pierce-qiang
Copy link
Contributor

Dear Author,
I noticed that in your chapter 5 advanced_lighting ->
1.advanced_lighting && 2.gamma_correction && 3. shadow_mapping_depth
In your code, the floor data's normal is inverted, that is Clockwise, notice cross(x, z) = -y
When I cull the front face, the floor disappears. While moving the camera under the floor I can see it

@JoeyDeVries
Copy link
Owner

Hey! Default culling mode is back face culling. When you call the front face the floor is indeed expected to dissapear as the top part of the floor is its front face.

@Pierce-qiang
Copy link
Contributor Author

Oh! I'm sorry for saying wrong, I mean cull the back face!!!
You can see the vertex sequence to check it!
Or just cull the back face to test it.

@Pierce-qiang
Copy link
Contributor Author

Oh, I see. You invert normal to reserve floor's depth when using the method which culls the front face to solve Peter panning problem.
In this way, the floor will not be culled when acquiring a depth map.

@JoeyDeVries
Copy link
Owner

Ahh, forgot about that for the shadow mapping; indeed, not necessary for gamma correction and advanced lighting. You can commit these separately if you want, but I won't commit the changes for shadow mapping tutorials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants