Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What types of geometry definition file format is best used with ray tracing to include the type of material

I wanted to use .obj format, but I noticed that it doesn't have representation for the type of material, i.e. opaque, transparent, reflective. Is there a common file format that includes that information as well, or should I just take the known .obj format and change it so that it'll include that info?

like image 798
SIMEL Avatar asked Dec 06 '10 08:12

SIMEL


People also ask

What is an OBJ file used for?

An OBJ file (. obj) contains information about the geometry of 3D objects. The files are used for exchanging information, CAD, and 3D printing. OBJ files can support unlimited colors, and one file can define multiple objects.

Why is the OBJ format is so popular?

Easy to Read and Write. The biggest strength of the OBJ file format (and its sister MAT material definition file format) is that it is text-based and very simple to understand. As a result of its simplicity, it is usually the first format that any 3D tool imports and exports.

What does an MTL file do?

The MTL file provides color and texture definitions for surface objects (polygonal facets and freeform patches) as defined in an OBJ file.

What is VN in .OBJ file?

vn is the reference number for a vertex normal in the face element. It must always follow the second slash. Face elements use surface normals to indicate their orientation. If vertices are ordered counterclockwise around the face, both the face and the normal will point toward the viewer.


2 Answers

you might want to check mtl-files. Haven't (yet) used it myself though ;)

http://people.sc.fsu.edu/~jburkardt/data/mtl/mtl.html

and

http://people.sc.fsu.edu/~jburkardt/data/obj/obj.html

Cheers

like image 104
Marcus Borkenhagen Avatar answered Nov 09 '22 02:11

Marcus Borkenhagen


.obj can referance .mtl files, which can hold opaque, transparent, reflective, colours, refractive index, and more.

The file is referanced by putting following line at the top:

mtllib *fileName*.mtl

Then in the faces section of the .obj file you can add these:

usemtl *materialName*

Finaly in the MTL file you will want a few sections like this:

# declaration of new material
newmtl *materialName*
# shininess
Ns 0.000000
# ambient colour
Ka 0.200000 0.200000 0.200000
# diffuse colour
Kd 0.800000 0.800000 0.800000
# specular colour
Ks 1.000000 1.000000 1.000000
# refractive index
Ni 1.000000
# transparency
d 1.000000
# illumination model 
illum 2
# texture
map_Kd texName.png
like image 25
Dylan Cook Avatar answered Nov 09 '22 04:11

Dylan Cook