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

点阴影文章代码有一处和原文不一样 #85

Closed
pengchengo opened this issue Sep 13, 2017 · 1 comment
Closed

点阴影文章代码有一处和原文不一样 #85

pengchengo opened this issue Sep 13, 2017 · 1 comment
Labels

Comments

@pengchengo
Copy link

#version 330 core
in vec4 FragPos;

uniform vec3 lightPos;
uniform float far_plane;

void main()
{
// get distance between fragment and light source
float lightDistance = length(FragPos.xyz - lightPos);

// map to [0;1] range by dividing by far_plane
lightDistance = lightDistance / far_plane;

// Write this as modified depth
gl_FragDepth = gl_FragCoord.z;

}
应该是gl_FragDepth = lightDistance;

@Krasjet
Copy link
Member

Krasjet commented Sep 13, 2017

这节还没重写,目前4-9之后的都会与原文有点不同,等我重写到那一节的时候一起改吧

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

No branches or pull requests

2 participants