hello, i am trying to create a long square ceiling light with this code
i add the RectAreaLightUniformsLib.js , to my script
but the results is just a square and nothing is showing like light source
var light = new THREE.RectAreaLight( 0xff0000, 4, 300, 300 );
light.position.set( 1, 0, 0 );
light.lookAt( 0, 0, 0 );
scene.add( light );
var geometry = new THREE.PlaneGeometry( 300, 300 );
var material = new THREE.MeshBasicMaterial({ color: 0xff1100, side: THREE.BackSide });
var mesh = new THREE.Mesh( geometry, material );
mesh.position.copy( light.position );
mesh.rotation.copy( light.rotation );
scene.add( mesh );
MeshBasicMaterial is not affected by lights. Try using a MeshStandardMaterial instead.
Not related, but you should use PlaneBufferGeometry rather than PlaneGeometry. Also removed some other stuff you don’t need here:
var light = new THREE.RectAreaLight( 0xff0000, 4, 300, 300 );
light.position.set( 1, 0, 0 );
scene.add( light );
var geometry = new THREE.PlaneBufferGeometry( 300, 300 );
var material = new THREE.MeshStandardMaterial({ color: 0xff1100 });
var mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
you can do anything, but nothing will come even close to baked textures. load your scene in blender, add any light you want, hit bake. this way you can get near photo realism and it’s extremely cheap, too: https://www.youtube.com/watch?v=lP0SFSrrahA