Importing Third Party 3D Models into Your Tracer
The ply2ray tool converts models of standard .ply format into .ray files. It assumes triangle meshes, and does not working for meshes with quadrilaterals. It should work in most cases. If ply2ray doesn't work or the models you have are not in .ply format, you can try either of the following two workflows.
- Load your model file using MeshLab. If the model looks good, you can save it out by using File->"Export Mesh As".
- Convert the .ply file to a .ray file using ply2ray.
- Copy the mesh content in the .ray file into your scene.
Here are step-by-step instructions for importing models using Blender, a heavier weight tool for 3D models. You can do a lot more with it. Please feel free to explore its potentials.
-
Open up Blender and clear the scene. To do this, hit "A" until all objects (including the camera and viewer) are selected (they'll turn orange), then delete by pressing Delete then Enter.
-
Load your model file via File->Import. You'll want to make sure that it's all one mesh; occasionally 3D models come as a collection of different pieces which are each individual meshes. Hit A until everything is selected, then press CTRL-J to join all of the objects into a single mesh.
-
We'll need to edit the mesh a bit, since sometimes meshes contain quads and we want to convert them to trianlges.
Go to the mode selection (it should say "Object Mode" by default, near the bottom of the screen) and select "Edit Mode." You should see all of the faces in your model selected; if not, hit A until they're all selected. Hit CTRL-F to bring up the Faces menu. Select "Triangulate Faces" to convert them all into trianlges. Now press CTRL-F again, and select "Shade Smooth" (I'm pretty sure this ensures that your vertices all have per-vertex normals).
-
Now you're ready to export. If you want to edit material properties or play with the geometry before doing so, feel free.
-
With the object still selected, go to "File->Export->Stanford (.ply)". Pick a directory and filename for your output file. On the right side of the screen, you can choose PLY export options. Occasionally "UVs" can cause errors when you convert from .ply to .ray. If the ply-to-ray conversion isn't working, you can try exporting without UVs. Hit "Export PLY" to export the file.
-
Use the ply2ray tool using the instructions provided, and then take the .ray file and copy the mesh inside it into an actual scene (one with cameras and lights, of course). You'll also want to add some material properties to your mesh manually unless you already did so within Blender.
Websites with 3D Models
http://archive3d.net
http://thefree3dmodels.com
http://www.blender-models.com