[comp.graphics.visualization] Wavefront's File format

gautamm@ncsa.uiuc.edu (Gautam Mehrotra) (03/14/91)

In article <1991Mar13.233202.25268@jarvis.csri.toronto.edu> drb@eecg.toronto.edu (David R. Blythe) writes:
>In article <38945@netnews.upenn.edu> joe@retina.anatomy.upenn.edu (Joseph Panico) writes:
>>in MOVIE.BYU format. Where can I get MOVIE.BYU and the data formats for
>>both MOVIE.BYU and Wavefront's personal visualizer?
>>
>>                           Joe Panico
[ description of MOVIE>BYU's format deleted]
>I have seen a number of programs that understand this format so its probably
>worth knowing.  So does anybody know the file formats for the personal
>visualizer?
>	david blythe

	Matthew Arrott posted a description of the format some time
back. [ The Subject header on his article was mysteriously missing
..].  I am posting a copy for those who missed it .....

Matt's article follows ...
-----------------------------------------------------------

If I am not mistaken one can call both institutions for this information.

The wavefront object format, if I remember correctly is the same as
their advanced animation package.  That is as follows:


#  This is a comment line
#
#  One moviable object per file.  In other words, a file is the atomic
#    unit of a rigid body system
#  The UNIX directory structure is used as the database structure
#
#  "\" The backlash character is used for line continuation
#  "!" is used as an end of line comment

o square  ! object name : Not used in the advanced animation package [optional]

mtllib  my.mtl your.mtl project.mtl ...     ! material library search 
					    ! path [optional]
maplib my.map your.map ...                    ! map library search path
					      ![optional]

usemtl red    ! current material : all subsequent geometry will be
	      ! assigned this material [optional]
usemap logo ! current map  : all subsequent geometry will be assigned
	    ! this map [optional]
usemap off   ! turn texture mapping off for subsequent geometry

# Maps are the definition of the application of textures to the material
# properties of the object :
#
#      the mapping of the texture to the materials of the object
#
# This definition of the material/texture relationship is not the
# definition of the uvw space of the
#   texture to the xyz space of the geometry.  That definition is
#   facilitated through texture verticies
#   which are dicussed shortly.
#
#  Material and Map files have there own formats
#  Material files are discussed after the object file.

s  1    ! smoothing group : average vertex normals for shared verticies
	!of the same smoothing group
s  off  ! turn smoothing  off

v  0.0  0.0  0.0     ! vertex position 
v  1.0  0.0  0.0
v  1.0  1.0  0.0
v  0.0  1.0  0.0

vt  0.0  0.0  0.0    ! texture vertex position
vt  0.0  1.0  0.0    
vt  1.0  1.0  0.0
vt  1.0  0.0  0.0

vn -1.0  -1.0  1.0  ! vertex normal : may override the smoothing notion,
		     !may need to be normalized
vn  1.0  -1.0  1.0
vn  1.0   1.0  1.0
vn  -1.0  1.0  1.0

p 1 2 3 4               ! a series of four points made up of four index
			! references to verticies ( 1 base )
 
l  1 2 3 4               ! a line made up of four points with the
			 !topology of  vertex 1 to 2 to 3 to 4

f  1 2 3 4               ! a face (polygon) made up of four verticies.
			 !Counter clockwise ordering

f  1/1 2/2 3/3 4/4   ! a face with index references to texture verticies

f  1/1/1 2/2/2 3/3/3 4/4/4   ! a face with index references to texture
			     !verticies and vertex normals

f  1//1 2//2 3//3 4//4           ! a face with index references to
				  ! vertex normals

f  -4 -3 -2 -1          ! a face using relative vertex referencing. "-N"
			! reads: use N vertex ago

# vertices, texture verticies, vertex normals, points, lines, and face
# can be intermixed as long
#   as the referenced stuff is defined before it is referenced.

Material file

#  special characters are the same.

newmtl  red
Ka  0.1 0.0 0.0         ! ambient color responce
Kd  0.4 0.0 0.0         ! diffuse color responce
Ks  0.4 0.0 0.0         ! spectular color
Ns  20                      ! spectular exponent
d  1.0                        ! dissolve   0.0 -- 1.0  transparent --
opaque
illum 1                     ! illumination model  0:color  1:diffuse ligthing
	 		    ! 2:diffuse and spectular lighting


------------------------------------

End of Matt's article ....


hope that helps

cheers,
gautam

---------------------------------------------------------

Gautam Mehrotra,

National Center for Supercomputing Applications, Univ of Illinois.
e-mail:	gautamm@ncsa.uiuc.edu

----------------------------------------------------------