From af3392c99568692795d9f5078d793e8f09a1b9f2 Mon Sep 17 00:00:00 2001 From: KimoriTama <909262251@qq.com> Date: Sat, 4 Mar 2023 15:34:55 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=E8=A7=86=E5=B7=AE=E8=B4=B4=E5=9B=BE?= =?UTF-8?q?=EF=BC=8C=E4=B9=A6=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/05 Advanced Lighting/05 Parallax Mapping.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/05 Advanced Lighting/05 Parallax Mapping.md b/docs/05 Advanced Lighting/05 Parallax Mapping.md index 623ab26..c39b3ff 100644 --- a/docs/05 Advanced Lighting/05 Parallax Mapping.md +++ b/docs/05 Advanced Lighting/05 Parallax Mapping.md @@ -154,7 +154,7 @@ vec2 ParallaxMapping(vec2 texCoords, vec3 viewDir) 有些人更喜欢不在等式中使用viewDir.z,因为普通的视差贴图会在角度上产生不尽如人意的结果;这个技术叫做有偏移量限制的视差贴图(Parallax Mapping with Offset Limiting)。选择哪一个技术是个人偏好问题,但我倾向于普通的视差贴图。 -最后的纹理坐标随后被用来进行采样(diffuse和法线)贴图,下图所展示的位移效果中height_scale等于1: +最后的纹理坐标随后被用来进行采样(diffuse和法线)贴图,下图所展示的位移效果中height_scale等于0.1: ![](../img/05/05/parallax_mapping.png) @@ -205,7 +205,7 @@ vec2 ParallaxMapping(vec2 texCoords, vec3 viewDir) float currentLayerDepth = 0.0; // the amount to shift the texture coordinates per layer (from vector P) vec2 P = viewDir.xy * height_scale; - float deltaTexCoords = P / numLayers; + vec2 deltaTexCoords = P / numLayers; [...] } @@ -230,7 +230,7 @@ while(currentLayerDepth < currentDepthMapValue) currentLayerDepth += layerDepth; } -return texCoords - currentTexCoords; +return currentTexCoords; ```