Skip to content

CameraFogMode

Narta Xaymar Dirks edited this page Oct 29, 2026 · 7 revisions
Blitz3D

CameraFogMode

CameraFogMode:Void camera:Int32, mode:Int32
Parameter Mode Type Default Description
camera In Int32 required Camera handle.
mode In Int32 required 0 for no fog, 1 for linear fog by the depth along the view direction, 2 for linear fog by the distance to the camera.

Description

Turns the camera's fog on or off. Fog fades everything toward the fog color with distance, which hides objects popping into view at the far limit. Every camera has its own fog, so two cameras can show the same world with and without it. Set the range with CameraFogRange and the color with CameraFogColor; entities can opt out with the fog flag of EntityFX.

Mode 1 measures the distance the way the near plane does: as the depth along the direction the camera looks. Everything on a wall in front of the camera is equally far away, so the fog is a flat veil that does not change when the camera turns, but also does not make the edges of the picture any foggier, although they are further from the eye. Mode 2 is an extension that measures the straight distance to the camera itself instead, which makes the fog a sphere around the camera: the edges of the picture are foggier than the middle, and turning the camera on the spot does not change how foggy any object is. The range of CameraFogRange is used for both. Any other value than 0 and 2 is linear fog like 1.

Differences

  • Mode 2 is an extension of BlitzLLVM; the original only knows 0 and 1, and a program that uses 2 does not behave the same with the original Blitz3D.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
; The same wall of cubes twice: on the left with mode 1, on the right with mode 2.
For side = 0 To 1
	camera = CreateCamera()
	CameraViewport camera, side * 160, 0, 160, 240
	CameraClsColor camera, 150, 170, 200
	CameraFogMode camera, 1 + side
	CameraFogColor camera, 150, 170, 200
	CameraFogRange camera, 8, 11
Next
light = CreateLight()
RotateEntity light, 45, 45, 0
For i = -3 To 3
	cube = CreateCube()
	ScaleEntity cube, 0.9, 2.4, 0.9
	PositionEntity cube, i * 2.6, 0, 8
	EntityColor cube, 220, 60, 50
Next
RenderWorld
Flip
WaitKey

Media

CameraFogMode

Related Commands

CameraClsColor, CameraClsMode, CameraCulling, CameraCullingSource, CameraFogColor, CameraFogRange, CameraProject, CameraProjMode

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally