|
@@ -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 );
|
|
|
|