README 4.48 KB

This directory contains a translator program that can go to and from both
MultiGen Openflight v.14.1 files and Lightscape radiosity solution and 
preparation files.  Some files contain proprietary file format information
for MultiGen or Lightscape.

The program can be invoked by compiling the test program (test.C) with the
desired #defines set for input and output file format.  Note that this is 
research code developed at the University of North Carolina - it is not a
finished product by any means.

When MultiGen and Lightscape come out with new releases, they will almost 
certainly change their respective formats, so the relevant files may need
to be updated.  I plan to maintain the code, so you can get in touch with
me about newer versions:

	Mike Goslin
	UNC Chapel Hill Dept. of Computer Science
	CB #3175 Sitterson Hall
	Chapel Hill, NC 27599
	(919)962-1719
	goslin@cs.unc.edu

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

PATHWAY FROM ORIGINAL MODEL TO ILLUMINATION-TEXTURED VERSION

1)	Original models are in MultiGen OpenFlight format (".flt").  You can
	apply a high frequency texture to surfaces (e.g. brick) and this
	will be preserved through the pipeline.

2)	Run flt2lp on the .flt file to output a Lightscape preparation file
	(".lp").  This can be loaded into the Lightscape software package
	
3)	Compute a radiosity solution in Lightscape and save it out as a 
	Lightscape solution file (".ls")

4)	Now convert the .ls file to a .lsb file using the utility program
	ls2lsb that comes with the Lightscape package.  (should be in
	hosts/subzero/c/lscape/bin).	
	
5)	Now run lsb2flt on the .lsb file with a single argument which is a 
	number that indicates the minimum depth of meshing for which a
	texture map will be generated.  Reasonable values for this are from
	0 to 3, depending on the desired proportion of textured faces to
	gouraud-shaded faces that are desired (more textures or more geometry).
	lsb2flt outputs a .flt file and a number of texture files.
	NOTE lsb2flt needs 3 binary files to generate the .flt file:
		attr.bin
		ctab.bin
		mtab.bin
	(make sure you have links to these or include them)

6)	The textures output by lsb2flt are not scaled to appropriate Ultra64
	sizes, so you can use the fiximg script to scale them all to be
	no larger than 32x32 and also to be divisible by 4 (tmem needs this
	for proper alignment in 32-bit mode).

7) 	Finally, move the texture files into a directory /Textures in your
	current directory and run flt2walk to generate ultra64 files.
	Useful arguments for flt2walk:
		-3 	(32-bit mode)
		-s 100 	(100 is a good scaling value)
		-p	(if you want portals to kick in)
		-m	(to specify a name for the display list - "model"
			 is default)
		-T #	(for temporal interpolations, # is the number of
			 stages between which to interpolate)
		
HIFREQUENCY TEXTURES
	
	If faces are textured on input to flt2lp, it is assumed that these
	are high frequency textures and the faces are flagged as such.  
	lsb2flt will then generate a comment on the faces in the output 
	.flt file indicating the desired texture file:
		HIFREQ	brick.rgb, for example
	If flt2walk encounters such a comment, it will look for the .rgb
	file in the /Textures directory and generate a combined hifrequency
	texture on that face.  The current implementation expects both
	the hifrequency texture and the illumination texture for the face
	to be 20x20 in size.

TEMPORAL INTERPOLATION
	
	To create a temporal interpolation sequence, run the desired number
	of Lightscape radiosity solutions on the same .lp file and save them
	out as a sequence of <filename>#.ls files.  Convert them to .lsb, 
	and then generate .flt files for them.  Now comes the fun part -> you
	must ensure that every stage has the same number of textures.  Also,
	the first texture in each stage should be the same size, the second in
	each the same size, etc.  Finally, textures should all be no larger
	than 20x20 (but they can be smaller).  Once you have scaled all
	the textures and moved them into /Textures, run flt2walk with the
	-T option.  It will expect a sequence of .flt files and will 
	generate a series of files:
		ttexterns.h
		cexterns.h
		ttextures.c
		ttextures[0-n].c
		pttextures.c
		pttextures[0-(n-1)].c
	These files are used to set up texture banks.  You'll also need to
	create a texture segment (see the spec file in the walk demo),
	do some extra operations each frame (see templerp.c in the walk
	demo - also look for #define ENABLE_TEMPLERP).  A good example is
	the pendulum room in the walk demo.