Loading Objects

by Mike Gleicher on October 20, 2015

You may have noticed, designing 3D object is a pain if you have to type in every single vertex position.

We want you to do this once or twice, so you can see how hard it is.

After that, it grows old. And you realize that to make a fancy object what you’ll really do is to make is using some modeling software, or scan it, or find it on the web. This means the model will be stored in some file format. So your program needs to figure out this file format, read it in, and convert it to your data structures.

Learning to understand a file format is good practice (we used to make students do it). But now, we’ll give you JavaScript code that will read in a common object file format. (OBJ files). You can find tons of OBJ files on the web. The reader won’t read them all (it doesn’t have all the fancy features, and a lot of files don’t conform to the specification).

Because of the file loading security issues (the same ones as shaders and textures), if your program isn’t being web served, you can’t load files. So we’re also giving you a web service that will take an OBJ file and turn it into a javascript file that loads the information into objects.

The OBJ Loader (and converter) were written by Yusef Sohail.

 

Print Friendly, PDF & Email

Previous post:

Next post: