Providing OBJ and MTL Files - taccGL™ Tutorial
OBJ files are usually accompanied by MTL files. While OBJ files contain the 3D model
itself MTL files contains material definitions, e.g. color definitions.
If a MTL file is not present or not accessible the color defined with the taccgl™
color method is used that, however, is transparent per default.
So if the model does not appear at all, it is possbile that the MTL file is missing
and no color is set (and so the model is transparent) or that the OBJ
Both files need to be placed somewhere on a web server. The read
method takes an URL as parameter that must point to the OBJ file,
The host name part can be left out, if the obj file is on the same
server as the web page (as in the example above). So far this works
just as in the case of image (e.g. .png/.jpg) files.
HOWEVER, care has to be taken, when testing locally without
a web server! Then you need to start the browser with special
options, which are described in Chrome Options for Local Use
and in the download package. We recommend to use a local
web server, which avoids these problems.
The name of the .MTL file is stored in the .OBJ file. The program that
stores the .OBJ file usually also stores the MTL file and puts
the name of the MTL file in the OBJ file. Some programs give both files
the same name, others let you select the name of the MTL file (then you cannot specify
an absolute path when using taccgl™).
taccgl™ prepends hostname and path of the OBJ file to the MTL file
name, so that it is usually ok to place OBJ and MTL file in the
It is advisable to compress OBJ and MTL files. If you want to use OBJ and MTL
files cross domain, special options are needed.
WebGL™ is a trademark of the Khronos Group Inc.