[RESOLVED] GX_SetFog has anybody ever tried using it? December 27, 2010 08:28PM | Registered: 13 years ago Posts: 363 |
Re: GX_SetFog has anybody ever tried using it? December 28, 2010 02:54AM | Registered: 14 years ago Posts: 118 |
Re: GX_SetFog has anybody ever tried using it? December 28, 2010 04:39AM | Registered: 13 years ago Posts: 363 |
Re: GX_SetFog has anybody ever tried using it? December 28, 2010 06:32AM | Registered: 14 years ago Posts: 118 |
void GX_SetFog(u8 type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor col);
guPerspective(projection, 45, width/height, 0.1f, 100.0f); GX_LoadProjectionMtx(projection, GX_PERSPECTIVE);
GX_SetFog (GX_FOG_PERSP_EXP , 620, 630, 0.1f, 100.0f, c );
Re: GX_SetFog has anybody ever tried using it? December 28, 2010 05:24PM | Registered: 13 years ago Posts: 363 |
Re: GX_SetFog has anybody ever tried using it? December 29, 2010 03:11AM | Registered: 14 years ago Posts: 118 |
// Previously defined variables: Mtx44 projection; f32 width, height; // Fog variables GXFogAdjTbl fogTable; bool fogAdjust = true; GXColor fogcolor = {128,128,128,255}; // Set up the projection matrix guPerspective(projection, 45, width/height, 16.0f, 1024.0f); GX_LoadProjectionMtx(projection, GX_PERSPECTIVE); // Set pixel processing mode GX_SetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR); GX_SetZMode(GX_TRUE, GX_LESS, GX_TRUE); // Start the fog at 16 and end at GX_SetFog(GX_FOG_LIN, 16.0f, 1024.0f, 16.0f, 1024.0f, fogcolor); // Adjust the scene so that the sides of the screen are properly fogged. if (fogAdjust){ GX_InitFogAdjTable(&fogTable, (u16) width, projection); GX_SetFogRangeAdj(GX_ENABLE, (u16) width/2, &fogTable); } else{ GX_SetFogRangeAdj(GX_DISABLE, 0, NULL); }The fog does seem to be a "white tint" as you call it. The entire screen is not actually blanketed in fog. GX calculates the fog for each polygon's distance from the viewer. Use the same background color as the fog and the objects will appear to "fade" into the distance.
Re: GX_SetFog has anybody ever tried using it? December 29, 2010 04:28AM | Registered: 13 years ago Posts: 363 |
Re: GX_SetFog has anybody ever tried using it? December 29, 2010 05:42AM | Registered: 14 years ago Posts: 118 |
Re: GX_SetFog has anybody ever tried using it? December 29, 2010 07:08AM | Registered: 13 years ago Posts: 363 |
Re: GX_SetFog has anybody ever tried using it? December 29, 2010 11:40PM | Registered: 14 years ago Posts: 118 |
Re: GX_SetFog has anybody ever tried using it? December 30, 2010 05:54AM | Registered: 13 years ago Posts: 363 |
float camera_draw_distance=10000; GRRLIB_3dMode(1,camera_draw_distance,45,0,0); void draw_fog( u32 color ) { GXColor fogcolor = {R(color),G(color),B(color),A(color)}; GX_SetFog(GX_FOG_LIN, 0, camera_draw_distance/2, 1, camera_draw_distance, fogcolor); GX_SetCopyClear(fogcolor, GX_MAX_Z24); }
Re: GX_SetFog has anybody ever tried using it? December 30, 2010 07:38AM | Registered: 14 years ago Posts: 118 |
Re: GX_SetFog has anybody ever tried using it? December 30, 2010 03:59PM | Registered: 13 years ago Posts: 363 |