Open GoogleCodeExporter opened 8 years ago
Your issue looks rather similar to this one:
http://code.google.com/p/jsc3d/issues/detail?id=58.
The problem is the color you passed in to construct a new material should be a
number rather than a string.
By the way, you might have noticed that the shading on the cube is a little
strange. It is caused by excessive averaging when computing vertex normals from
face normals. Jsc3d provides a solution to deal with this: tell the viewer a
appropriate crease angle to preserve sharp edges and remove the unpleasant
shading. It requires just an additional line in the initialization phase:
viewer.setParameter('CreaseAngle', 30);
More details of the parameter 'CreaseAngle' can be found in this document:
http://code.google.com/p/jsc3d/wiki/StartupParameters.
Original comment by Humu2...@gmail.com
on 12 Feb 2014 at 3:33
Thanks a lot for the prompt reply. Really appreciate it
Have converted the color string to number and the code now works.
For newbies - to convert colour string to number
color = color.slice(1); //where color is defined as "#FF0000"
colorNum= parseInt(color, 16);
POONAM BATHIJA
Programming Head
Perfection. Our only endeavour. Thatzit
www.thatzit.com
Original comment by poo...@thatzit.com
on 12 Feb 2014 at 4:48
[deleted comment]
Also, need to know how to save the same object with the new selected color.
POONAM BATHIJA
Programming Head
Perfection. Our only endeavour. Thatzit
www.thatzit.com
Original comment by poo...@thatzit.com
on 12 Feb 2014 at 5:05
Thanks for posting your code snippet! I'm using this to do the conversion:
parseInt('0x' + colorString.substring(1));
It outputs the same result :-)
Saving is NOT supported, though it can be implemented with HTML5 File API. It's
not in my plan.
Original comment by Humu2...@gmail.com
on 13 Feb 2014 at 5:53
Can you help me in writing the code for exporting/saving the new colour
changed object to .obj or .fbx file. as I am not able to do it.
POONAM BATHIJA
Programming Head
Perfection. Our only endeavour. Thatzit
www.thatzit.com
Original comment by poo...@thatzit.com
on 14 Feb 2014 at 9:54
I'll send you a message though email. Please check it there.
Original comment by Humu2...@gmail.com
on 14 Feb 2014 at 11:37
Original issue reported on code.google.com by
poo...@thatzit.com
on 12 Feb 2014 at 7:32