Rendering Commands And Explination			
		==================================			
									
	Any Link Below is truncated to the root of SDK Manual, 		
	This Link is not visible and I request it not be Spread.	
         htt.../NINTENDO%2064%20SDK%205%20_CDROM/man/allman50/  	
		Can Also be downloaded at romhacking			
									
		Compiled By Trevor					
		Credits to Zoinkity for Original Find			
B9 G_SETOTHERMODE_L
typedef struct {
int cmd:8;
int pad0:8;
int sft:8;
int len:8;
unsigned int data:32;
} GsetothermodeL;
GsetothermodeL is identified by the Upper Word B900XXX. The most common iterance of the command is B900031D which means Literally:
	G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, SetRenderMode(). 
  (where B9 = G_SETOTHERMODE_L, 00 = Nothing, 03 = G_MDSFT_RENDERMODE, 1D = SetRenderMode() )
				Nothing is actually Padding for memory Alignment
It is derived from the High Level C Function gsDPSetRenderMode(c0, c1) This is converted by the Pre-Compiler to: gsSPSetOtherMode(G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, SetRenderMode(c0) | (c1)) There are 4 options for G_SETOTHERMODE_L including RenderMode: 0x000000xx = AlphaCompare 0x000002xx = ZSRCSEL [DepthSourceSelect] 0x000003xx = G_MDSFT_RENDERMODE 0x000010xx = Blender [not used in F3DEX - PD] Then there are the following functions after (Replace xx with these). These other options are simplistic and can be summarised per line:
0xXXFunctionLower WordActionDescriptionRESULT
0x02SetAlphaCompare() 0x00000000NoneDo not compare, Normal Non-Transparent Textures (or Multi-Bit Alpha)
0x00000001ThresholdCompare with the blend Colour Alpha value, Used for 1 bit alpha transparent textures if Fog Enabled
0x00000003DitherCompare with a random dither value, Makes for odd Partical effect (eg flies)
0x01SetDepthSource()0x00000000PixelUse the Z value and deltaZ value repeated for each pixel
0x00000004PrimitiveUse the primitive depth register's Z value and deltaZ value.
This is faster but less accurate
/n64man/gdp/gDPSetDepthSource.htm
0x1DSetRenderMode(|)0xFFFFFFFF Options Below
0x10Blender??

! Discontinued and reserved in F3DEX !

Setting the DepthSource to a Primitive Can be used for 'Horizon' Images.
In this case you model a horizon close to the player (a dome or cylinder centered around the players head, but orientated to the world), Then you set its z-value to 0x7fff (Far Clip Plane). This will cause the Horizon Image to always be at the back. FOG however will apply (since FOG is calculated on Z Value) so FOG needs to be disabled for the Horizon Display List.
Example:

// Set cycle type
gDPSetCycleType(G_CYC_2CYCLE); BA001400 00100000
// Set rendering mode
gDPSetRenderMode(G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2); B900031D 00552078
// Set depth source value
gDPSetDepthSource(G_ZS_PRIM); B9000201 00000004
// Set primitive depth
gDPSetPrimDepth(2047, 0); EE000000 7FFF0000

Interesting Note - Decals:
The dz (Delta-Z (Change-In-Z)) value should be set to 0. This value is used for antialiasing and objects drawn in decal render mode and must always be a power of 2 (0, 1, 2, 4, 8, ... 0x4000). If you are using decal mode and part of the decaled object is not being rendered correctly, try setting this to powers of 2. Otherwise use 0.

For refrence I have included Zoinkity's Original Findings.
 upper word
 0000FF00	shift	(PD only: 32-shift-length)
	here are shift values for each of the various segments (hex):
	0	alpha compare
	2	depth source select [ZSRCSEL]
	3	render mode [G_MDSFT_RENDERMODE]
	10	blender Discontinued and reserved in F3DEX
 000000FF	length	(PD only: length-1)
	here are lengths for each of the various segments (hex):
	1	depth source
	2	alpha compare
	1D	render mode (encompases render mode, converge ST, depth mode, and blender from below)
	10	blender Discontinued and reserved in F3DEX 
