This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rcpstructs [2018/04/19 20:51] trenavix created |
rcpstructs [2018/10/01 05:58] (current) David [Vertex Structure] Lowered some capitals in the description, also testing if this summary appears with the waluigi bot. Hi Hack64 discord! |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== RCP Structures ====== | ====== RCP Structures ====== | ||
Every rendition of Fast3D shares a few common structures by the RCP, such as some bit-mapping used within certain opcodes. These are explained within this page. | Every rendition of Fast3D shares a few common structures by the RCP, such as some bit-mapping used within certain opcodes. These are explained within this page. | ||
+ | |||
+ | ===== RSP Geometry Mode ===== | ||
+ | This 32-bit value configures how the RSP will process geometry. They are all 1-bit flags. All of these flags are disabled by default //except// for <color #00a2e8>G_CLIPPING</color>.\\ | ||
+ | <color #1df61d>1</color> is the affected bit, and <color #FF121b>1</color> is the affected bit for F3D and F3DEX (if different from EX2). | ||
+ | |||
+ | ^ Affects Bit ^ Name ^ Description ^ | ||
+ | | <color #206320>0000 0000 0000 0000 0000 0000 0000 000</color><color #1df61d>1</color> | <color #00a2e8>G_ZBUFFER</color> | Enables depth (Z buffer) calculations in the RSP | | ||
+ | | <color #206320>0000 0000 0000 0000 0000 0000 0000 0</color><color #1df61d>1</color><color #206320>00</color> | <color #00a2e8>G_SHADE</color> | Enables calculating vertex color for triangle. Uses flat shading without <color #00a2e8>G_SHADING_SMOOTH.</color> | | ||
+ | | <color #206320>0000 0000 0000 0000 000</color><color #FF121b>1</color> <color #206320>00</color><color #1df61d>1</color><color #206320>0 0000 0000</color> | <color #00a2e8>G_CULL_FRONT</color> | Front-face culling | | ||
+ | | <color #206320>0000 0000 0000 0000 00</color><color #FF121b>1</color><color #206320>0 0</color><color #1df61d>1</color><color #206320>00 0000 0000</color> | <color #00a2e8>G_CULL_BACK</color> | Back-face culling | | ||
+ | | <color #206320>0000 0000 0000 000</color><color #1df61d>1</color><color #206320> 0000 0000 0000 0000</color> | <color #00a2e8>G_FOG</color> | Calculates alpha value of primitives for fog effects | | ||
+ | | <color #206320>0000 0000 0000 00</color><color #1df61d>1</color><color #206320>0 0000 0000 0000 0000</color> | <color #00a2e8>G_LIGHTING</color> | Enables lighting calculations to determine vertex color (determines how the color/normal part of loaded vertices are interpreted) | | ||
+ | | <color #206320>0000 0000 0000 0</color><color #1df61d>1</color><color #206320>00 0000 0000 0000 0000</color> | <color #00a2e8>G_TEXTURE_GEN</color> | Generates spherical texture coordinates, based on X and Y components of the projected version of the normal | | ||
+ | | <color #206320>0000 0000 0000 </color><color #1df61d>1</color><color #206320>000 0000 0000 0000 0000</color> | <color #00a2e8>G_TEXTURE_GEN_LINEAR</color> | Generates linear texture coordinates, based on acos() of X and Y components of the normal, after projection transformation | | ||
+ | | <color #206320>0000 0000 00</color><color #1df61d>1</color><color #206320>0 0000 0000 00</color><color #FF121b>1</color><color #206320>0 0000 0000</color> | <color #00a2e8>G_SHADING_SMOOTH</color> | Enables smooth (Gouraud) shading of primitives. Needs <color #00a2e8>G_SHADE</color> enabled to work. | | ||
+ | | <color #206320>0000 0000 </color><color #1df61d>1</color><color #206320>000 0000 0000 0000 0000 0000</color> | <color #00a2e8>G_CLIPPING</color> | In F3DLX2, can disable clipping calculations, and is on by default. Ignored by other F3D microcodes, clipping is always on. | | ||
+ | |||
+ | ^ Affects Bits ^ Other Meanings ^ | ||
+ | | <color #876407>0000 0000 0000 0000 0000 0000</color> <color #ffc90e>1111 1111</color> | The lowest byte of the geometry mode can be OR'd with <color #B755FF>G_TRI_FILL</color> (0xC8) to generate an appropriate internal triangle opcode, apparently. | | ||
+ | | <color #ffc90e>1111 1111</color> <color #876407>0000 0000 0000 0000 0000 0000</color> | The highest byte of the geometry mode is OR'd with 0x703 to generate a "clip code mask". All that's known about this value is that when set to 0x04 (after ORing, 0x707), "near clipping will occur". | | ||
+ | |||
+ | ---- | ||
===== SetOtherMode ===== | ===== SetOtherMode ===== | ||
Line 108: | Line 130: | ||
* <color #1df61d>__11:__</color> <color #00a2e8>G_BL_0:</color> Constant 0.0 value | * <color #1df61d>__11:__</color> <color #00a2e8>G_BL_0:</color> Constant 0.0 value | ||
+ | ---- | ||
+ | |||
+ | ===== Vertex Structure ===== | ||
+ | |||
+ | Vertices are points in 3D space that are used in drawing triangles. This structure is the same no matter which graphics microcode you use. Each vertex takes up 16 bytes. | ||
+ | |||
+ | ''[<color red>XX XX</color>] [<color green>YY YY</color>] [<color cyan>ZZ ZZ</color>] [<color lightgray>FF FF</color>] [<color orange>UU UU</color>] [<color #AA88DD>VV VV</color>] [<color pink>XR</color>] [<color lightgreen>YG</color>] [<color lightblue>ZB</color>] [<color lightgray>AA</color>]'' | ||
+ | |||
+ | | <color red>XXXX</color> | short | Position on X axis | | ||
+ | | <color green>YYYY</color> | short | Position on Y axis | | ||
+ | | <color cyan>ZZZZ</color> | short | Position on Z axis | | ||
+ | | <color lightgray>FFFF</color> | ushort | Flag. Unknown usage, usually just 0000 | | ||
+ | | <color orange>UUUU</color> | short | Texture coordinate on the U axis | | ||
+ | | <color #AA88DD>VVVV</color> | short | Texture coordinate on the V axis | | ||
+ | | <color pink>XR</color> | byte or ubyte | X unit vector of normal or red color* | | ||
+ | | <color lightgreen>YG</color> | byte or ubyte | Y unit vector of normal or green color* | | ||
+ | | <color lightblue>ZB</color> | byte or ubyte | Z unit vector of normal or blue color* | | ||
+ | | <color lightgray>AA</color> | ubyte | Alpha (Transparency)<nowiki>**</nowiki> | | ||
+ | |||
+ | * You cannot use vertex colors and vertex lighting at the same time. Normals are used if the geometry mode ''G_LIGHTING'' bit is enabled, otherwise the RGB colors will be used instead. (see: [[rcpstructs#rsp_geometry_mode|RSP Geometry Mode]]) | ||
+ | |||
+ | <nowiki>**</nowiki> Vertex alpha cannot be used when fog is enabled. The vertex will use the fog alpha value instead. | ||
---- | ---- | ||
+ | |||
+ |