1
0
mirror of https://github.com/LearnOpenGL-CN/LearnOpenGL-CN.git synced 2025-08-22 20:25:28 +08:00
This commit is contained in:
Meow J
2017-01-12 03:36:00 +08:00
parent b88e8e3571
commit 4014f37934

View File

@@ -32,7 +32,7 @@
```c++
vec3 rgb_normal = normal * 0.5 - 0.5; // transforms from [-1,1] to [0,1]
vec3 rgb_normal = normal * 0.5 + 0.5; // [-1,1] 转换至 [0,1]
```
将法线向量变换为像这样的RGB颜色元素我们就能把根据表面的形状的fragment的法线保存在2D纹理中。教程开头展示的那个砖块的例子的法线贴图如下所示