SetRenderMode() =============== In 2-cycle mode, fog or pass usually is set for c0 and rendering is set for c1. G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, SetRenderMode(c0 | c1) c0 Rendering mode set for first cycle: G_RM_ [ AA_ | RA_ ] [ ZB_ ]* (Rendering type - 1 cycle) G_RM_FOG_SHADE_A (Fog type) G_RM_FOG_PRIM_A (Fog type) G_RM_PASS (Pass type) G_RM_NOOP (No operation type) c1 Rendering mode set for second cycle: G_RM_ [ AA_ | RA_ ] [ ZB_ ]*2 (Rendering type) G_RM_NOOP2 (No operation type) The Blender has a large Part to play in Anti-Aliasing as can be seen by the AA flag. Please read Chapter 15 Anti-Aliasing And Blending, in particular. Also Read /tutorial/graphics/5 Each Rendering Mode also contains a blender MUX which is described later. The common Type for c1 (Mux2) is: GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) For Fog(Which can only occur on c0(MUX1)) its: GBL_c0(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA) Refer to /n64man/gdp/gDPSetRenderMode.htm for more types. Refer to /pro-man/pro12/12-07.htm for Blender Info SDK States:
"Fog can be used in one cycle mode for non-antialiased opaque surfaces only"
I have found this to be false, AA DOES work. The correct RenderMode Settings are AA_En, ZB, ZUpdate, Img_Read, ForceBlender. 1 Cycle Mode is great for Large Untextured Shaded Tris With or without Lighting, however I advise against its use on Textured Tris, Unless you can Guarentee the tri will never be smaller on the screen than the texture resolution, since there is No Mip-Mapping or Tri-Linear Filtering. On A related note about FOG, the docs have given a reason why GE Levels dont have vertex Alpha.
"You cannot, however, use vertex alpha with fog. The per alpha supplied in the vertices will be ignored and if the color combiner selects a SHADE alpha, it will get the fog alpha value instead (not what was intended)."
You can force it but once the vert is beyond FOG_MIN it will loose the alpha OR it will gradually become transparent as it gets further. ---------------------------------------------------------------------------------------- |Cycle Counts are the number of cycles it takes to send 1 px to the FrameBuffer. | |One-cycle mode fills a fairly high-quality pixel. You can generate pixels that | |are perspectively corrected, bilinear filtered, modulate/decal textured, transparent, | |and Z-buffered, at one-cycle-per-pixel peak bandwidth. | | | |Note: Reaching peak bandwidth is difficult. The framebuffer memory is organized in row | |order. In small triangles, it is rare to have long horizontal runs of pixels on a | |single scanline. In these cases, the pipeline is often stalled, pending memory access | |for read or write cycles. | ---------------------------------------------------------------------------------------- Below is Zoinkities Original Find. I have added the RenderCodes that you will see in Section /n64man/gdp/gDPSetRenderMode.htm (eg. G_RM_AA_ZB_OPA_SURF) You may also find 15.7.9 Blender Modes Truth Tables another source of description for flags. For completness of the Lower Word, I have left the Alpha Compare and Depth Sections. I have highlighted them in the same colours as at the top of this page.
=Zoinkitys Original=================================================================================
 lower word
alpha compare   0x00000000 none (New TexEdge - Transparent Textures)
0x00000001   Thred threshold
0x00000003 dither
depth source 0x00000000 pixel
0x00000004 prim Primitive
 
