You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am having a hard time doing the shadow mapping after changing my code according to the chapter "Technical difficulties: linear interpolation with perspective deformations".
My own thought about this problem is that we used the z-value of the original P, but the index (x+y*width) of the shadowBuffer for that z-value comes from the P', (original P after the MVP transformation). So, the pixel doesn't match the z-value.
Please correct me if I am wrong.
Also, I tried to download the sample code from the master branch and run it. But I didn't see the shadow, either. Does anyone successfully do the shadow mapping? Any hints would be helpful, I would appreciate it!
The text was updated successfully, but these errors were encountered:
I fixed this problem by passing both "bc_screen" and "bc_clip" into the fragment shader.
In the triangle() of our_gl.cpp, I store the pts2.z as the fragment_depth instead of pts.z so that I can make sure that the z-value and the x-value & y-value in idx (x+y*width) come from the same point, P'. Now we make the index of the shadowBuffer in this pixel and the z-value of in this pixel consistent.
In the DepthShader, I did almost the same thing as in Lesson 7 (but I tried to save the vertices after MVP into the varying_tri instead of the vertices after VP, while the vertex shader still returned the vertices after VP transformation to the main function).
Then in the Shader, I used "bc_screen" and varying_tri (still, it saved the vertices after MVP) to calculate the (x', y', z') of P'。 And use the (x', y') to get the index to access the shadowBuffer, and compared it with z'。After that, I used "bc_clip" to do whatever we should do to calculate uv, n, and other stuff.
Hi, I am having a hard time doing the shadow mapping after changing my code according to the chapter "Technical difficulties: linear interpolation with perspective deformations".
My own thought about this problem is that we used the z-value of the original P, but the index (x+y*width) of the shadowBuffer for that z-value comes from the P', (original P after the MVP transformation). So, the pixel doesn't match the z-value.
Please correct me if I am wrong.
Also, I tried to download the sample code from the master branch and run it. But I didn't see the shadow, either. Does anyone successfully do the shadow mapping? Any hints would be helpful, I would appreciate it!
The text was updated successfully, but these errors were encountered: