【发布时间】:2019-07-28 21:28:44
【问题描述】:
我有一个模型、一个背景天空和一个地面。对表面进行纹理处理会导致没有表面。
我已经尝试了基本方法并得出结论,可能是在纹理完成加载之前渲染了场景。在搜索并找到了各种可能的解决方案后,我尝试了其中的几个,但并没有真正理解它们应该如何工作。他们都没有工作。一个问题是它是一个老问题,并且大多数建议都涉及过时的three.js库版本。
// Ground
// create a textured Ground based on an answer in Stackoverflow.
var loader = new THREE.TextureLoader();
loader.load('Textures/Ground128.jpg',
function (texture) {
var groundGeometry = new THREE.PlaneBufferGeometry(2000, 2000, 100, 100);
const groundMaterial = new THREE.MeshLambertMaterial({map: texture});
var ground = new THREE.Mesh(groundGeometry, groundMaterial);
ground.receiveShadow = true; //Illumination addition
ground.rotation.x = -0.5 * Math.PI; // rotate into the horizontal.
scene.add(ground);
}
);
// This variation does not work either
http://lhodges.users37.interdns.co.uk/me/downloads/Aphaia/Temple.htm http://lhodges.users37.interdns.co.uk/me/downloads/Aphaia/Temple7jsV0.15b.htm
上面的第一个是完整的页面,其中地面是一个普通的台球桌绿色。第二个是包含上述代码的页面。
似乎没有错误(我上次尝试过。)
【问题讨论】:
标签: three.js textures delayed-loading