render mode 0x00000008 AA_EN antialias enable
0x00000010 Z_CMP depth compare
0x00000020 Z_UPD depth update
0x00000040 IM_RD image read
0x00000080 C_CVG colour on coverage greater than Unity(1)
-coverage ST 0x00000000 coverage delta-ST clamp
0x00000100 coverage delta-ST wrap
0x00000200 coverage delta-ST full
0x00000300 coverage delta-ST save
-depthmode 0x00000000 Z_OPA depth   (Opaque)
Z Buff 0x00000400 INTER depth (interpenetrating)
0x00000800 Z_XUL depth (Translutent)
0x00000C00 Z_DEC depth (Decal)
0x00001000 CV_XA Coverage * Alpha
0x00002000 A_CVG alpha coverage select (use coverage(or CV_XA)for pixel alpha)
0x00004000 FC_BL force blender
0x00008000 TEX_E Texture Edge: it does the exact same job as Alpha Compare(Threshold)
Nintendo therefore removed this value and states it should be set to 0
It works but should not be used as it overrides Alpha Compare value.
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ This Section to the best of my testing is WRONG! I have a correction below in the next section: Blender Multiplexor decompilation -Highlight the text if you wish to view it anyway. -blender----- 0x00010000 blend 1 machine Multiplier_1 0x00020000 blend alpha memory 0x00040000 blend 1 0x00080000 blend 0 Colour_1 0x00100000 blend colour in 0x00200000 blend colour memory 0x00400000 blend colour blender 0x00800000 blend colour fog Alpha_1 0x01000000 blend alpha in 0x02000000 blend alpha fog 0x04000000 blend alpha shade 0x08000000 blend 0 ------- ---------------------------------------------------- Multipier_0 0x10000000 blend 1 machine 0x20000000 blend alpha memory 0x40000000 blend 1 0x80000000 blend 0 \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Note: Zoink Had Coverage listed as Converge. Coverage is used for AA to determin how much of a pixle is covered by a tri.
i.e. if (1.0) draw pixle, if (0.5) draw pixle at half its colour, and half the BG colour. if (0.0) then draw BG colour. See 15.5.3 Coverage Calculation =====================================================================================================
For easy identification I have drawn a Bit Map of the Lower Half Lower Word B90000 0000XXXX
-Bit Map----------------------------------------------------------------- | [------------------MUX 1 and 2 see Below!----------------] | | 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 |N/A | see MUX BitMap Below | | | | 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 |Bit Number | 0 0 1 0 0 0 0 0 0 1 1 1 1 0 0 0 |Runway 66AFD4 | te fb acs cxa ze zi cf cw cc ir du dc AA Pr Di Th |Flags | [-------------------flags-------------------------][-flags-] | | Flags Confirmed | -------------------------------------------------------------------------
15141312 11100908 07060504 03 02 01 00 Bit Number
0010 0000 0111 1 0 0 0 Runway 66AFD4
0000 0000 0000 0 0 0 0 Bit
TE_ED FC_BL A_CVG CV_XA Z_XUL INTER CFULL CWRAP C_CVG IM_RD Z_UPD Z_CMP AA_EN ZPrim ADith AThre Flags
00 = Z_OPA
11 = Z_DEC
00 = CClamp
11 = CSave

AA_EN = 0

