Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot add Point Lights to a scene
    primarykey
    data
    text
    <p>I'm trying to add some Point Lights to a scene, but the scene stops rendering with the following error logged in the Console:</p> <pre><code>ERROR: 0:113: '' : array size must be a positive integer ERROR: 0:113: '' : array size must be a positive integer ERROR: 0:114: '' : array size must be a positive integer ERROR: 0:114: '' : array size must be a positive integer ERROR: 0:115: '' : array size must be a positive integer ERROR: 0:115: '' : array size must be a positive integer ERROR: 0:116: '' : array size must be a positive integer ERROR: 0:116: '' : array size must be a positive integer ERROR: 0:117: '' : array size must be a positive integer ERROR: 0:117: '' : array size must be a positive integer </code></pre> <p>Stack trace is as follows:</p> <pre><code>getShader (type="fragment", string="precision highp float;\n..., fogFactor );\n#endif\n}")three.js line 24659 buildProgram (shaderID="phong", fragmentShader="uniform vec3 diffuse;\nu..., fogFactor );\n#endif\n}", vertexShader="#define PHONG\nvarying v...rldPosition;\n}\n#endif\n}", uniforms=Object { diffuse={...}, opacity={...}, map={...}, more...}, attributes=undefined, defines=undefined, parameters=Object { map=true, envMap=false, lightMap=false, more...})three.js line 24502 initMaterial(material=Object { id=0, side=0, opacity=1, more...}, lights=[Object { id=3, properties={...}, parent={...}, more...}, Object { id=4, properties={...}, parent={...}, more...}, Object { id=5, properties={...}, parent={...}, more...}, 2 more...], fog=null, object=Object { id=8, properties={...}, parent={...}, more...})three.js line 23039 setProgram(camera=Object { id=1, properties={...}, parent={...}, more...}, lights=[Object { id=3, properties={...}, parent={...}, more...}, Object { id=4, properties={...}, parent={...}, more...}, Object { id=5, properties={...}, parent={...}, more...}, 2 more...], fog=null, material=Object { id=0, side=0, opacity=1, more...}, object=Object { id=8, properties={...}, parent={...}, more...})three.js line 23109 renderBuffer(camera=Object { id=1, properties={...}, parent={...}, more...}, lights=[Object { id=3, properties={...}, parent={...}, more...}, Object { id=4, properties={...}, parent={...}, more...}, Object { id=5, properties={...}, parent={...}, more...}, 2 more...], fog=null, material=Object { id=0, side=0, opacity=1, more...}, geometryGroup=Object { faces3=[0], faces4=[1], materialIndex=0, more...}, object=Object { id=8, properties={...}, parent={...}, more...})three.js line 21576 renderObjects (renderList=[Object { buffer={...}, object={...}, opaque={...}, more...}], reverse=true, materialType="opaque", camera=Object { id=1, properties={...}, parent={...}, more...}, lights=[Object { id=3, properties={...}, parent={...}, more...}, Object { id=4, properties={...}, parent={...}, more...}, Object { id=5, properties={...}, parent={...}, more...}, 2 more...], fog=null, useBlending=false, overrideMaterial=null)three.js line 22248 render(scene=Object { id=2, properties={...}, children=[7], more...}, camera=Object { id=1, properties={...}, parent={...}, more...}, renderTarget=undefined, forceClear=undefined)three.js line 22122 animate() line 154 marinbezhanov.com:8080() </code></pre> <p>My code looks like this:</p> <pre><code>if (!Detector.webgl) Detector.addGetWebGLMessage(); var SCREEN_WIDTH = window.innerWidth; var SCREEN_HEIGHT = window.innerHeight; var container, camera, scene, renderer, light1, light2, light3, light4; var clock = new THREE.Clock(); // INIT container = document.createElement('div'); document.body.appendChild(container); // CAMERA camera = new THREE.PerspectiveCamera(80, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 4096); camera.position.set(0, 512, 1024); // SCENE scene = new THREE.Scene(); scene.add(camera); // LIGHTS scene.add( new THREE.AmbientLight( 0x000000 ) ); light1 = new THREE.PointLight( 0xff0040, 2, 50 ); scene.add( light1 ); light2 = new THREE.PointLight( 0x0040ff, 2, 50 ); scene.add( light2 ); light3 = new THREE.PointLight( 0x80ff80, 2, 50 ); scene.add( light3 ); light4 = new THREE.PointLight( 0xffaa00, 2, 50 ); scene.add( light4 ); // GROUND var gt = THREE.ImageUtils.loadTexture("textures/texture.jpg"); var gg = new THREE.PlaneGeometry(4096, 4096); var gm = new THREE.MeshPhongMaterial({color:0x777777, map:gt}); var ground = new THREE.Mesh(gg, gm); ground.rotation.x = -Math.PI / 2; ground.material.map.repeat.set(16, 16); ground.material.map.wrapS = ground.material.map.wrapT = THREE.RepeatWrapping; ground.receiveShadow = true; scene.add(ground); // RENDERER renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT ); container.appendChild( renderer.domElement ); renderer.gammaInput = true; renderer.gammaOutput = true; renderer.shadowMapEnabled = true; renderer.shadowMapCascade = true; renderer.shadowMapType = THREE.PCFSoftShadowMap; // STATS var stats = new Stats(); container.appendChild(stats.domElement); // CONTROLS cameraControls = new THREE.TrackballControls( camera, renderer.domElement ); cameraControls.target.set( 0, 50, 0 ); // ANIMATE function animate() { requestAnimationFrame(animate); var delta = clock.getDelta(); cameraControls.update(delta); renderer.render(scene, camera); stats.update(); } animate(); </code></pre> <p>When I use Directional Lights or Spot Lights instead - the scene renders fine and I get no errors. Any ideas why may this be happening?</p> <p>I'm using <strong>r56</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload