Hello.
I have a problem with setting the color. (MeshPhongMaterial)
The link pro-house.site:3012.
Description of the problem:
material in 3d editor. color code 0x775B44. shown in the picture:
Correct initialization of 3d scene in the browser. The colors suit me. The link to the application pro-house.site:3012 . Result on the image:
3.Then the problem arises. Select the roof in the menu on the left, then click on the last color in the list. The color is the same as in the 3d editor 0x775B44. Nothing should happen, but the color changes to not correct. Shown in the images:
code:
Tell me please. What do I do wrong? How can I fix it?
I will be very grateful.
This is not valid format of parameter for .setHex(). It has to be of a hex value, here you pass it as a string.
You can try the other .setXXX() methods of THREE.Color().
For example:
var color = new THREE.Color();
color.setStyle('#' + '0000ff'); // the result string is '#0000ff'
console.log(color);
I reread the documentation, everything is clear. When loading and initializing the scene, the default colors are rusty. Then, the selected color values are parsed. Active colors are set on 3D objects and they are not correct.
I hope the translator translates plainly.
I perfectly understand the difference between “0x” and “#”.
I can see by the code that the colors are specified by the line #. Under any function, the installation is not correct, for example, setStyle(’#ff0000’).