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





gDPSetFogColor [macro]

Sets the fog color.

Syntax

#include <ultra64.h> /* gbi.h */
gDPSetFogColor(Gfx *gdl, u32 r, u32 g, u32 b, u32 a)
gsDPSetFogColor(u32 r, u32 g, u32 b, u32 a)

Arguments

  • gdl is the display list pointer.

  • r is the red component of RGBA color (8-bit precision, 0~255).

  • g is the green component of RGBA color (8-bit precision, 0~255).

  • b is the blue component of RGBA color (8-bit precision, 0~255).

  • a is the alpha component of RGBA color (8-bit precision, 0~255).

Explanation
Sets the RDP's fog color. The fog color is a general-use color register in the blender (BL). For details, see Section 12.7.3, "BL Internal Color Registers," in the N64 Online Programming Manual.

Notes
In order to do fog, you must generate fog attenuation coefficients in the alpha channel of the RSP graphics microcode. For details, see gSPSetGeometryMode, g*SPFogPosition.

Cautions
N64 processes fog by Gouraud-shading the fog attenuation coefficients in the alpha channel of RDP. At that time, the BL adjusts the attenuation of the pipeline pixel colors to the surrounding fog color. Because the alpha channel of RDP is being used for Gouraud-shading the fog attenuation coefficient, normal alpha values cannot be Gouraud-shaded. In other words, you cannot change the transparency inside a single triangle when you are using fog.

You can give a single triangle constant tranparency by using gDPSetBlendColor and setting the BL. If you Gouraud-shade the fog attenuation coefficient over a size larger than the screen pixel size, you get unrealistic looking fog. This is because fog attenuates exponentially, and not linearly. You can correct this by dividing up the large geometry into straightline sections in order to calculate the exponential attenuation.

For details, see Section 11.8 "Vertex Fog State," and 12.7.5 "Using Fog," in the N64 Online Programming Manual.

See Also
gDPFillRectangle
gDPSetAlphaCompare
gDPSetCombineMode
gDPSetCycleType
gDPSetRenderMode
gSPFogPosition
gSPSetGeometryMode

Revision History
2/1/99 Completely rewritten.




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-1999
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated April, 1999