title: Can't change color of THREE.Mesh material, which exists in scene in runtime
body: <p>I have already added some mesh to scene.
  I'm trying to change the color of the material.
  The color changing occurs via color palette from menu.
  Using this jQuery plugin: <a href="http://colpick.com/plugin" rel="nofollow noreferrer">http://colpick.com/plugin</a></p>
  
  <p>I know, that color palette can send me a HSB values, but I use the following function from that plugin:</p>
  
  <pre><code>$.colpick.hsbToHex(hsb)
  </code></pre>
  
  <p>It returns a string, not int value:</p>
  
  <blockquote>
    <p>$.colpick.hsbToHex(hsb)   Receives an object like {h:0, s:100, b:100}
    and returns the corresponding HEX string (with no #).</p>
  </blockquote>
  
  <p>Here I'm calling a function to change the mesh color:</p>
  
  <pre><code>var buttonColorPicker = document.getElementById( 'color-palette-button' );
  buttonColorPicker.onclick = function( sender ) {
      this.changeColorForActiveMesh( this.temporary.colorPicker )
  }.bind( this );
  </code></pre>
  
  <p>Here is the material changing function:</p>
  
  <pre><code>// Note: colorHex isn't an Int, it's a string in this case
  // that's why I'm converting a string to the RGB object
  // with the following bit shifting to get an actual Int representation
  GC3D.Utils.prototype.changeColorForActiveMesh = function( colorHex ) {
      this.scene.children.forEach(function( item ) {
          if ( item instanceof THREE.Mesh ) {
              var rgbObject = this.convertHexToRgb( colorHex );
              var rgbInt = ( ( rgbObject.red &amp; 0x0ff ) &lt;&lt; 16 )
                           | ( ( rgbObject.green &amp; 0x0ff ) &lt;&lt; 8 )
                           | ( rgbObject.blue &amp; 0x0ff );
              item.material.color.setHex( rgbInt );
          }
      }.bind( this ));
  };
  </code></pre>
  
  <p>Here I've prepared function for converting from hex to RGB object:</p>
  
  <pre><code>GC3D.Utils.prototype.convertHexToRgb = function( hex ) {
      var rgbObject = /^0x?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
      return rgbObject ? {
          red: parseInt( rgbObject[1], 16 ),
          green: parseInt( rgbObject[2], 16 ),
          blue: parseInt( rgbObject[3], 16 )
      } : undefined;
  };
  </code></pre>
  
  <p>There is a <code>/^0x?</code> part in Regex, because I'm saving the converted hex value from jQuery plugin to some temporary values.</p>
  
  <p>Proof:</p>
  
  <p><img src="https://i.stack.imgur.com/eODXe.png" alt="enter image description here"></p>
  
  <p>I also tried to make a test here: <a href="http://www.shodor.org/stella2java/rgbint.html" rel="nofollow noreferrer">http://www.shodor.org/stella2java/rgbint.html</a>
  To check how correct counts the final Int my function, but seems to be, it's fine.
  So what's incorrect? Maybe there is another way of changing the color in <code>THREE.JS</code>?</p>
  
  <p><strong>UPDATE #1:</strong></p>
  
  <p>I've changed the type of material from <code>MeshLambert</code> to <code>MeshBasic</code>, and now palette is changing the color correctly! But it's not a solution of this problem, I'm still wondering why MeshLambert doesn't work well in my code... I was trying to set different ambient/color values, but it works very strange... </p>
  
  <p>For e.g.:</p>
  
  <pre><code>new THREE.MeshLambertMaterial({
          color: 0xff00ff,
          ambient: 0x167aff,
          wireframe: false
  });
  </code></pre>
  
  <p>It renders as red:</p>
  
  <p><img src="https://i.stack.imgur.com/WSS6C.png" alt="enter image description here"></p>
  
  <p>But 0xff00ff is: <img src="https://i.stack.imgur.com/fTokj.png" alt="enter image description here">
  And 0x167aff is: <img src="https://i.stack.imgur.com/3ihZC.png" alt="enter image description here"></p>
  
  <p>How it could be red?</p>