objFileCreation Methods
taccgl™ currently supports MTL files containing materials
of 3D Models consisting of various 3D objects as meshes. You can
probably create such an MTL file with various programs
supporting the MTL format, however so far only Blender was
tested. Blender creates an MTL file as side effect when
exporting an OBJ file (whereby the Write Materials needs to be
checked).
The MTL file contains definitions for various materials occurring
in the scene. Each material has a name.
For a material an ambient, a diffuse, and a specular color are given
as well as a Shininess.
See Wikipedia
for details.
In short the diffuse color defines the color of the object if the light source shines
on it. The ambient color defines the color that shows up in addition.
The specular color shows up if the light source is directly reflected.
taccgl™ uses the ambient and the diffuse color as given. From the
specular color it just uses its grey value and the color of the light source.
Sometimes it is difficult or tedious to correctly or nicely set the ambient
color. For these cases taccglMTLFile.ambientAdjust can be used.
If taccgl™ detects that an MTL file was created with Blender and
ambient colors are not defined (i.e. black) then it automatically
calls taccglMTLFile.ambientAdjust(0.6,0.6).
These are usually good default values, you can however explicitly call
taccglMTLFile.ambientAdjust if other parameter values are desired.
WebGL™ is a trademark of the Khronos Group Inc.
|