N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

   

gSPFogPosition

Format
#include "gbi.h"

gSPFogPosition(Gfx *gdl,
   int min, int max)
gsSPFogPosition(int min,
   int max)
Arguments
  • gdl is the pointer to the graphics display list
  • min is an int from 0 to 1000 that specifies where fog begins. 0 means begin at the near plane, and 1000 means begin at the far plane. min is usually less than max
  • max is an int from 0 to 1000 that specifies where fog saturates. 0 means saturate at the near plane, and 1000 means saturate at the far plane. max is usually set to 1000 so that images fade out as they approach the far plane where they are clipped
What This Macro Does
It sets the thickness of the fog by changing the color of objects based on their Z position. Generally objects that are farther away (from the viewer) are blended with the "fog color" (see gDPSetFogColor). The farther the object, the closer the object's color gets to the fog's color. This effect can be used to make objects fade into the distance instead of being abruptly clipped away when they reach the far clipping plane.

To use this effect set the max parameter to 1000 to cause the object to be totally fogged out at the far plane. Use the min parameter to set the distance at which the object begins to fade into the fog. This can be the front clipping plane (min=0) or partway between the front and back planes (0<min<1000).

Example
To turn fog on, use this code:
gDPSetCycleType(glistp++,
   G_CYC_2CYCLE);
gDPSetFogColor(glistp++,
   fog_red, fog_green,
   fog_blue, 0xff);
gDPSetRenderMode(glistp++,
   G_RM_FOG_SHADE_A,
   G_RM_AA_ZB_OPA_SURF2);
gSPFogPosition(glistp++,
   500, 1000);
gSPSetGeometry(glistp++,
   G_FOG);
See Also
gDPSetFogColor
gDPSetRenderMode
gDPSetCycleType



Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.


Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998