Problems with using Mesh.material as array

var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
var mesh = new THREE.Mesh( geometry, [material] );
var materialProperties = properties.get( [material] );

materialProperties is empty object. Is it right behavior?

Callstack of bug:
Uncaught TypeError: Cannot read property 'getUniforms' of undefined
at setProgram (three.js:24111)
at WebGLRenderer.renderBufferDirect (three.js:23123)
at renderObject (three.js:23845)
at renderObjects (three.js:23815)
at WebGLRenderer.render (three.js:23608)

How can I render multimaterial meshes by WebGLRenderer?

Not sure what you want to achieve.
20190306-0903-48577


<!DOCTYPE html>

<head>
	<title> material test </title>
	<meta charset="utf-8" />
	<style>	body { margin: 0;}</style> 
</head>
<body> 	</body>
<script src="three.min.102.js"></script>
<script src="OrbitControls.js"></script>

<script>

// @author hofk

var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 65, window.innerWidth / window.innerHeight, 0.1, 100 );
camera.position.set( 2, 1, 4 );
var renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setClearColor( 0xdddddd, 1 );	
var container = document.createElement( 'div' );
document.body.appendChild( container );
container.appendChild( renderer.domElement ); 

var controls = new THREE.OrbitControls( camera, renderer.domElement );

//var material = [ new THREE.MeshBasicMaterial( { color: 0xffff00  } )  ]; // one side

 var material = [ new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide  } ),
	new THREE.MeshBasicMaterial( { color: 0x00ff00, side: THREE.DoubleSide  } )
 ]; // two sides
 
// for a box: use up to 6 materials in array

var g = new THREE.BoxBufferGeometry( 1 ,1, 1 );

var mesh = new THREE.Mesh( g, material );
scene.add( mesh );

animate();

function animate() {

	requestAnimationFrame( animate );	
	renderer.render( scene, camera );
	controls.update();
	
}
</script>

</html>

@zhuravlev12
Hi!
Any chance to provide a live working example that shows the problem?

BTW: Accessing WebGLProperties should not be necessary for app level code. Why are you doing this?

Thanks, I just didn’t understand what it means. I need to use material as element, not as array with one element.