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

第十一章中 Billboard 的 Shader 代码是不对的 #337

Open
luozhaohui opened this issue Aug 15, 2023 · 5 comments
Open

第十一章中 Billboard 的 Shader 代码是不对的 #337

luozhaohui opened this issue Aug 15, 2023 · 5 comments

Comments

@luozhaohui
Copy link

第十一章中 BillboardShader 代码是不对的。如果你把 Chapter11-Billboard.shader 代码中的 Cull Off 修改为:Cull Back,就看不到任何 `Billborad 了。其原因在于:方向转换应该在模型空间的左手坐标系中旋转(结果是正面朝向摄像机),而不是在右手坐标系中旋转(结果是背面朝下摄像机)。因此正确的转换代码应该为:

float3 rightDir = normalize(cross(normalDir, upDir));
upDir = normalize(cross(rightDir, normalDir));
@spicy-ice
Copy link

spicy-ice commented Aug 15, 2023 via email

@ybniaobu
Copy link

叉乘结果在左手坐标系下是左手法则吗

@spicy-ice
Copy link

spicy-ice commented Dec 19, 2023 via email

@TheZoomFlash
Copy link

TheZoomFlash commented Dec 19, 2023 via email

@ybniaobu
Copy link

叉乘结果在左手坐标系下是左手法则吗

所以整个模型翻转了,导致 Cull Back 时模型看不见了,不知道我理解的对不对?

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

No branches or pull requests

4 participants