Three.js Hemisphere Light -


i`m examining different types of light dat.gui , three.js (r72) , stucked on dinamically turning on/off hemispherelight. have 1 instance of each light being added scene:

var pointlight = new three.pointlight(this._whitecolor); pointlight.visible = false;  var hemispherelight = new three.hemispherelight(this._whitecolor, this._whitecolor); hemispherelight.visible = false; 

ect...

and buttons turning on/off simple handler. this:

me._sceneobjects.hemispherelight.visible = value; 

so, before rendering lights present in scene, not visible. when executing handler hemisphere light - stay invisible. after excluding hemispherelight.visible = false; works fine.

currently i`m disabling light after rendering 1st frame:

function render() {     code ...      if (!sentenceexecuted && firstcall > 0) {         hemispherelight.light.visible = false;         sentenceexecuted = true;     } else {         firstcall++;     } }; 

i grateful suggestions fix without workaround. sorry possible mistakes in english.

westlangley, thank link wiki article.

after reading , trying examples have found mistake. wanted add "invisible" (using object3d.visible) render lights scene , turn them on/off dynamically.

some lights (in case hemispherelight , spotlight) not work way because of internal three.js rendering algorythm (buffers geometries , materials built without considering lights).

to achieve dynamic lightning author of article suggest to:

  1. add light intensity = 0 , increase (such light taken account render)

  2. force material updated (material.needsupdate = true) affected scene objects after setting light visibility true.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -