嗨,我正在尝试使用三个贴图(漫反射法线和镜面反射)制作网格,由于某种原因,这里的网格不会渲染是我创建网格的代码。
function initGlobe()
{
var surfaceMap = {map:THREE.ImageUtils.loadTexture("images/earth_surface_2048.jpg")};
var normalMap = {map:THREE.ImageUtils.loadTexture("images/earth_normal_2048.jpg")};
var specularMap = {map:THREE.ImageUtils.loadTexture("images/earth_specular_2048.jpg")};
var shader = THREE.ShaderLib[ "normalmap" ];
var uniforms = shader.uniforms;
uniforms["tDiffuse"].value = surfaceMap;
uniforms["tNormal"].value = normalMap;
uniforms["tSpecular"].value = specularMap;
uniforms["enableDiffuse"].value = true;
uniforms["enableSpecular"].value = true;
var shaderMaterial = new THREE.ShaderMaterial(
{fragmentShader:shader.fragmentShader,vertexShader:shader.vertexShader,
uniforms:uniforms, lights:true}
);
// old ver - delete later var material = new THREE.MeshPhongMaterial(surfaceMap);
var geometry = new THREE.SphereGeometry(1,32,32);
geometry.computeTangents();
return new THREE.Mesh(geometry, shaderMaterial);
}