我正在开展一个项目,我将一个着色器应用于一个对象。基本场景用方向灯点亮但是当我向场景添加点光源或聚光灯时,对象完全消失。我在场景中有其他物体没有消失,所以我只能假设它与应用的着色器和点光源有关。以下是我正在使用的着色器的摘录:
var shader = THREE.ShaderSkin[ "skin" ];
var uniformsUV = THREE.UniformsUtils.clone( shader.uniforms );
var textureLoader = new THREE.TextureLoader();
uniformsUV[ "tNormal" ].value = textureLoader.load( "obj/me/all_skin_hi1_normal.jpg" );
uniformsUV[ "uNormalScale" ].value = -1.5;
uniformsUV[ "tDiffuse" ].value = textureLoader.load( "obj/me/all_skin_hi1.jpg" );
uniformsUV[ "passID" ].value = 0;
uniformsUV[ "diffuse" ].value.setHex( diffuse );
uniformsUV[ "specular" ].value.setHex( specular );
uniformsUV[ "uRoughness" ].value = 0.185;
uniformsUV[ "uSpecularBrightness" ].value = 0.7;
var uniforms = THREE.UniformsUtils.clone( uniformsUV );
uniforms[ "tDiffuse" ].value = uniformsUV[ "tDiffuse" ].value;
uniforms[ "tNormal" ].value = uniformsUV[ "tNormal" ].value;
uniforms[ "passID" ].value = 1;
var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true };
var parametersUV = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShaderUV, uniforms: uniformsUV, lights: true };
var material = new THREE.ShaderMaterial( parameters );
material.extensions.derivatives = true;
var materialUV = new THREE.ShaderMaterial( parametersUV );
materialUV.extensions.derivatives = true;
答案 0 :(得分:0)
尝试更新到较新版本的引擎。这为我解决了。