Gun Modelling Guidelines _________________________ Guns use a set of Display List Setups that are seperate from the model Display List, Similar to the SDK Demos, eg. _________________________________________________________ teapot.c ... // Call the Display List Setup from static.c gSPDisplayList(glistp++, teapot_setup_dl); // Call the Display List containing Geometry from static.c gSPDisplayList(glistp++, teapot_geom_dl); ... Static.c Gfx teapot2_setup_dl[] = { #define PRIM_SHADE PRIMITIVE, 0, SHADE, 0, 0, 0, 0, 1 gsDPPipeSync(), gsDPSetCycleType(G_CYC_1CYCLE), gsSPSetGeometryMode(G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH | G_CULL_BACK | G_LIGHTING), gsDPSetColorDither(G_CD_DISABLE), gsDPSetPrimColor(0, 0, 255, 0, 0, 255), //SET TO RED gsDPSetCombineMode(PRIM_SHADE, PRIM_SHADE), //USE CUSTOM COMBINER TO COLOUR TEAPOT RED gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), gsSPEndDisplayList(), }; Gfx teapot_geom_dl[] = { #include "teapot_tri.h" gsSPEndDisplayList(), }; ... Teapot_tri.h gsSP2Triangles(0, 3, 4, 0, 3, 5, 4, 0), ... gsSP1Triangle(10, 11, 12, 0), //Because only 13 vtx available, we are left with only 1 tri to draw this buffer __________________________________________________________ As you can see above, 2 distinct display lists set up and then draw the teapot. This means that another setup can be called and still draw the teapot without using a whole new display list. Goldeneye uses a similar tactic with guns depending on where they are called. As guns are seperated into Parts, each part calls the setup list again. Drawing guns in hand (1st Person) has a special setup for Secondary tris, this sets up a new rendermode, however combiner is inherited from the parts Primary Triangles. Primitive and Blender Colour Registers are inherited from previous Parts or BG in all circumstances, in fact, everything not specifoed below is inherted. ______________________________________________________________________________________________ Drawing in the Watch Main Page (Normal Opaque gun, same as in hand): Per Part: Set Cycle type to 2Cycle Set Fog Register to D0FFD020 (Approx, almost white, slightly green. Intensity (alpha) is slight) Set Render mode to [C4112048] AA, ImRd, A_CVG (C_Fog*A_Fog)+(C_IN*1-A) (C_IN*A_IN)+(C_MEM*A_MEM) Set Combiner to CC1/AC1 to trilerp CC2(Combined-0)*Shade+0 AC2(Combined-0)*Shade+0 Per Secondary: Set Render mode to [C41041C8] AA, ImRd, FcBl, C_CVG (C_Fog*A_Fog)+(C_IN*1-A) (C_IN*A_IN)+(C_MEM*1-A) Second Page (Spinning) AND anytime "Static" shows All tris are considered "Secondary" Per Part: Set Cycle type to 2Cycle Transparency is using Environment Register. Set Environment Register to FFFFFF80 Set Fog register to D0FFD020 (Approx, almost white, slightly green. Intensity (alpha) is slight) Set Render mode to [C41041C8] AA, ImRd, FcBl, C_CVG (C_Fog*A_Fog)+(C_IN*1-A) (C_IN*A_IN)+(C_MEM*1-A) Set Combiner to CC1/AC1 to trilerp, CC2(Combined-0)*Shade+0 AC2(Combined-0)*Env+0 Drawing in Hand: Per Part: Set Cycle type to 2Cycle Uses Stan Colour as fog register (intensity is inverse brightness). Set Render mode to [C4112048] AA, ImRd, A_CVG (C_Fog*A_Fog)+(C_IN*1-A) (C_IN*A_IN)+(C_MEM*A_MEM) Set Combiner to CC1/AC1 to trilerp CC2(Combined-0)*Shade+0 AC2(Combined-0)*Shade+0 Per Secondary: Set Render mode to [C41041C8] AA, ImRd, FcBl, C_CVG (C_Fog*A_Fog)+(C_IN*1-A) (C_IN*A_IN)+(C_MEM*1-A) Notes: Muzzle Flashes, These have embedded Cycle 1 commands and Set Combiner CC1(Tex0-0)*Shade+0, AC1(Tex0-0)*Shade+0 Since Setup Specifies 2Cycle, muzzle flashes just end displaylist as they are. Most guns could be 1 cycle with no alpha. -Tested and unfortunatly not. Rendermode does not take effect and so model appears black. Its still fogs though. A_Fog (Intensity) is set to 0-128 depending on Stan Colour (Basically 1/255 * Stan * 128), C_Fog = Stan Colour ____________________________________________________________________________________________________ So, the use of rooms becomes obvious for 2 reasons. Not only does it help for ordering triangles in a Z-less environment, but it is also required after any embedded Combiner change. Rendermode should never be changed. Example: If a model is correctly ordered but does not change the setup of display list at all, the gun could be 1 list. If a model has moving parts, while they dont need to be seperate, best practice dictates they should be. If a triangle uses a special setup command, such as shading an environment maped triangle with Primitive colour (since shade is used for normals), the next 'normal' triangle should be a new list. The reason a special setup must end a list is that to return to 'normal' one must choose what is normal. Since there are at least 2 possibilities, we should let GoldenEye set up following triangles. Since each list is preceded by a setup, it meanse no extra commands are required, however it also means that unused geometry lists are repeating setup and become inefficiant. Unused lists in guns should be stripped. To process a gun: First order the triangles from Muzzle to hand to topslide (think layering, you paint each layer from the front to back, but each layer stacks on top of the last). Once this is done, look for moving parts, eg TopSlide. Move that into a seperate list. If the Topslide was not drawn last, you also need to split off any subsequent triangles and seperate them too so they continue to draw after the topslide. Finally look for special display setups such as use of Primitive Colour or change in cull. All subsequent triangles after the special command triangles must be split off. Example model Lists No Moving parts, no special commands (only vtx, tri and C0 texture commands) Entire Model Moving Topslide, no special commands [muzzle,barrel,frame,hand] + Topslide Moving Topslide, non-moving part drawing on top of topslide - lets say an antenna, no special commands [muzzle,barrel,frame,hand] + Topslide + antenna Moving Topslide, CullNone rearsight [muzzle,barrel,frame,hand] + Topslide Moving Topslide, use of Primitive Colour on foresight [muzzle,barrel,frame,hand] + TopslidePt1(up to foresight) + TopslidePt2(rearsight, scope etc)