AA_En = 1
RenderMode: RenderMode AA_EN Z_CMP Z_UPD Z_XUL IM_RD AA_EN Z_CMP Z_UPD Z_XUL CVG*A C_CVG FC_BL IM_RD Alpha Compare: THRESHOLD Alpha Compare:None RenderMode: RenderMode AA_EN Z_XUL FC_BL C_CVG IM_RD AA_EN Z_CMP Z_UPD Z_OPA A_CVG IM_RD Alpha Compare:None Alpha Compare:None For more Information on Transparent Primitives go here Blender Multiplexor decompilation ================================= Description of Blender Mux (c0/1): Mux1 or c0 is the first pass in the blender. As stated above it normally takes Fog. Mux2 or c1 sets the second pass. From experiments with CCBL it seems as though the best settings are, Colour_In * Alpha_In + Colour_Mem * Alpha_Mem. You will notice its an equation. CCBL shows this as follows (showing both MUX's)
	[MUX1]					
	( C_FOG * A_Shade + C_IN * 1-A )	
        _______________________________	
		(A_Shade + 1-A)			
						
	[MUX2]					
	( C_IN * A_IN + C_MEM * A_MEM )	
	_______________________________	
		(A_IN + A_MEM)		
	
While there are more entries here than we can edit, the Divisions are automatic. So, Setting c0 Multiplier to 0 ALSO SETS Division to 0 (Instead of 1-A (1 Minus A)) --Download CCBL.N64 (With Alpha Example)
#define	GBL_c0(m1a, m1b, m2a, m2b)	
	(m1a) << 30 | (m1b) << 26 | (m2a) << 22 | (m2b) << 18
#define	GBL_c1(m1a, m1b, m2a, m2b)	
	(m1a) << 28 | (m1b) << 24 | (m2a) << 20 | (m2b) << 16
OK, So MUX is now figured out. To Start with this didnt make sence, but after compiling my own code, it works. The numbers are (16-30) BitShifts. This works out like the following Bit map of the Upper Half Lower Word B90000 XXXX0000:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 Bit Number
0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 Runway 66AFD4
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Bit
0m1a 1m1a 0m1b 1m1b 0m2a 1m2a 0m2b 1m2b Flags
Each Mux Accepts the binary value of the following:
#define G_BL_CLR_IN 00 Colour Combiner Output
#define G_BL_CLR_MEM 01 Previous Mux Colour Output (2 Cycle)
#define G_BL_CLR_BL 10 Blend Colour (one of 3 model colours: Prim, Blend and VertShade)
#define G_BL_CLR_FOG 11 FOG Colour
#define G_BL_A_IN 00 Colour Combiner Alpha Output
#define G_BL_A_FOG 01 FOG Intensity
#define G_BL_A_SHADE 10 Face Alpha
#define G_BL_0 11 0.0
#define G_BL_1MA 00 1.0 Minus Previous Mux Alpha (1-A=)
#define G_BL_A_MEM 01 Previous Mux Alpha
#define G_BL_1 10 1.0
#define G_BL_0 11 0.0
Remember the equation above, The Mux values are inserted as such: [MUX1] ( 0m1a * 0m1b + 0m2a * 0m2b ) <-- I had swapped 1b and 1a to match output (Fog) ________________________________ When I compile Programs, they are in abab (0m1b + 0m2b) order as against GEs seemingly baab Order Ill Add to here that we found the Blender [MUX2] Lookup Table which converts this wrong order ( 1m1a * 1m1b + 1m2a * 1m2b ) to a correct order (ABAB) _______________________________ Its noted that Objects are ABAB (1m1b + 1m2b) If a correct ABAB order is passed the Table Is Ignored. Runway 66AFD4 MUX: [MUX1] ( FOG * AIN + CIN * 1 ) ________________________ (AIN + 1) [MUX2] ( CIN * AIN + CMEM * 1-A ) ___________________________ (AIN + 1-A) For RenderMode LookUpTable for Rooms see PG_RenderMode_Combiner_LookUpTable.txt Key Terms for Renderer: RA - Reduced Antiailising AA - Anti-Ailised ZB - Z-Buffered (Usually Z-Compare & Z-Update together) OPA - Opaque Surface INTER - Interpenetrating surface. Any face that intersects another should have this mode enabled to correctly AA. If such a face is set to OPA then it will not AA at the intersection and will look pixelated. XUL - Transparent Surface, no reason I can see for calling it XUL, but there must be some reason. DECAL - Decal Surface, rendered last and assumed Transparent (objects behind are rendered because it is ignored in culling operations) SURF - Surface SUBSURF - A basic surface that is used to place a decal on. Sub Surfaces have only colour and do not AA. CLD_SURF - a surface used for clouds that does not interfere with AA on other objects. It has no Coverage value as it is assumed that there is no edge. Coverage Coverage Clamp - if coverage reaches 1 then stop and call it an opaque pixel. Coverage Wrap - if coverage reaches 1 then start again from 0. This allows objects in front of objects to AA. Covewrage Full - Assume coverage is 1 and all pixels are opaque. No AA is performed. Coverage Zap - Same as full Coverage save - Do not overwrite memory coverage data for pixel. GoldenEye/Perfect Dark Colour Combiner and Render Mode Translations