提交 6d356c1d 编写于 作者: B Ben Houston

fix bug in Physical with reflectivity not always defined.

上级 ca484bfd
......@@ -88,11 +88,19 @@
var geometry = new THREE.SphereBufferGeometry( sphereRadius, 32, 16 );
for( var alpha = 0; alpha <= 1.0; alpha += stepSize ) {
var localReflectionCube;
for( var alpha = 0, alphaIndex = 0; alpha <= 1.0; alpha += stepSize, alphaIndex ++ ) {
var roughness = 1.0 - alpha;
if( alphaIndex % 2 === 0 ) {
localReflectionCube = null;
}
else {
localReflectionCube = reflectionCube;
}
for( var beta = 0; beta <= 1.0; beta += stepSize ) {
var metalness = beta;
......@@ -102,7 +110,7 @@
// basic monochromatic energy preservation
var diffuseColor = new THREE.Color( gamma, 0, 0 ).multiplyScalar( 1 - 0.08 );
var material = new THREE.MeshPhysicalMaterial( { map: imgTexture, bumpMap: imgTexture, bumpScale: bumpScale, color: diffuseColor, metalness: metalness, roughness: roughness, shading: THREE.SmoothShading, envMap: reflectionCube } )
var material = new THREE.MeshPhysicalMaterial( { map: imgTexture, bumpMap: imgTexture, bumpScale: bumpScale, color: diffuseColor, metalness: metalness, roughness: roughness, shading: THREE.SmoothShading, envMap: localReflectionCube } )
var mesh = new THREE.Mesh( geometry, material );
......
#if defined( PHYSICAL ) || defined( USE_ENVMAP )
uniform float reflectivity;
#endif
#ifdef USE_ENVMAP
uniform float reflectivity;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册