使用Three.js法线着色器扭曲法线-r.58 [英] Twisted normals with the Three.js normal shader - r.58

查看:169
本文介绍了使用Three.js法线着色器扭曲法线-r.58的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Three.js r.58普通着色器制作置换贴图.我可以正确地移动它,但是即使我使用了computeTangents(),照明也似乎并没有遵循位移后的法线.

I'm attempting to use the Three.js r.58 normal shader to make a displacement map. I have it displacing correctly, but the lighting doesn't seem to be respecting the post-displacement normals, even when I use computeTangents().

当我关闭位移时,我看到默认法线肯定很有趣.这是一个球体的顶视图,从侧面照亮(白点标记为pointLight):

When I turn off the displacement, I see that the default normals are definitely funny. Here's a top view of a sphere, lit from the side (the white dot marks a pointLight):

这是一个演示页面: http://meetar.github.io/three.js- normal-map-0/index0.html

And here's a demo page: http://meetar.github.io/three.js-normal-map-0/index0.html

是什么原因造成的?哪里有Three.js普通着色器的文档?

What's causing this? And is there documentation for the Three.js normal shader anywhere?

推荐答案

  1. 您没有传递normalMap,这是必需的.尝试传递平坦的声音.

  1. You are not passing in a normalMap, which is required. Try passing in a flat one.

ComputeTangents()可以在具有不连续UV的顶点上做奇怪的事情,例如在北极.

ComputeTangents() can do strange things on vertices that have discontinuous UVs -- like at the north pole.

代码是文档. :-)

这篇关于使用Three.js法线着色器扭曲法线-r.58的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