[comp.sys.sgi] SGI VGX Texturing

pratt@TAURUS.CS.NPS.NAVY.MIL (david pratt) (02/28/91)

Greetings,

     We are working on a 3D vehicle simulator, called NPSNET, and it is
working quite well. We have 500 vehicles moving over the terrain in
real time with texture and fog on a 4D 240/VGX. But all is not happy at
Zydaville (the town in the simulator)!  When the texturing is turned on,
with scrsubdivide set to 10 pixels, I get a polygon edge mismatch.  This
results in the clear color showing through the terrain.  It is very 
noticeable when we sail the ships on the ocean or drive/fly over large flat
areas.  I have subpixel(TRUE) on and tried polysmooth(PYSM_ON) with no luck.  
Does anybody out there in netland have any ideas? How about SGI?  

                                             Dave

-- 
Dave Pratt               pratt@cs.nps.navy.mil  (408) 646-2865
If the meek shall inherit the earth, I'm SOL!
These are my opinions, who knows what the Navy thinks.

rad@home.asd.sgi.com (Bob Drebin) (03/01/91)

You have to be careful when using scrsubdivide().  As noted in the man page:

     When the screen size of subdivided polygons is limited, either by minsize
     or by maxsize, adjacent polygons can subdivide differently such that
     newly created vertices on their shared boundary do not coincide.  In this
     case, some pixels at their shared boundary may not be scan converted by
     either polygon.

I can suggest two solutions: 

1)  Only use maxz to control subdivision.  Disable minsize and maxsize
    by setting them to zero.  This will prevent T-verticies from being 
    generated, which cause the pixel dropouts.  

2)  Use anti-aliased lines. Draw your scene using your current scrsubdivide
    parameters, then redraw the outlines of troublesome polygons using 
    anti-aliased lines.

    For example:
	/* draw the scene */
	zbuffer(TRUE);
	blendfunction(BF_ONE,BF_ZERO);
	scrsubdivide(SS_ON,myparms);
	draw_terrain();
	scrsubdivide(SS_OFF,myparms);
	draw_nontextured_stuff();

	/* redraw outlines of textured polys */
	blendfunction(BF_SA,BF_MSA);
	polymode(PYM_LINE);
	linesmooth(SML_ON);
	scrsubdivide(SS_ON,myparms);
	draw_terrain();		 


Hope this helps.

Bob Drebin, SGI

P.S.:  The function polysmooth does not work with textured polygons.  This
       is noted in its man page.