Fog

from panda3d.core import Fog
class Fog

Bases: PandaNode

Specifies how atmospheric fog effects are applied to geometry. The Fog object is now a PandaNode, which means it can be used similarly to a Light to define effects relative to a particular coordinate system within the scene graph.

In exponential mode, the fog effects are always camera-relative, and it does not matter where the Fog node is parented. However, in linear mode, the onset and opaque distances are defined as offsets along the local forward axis (e.g. the Y axis). This allows the fog effect to be localized to a particular region in space, rather than always camera- relative. If the fog object is not parented to any node, it is used to generate traditonal camera-relative fog, as if it were parented to the camera.

Inheritance diagram

Inheritance diagram of Fog

MExponential = 1
MExponentialSquared = 2
MLinear = 0
M_exponential = 1
M_exponential_squared = 2
M_linear = 0
__init__(*args, **kwargs)
color
exp_density
getClassType()

C++ Interface: get_class_type()

getColor()

C++ Interface: get_color(Fog self)

/**
  • Returns the color of the fog.

*/

getExpDensity()

C++ Interface: get_exp_density(Fog self)

/**
  • Returns the density of the fog for exponential calculations. This is only

  • used if the mode is not M_linear.

*/

getLinearOnsetPoint()

C++ Interface: get_linear_onset_point(Fog self)

/**
  • Returns the point in space at which the fog begins. This is only used if

  • the mode is M_linear.

*/

getLinearOpaquePoint()

C++ Interface: get_linear_opaque_point(Fog self)

/**
  • Returns the point in space at which the fog completely obscures geometry.

  • This is only used if the mode is M_linear.

*/

getMode()

C++ Interface: get_mode(Fog self)

/**

*/

get_class_type()

C++ Interface: get_class_type()

get_color()

C++ Interface: get_color(Fog self)

/**
  • Returns the color of the fog.

*/

get_exp_density()

C++ Interface: get_exp_density(Fog self)

/**
  • Returns the density of the fog for exponential calculations. This is only

  • used if the mode is not M_linear.

*/

get_linear_onset_point()

C++ Interface: get_linear_onset_point(Fog self)

/**
  • Returns the point in space at which the fog begins. This is only used if

  • the mode is M_linear.

*/

get_linear_opaque_point()

C++ Interface: get_linear_opaque_point(Fog self)

/**
  • Returns the point in space at which the fog completely obscures geometry.

  • This is only used if the mode is M_linear.

*/

get_mode()

C++ Interface: get_mode(Fog self)

/**

*/

linear_onset_point
linear_opaque_point
mode
setColor()

C++ Interface: set_color(const Fog self, const LVecBase4f color) set_color(const Fog self, float r, float g, float b)

/**
  • Sets the color of the fog.

*/

/**
  • Sets the color of the fog. The alpha component is not used.

*/

setExpDensity()

C++ Interface: set_exp_density(const Fog self, float exp_density)

/**
  • Sets the density of the fog for exponential calculations. This is only

  • used if the mode is not M_linear.

  • If the mode is currently set to M_linear, this function implicitly sets it

  • to M_exponential.

*/

setLinearFallback()

C++ Interface: set_linear_fallback(const Fog self, float angle, float onset, float opaque)

/**
  • Fog effects are traditionally defined in camera-relative space, but the

  • Panda Fog node has a special mode in which it can define a linear fog

  • effect in an arbitrary coordinate space.

  • This is done by specifying 3-d onset and opaque points, and parenting the

  • Fog object somewhere within the scene graph. In this mode, the fog will be

  • rendered as if it extended along the vector from the onset point to the

  • opaque point, in 3-d space.

  • However, the underlying fog effect supported by hardware is generally only

  • one-dimensional, and must be rendered based on linear distance from the

  • camera plane. Thus, this in-the-world effect is most effective when the

  • fog vector from onset point to opaque point is most nearly parallel to the

  • camera’s eye vector.

  • As the angle between the fog vector and the eye vector increases, the

  • accuracy of the effect diminishes, up to a complete breakdown of the effect

  • at a 90 degree angle.

  • This function exists to define the workaround to this problem. The linear

  • fallback parameters given here specify how the fog should be rendered when

  • the parameters are exceeded in this way.

  • The angle parameter is the minimum angle, in degrees, of the fog vector to

  • the eye vector, at which the fallback effect should be employed. The onset

  • and opaque parameters specify the camera-relative onset and opaque

  • distances to pass to the rendering hardware when employing the fallback

  • effect. This supercedes the 3-d onset point and opaque points.

*/

setLinearOnsetPoint()

C++ Interface: set_linear_onset_point(const Fog self, const LPoint3f linear_onset_point) set_linear_onset_point(const Fog self, float x, float y, float z)

/**
  • Specifies the point in space at which the fog begins. This is only used if

  • the mode is M_linear.

*/

/**
  • Specifies the point in space at which the fog begins. This is only used if

  • the mode is M_linear.

*/

setLinearOpaquePoint()

C++ Interface: set_linear_opaque_point(const Fog self, const LPoint3f linear_opaque_point) set_linear_opaque_point(const Fog self, float x, float y, float z)

/**
  • Specifies the point in space at which the fog completely obscures geometry.

  • This is only used if the mode is M_linear.

*/

/**
  • Specifies the point in space at which the fog completely obscures geometry.

  • This is only used if the mode is M_linear.

*/

setLinearRange()

C++ Interface: set_linear_range(const Fog self, float onset, float opaque)

/**
  • Specifies the effects of the fog in linear distance units. This is only

  • used if the mode is M_linear.

  • This specifies a fog that begins at distance onset units from the origin,

  • and becomes totally opaque at distance opaque units from the origin, along

  • the forward axis (usually Y).

  • This function also implicitly sets the mode the M_linear, if it is not

  • already set.

*/

setMode()

C++ Interface: set_mode(const Fog self, int mode)

/**
  • Specifies the computation that is used to determine the fog effect. If

  • this is M_linear, then the fog will range from linearly from the onset

  • point to the opaque point (or for the distances specified in

  • set_linear_range), and the fog object should be parented into the scene

  • graph, or to the camera.

  • If this is anything else, the onset point and opaque point are not used,

  • and the fog effect is based on the value specified to set_exp_density(),

  • and it doesn’t matter to which node the fog object is parented, or if it is

  • parented anywhere at all.

*/

set_color()

C++ Interface: set_color(const Fog self, const LVecBase4f color) set_color(const Fog self, float r, float g, float b)

/**
  • Sets the color of the fog.

*/

/**
  • Sets the color of the fog. The alpha component is not used.

*/

set_exp_density()

C++ Interface: set_exp_density(const Fog self, float exp_density)

/**
  • Sets the density of the fog for exponential calculations. This is only

  • used if the mode is not M_linear.

  • If the mode is currently set to M_linear, this function implicitly sets it

  • to M_exponential.

*/

set_linear_fallback()

C++ Interface: set_linear_fallback(const Fog self, float angle, float onset, float opaque)

/**
  • Fog effects are traditionally defined in camera-relative space, but the

  • Panda Fog node has a special mode in which it can define a linear fog

  • effect in an arbitrary coordinate space.

  • This is done by specifying 3-d onset and opaque points, and parenting the

  • Fog object somewhere within the scene graph. In this mode, the fog will be

  • rendered as if it extended along the vector from the onset point to the

  • opaque point, in 3-d space.

  • However, the underlying fog effect supported by hardware is generally only

  • one-dimensional, and must be rendered based on linear distance from the

  • camera plane. Thus, this in-the-world effect is most effective when the

  • fog vector from onset point to opaque point is most nearly parallel to the

  • camera’s eye vector.

  • As the angle between the fog vector and the eye vector increases, the

  • accuracy of the effect diminishes, up to a complete breakdown of the effect

  • at a 90 degree angle.

  • This function exists to define the workaround to this problem. The linear

  • fallback parameters given here specify how the fog should be rendered when

  • the parameters are exceeded in this way.

  • The angle parameter is the minimum angle, in degrees, of the fog vector to

  • the eye vector, at which the fallback effect should be employed. The onset

  • and opaque parameters specify the camera-relative onset and opaque

  • distances to pass to the rendering hardware when employing the fallback

  • effect. This supercedes the 3-d onset point and opaque points.

*/

set_linear_onset_point()

C++ Interface: set_linear_onset_point(const Fog self, const LPoint3f linear_onset_point) set_linear_onset_point(const Fog self, float x, float y, float z)

/**
  • Specifies the point in space at which the fog begins. This is only used if

  • the mode is M_linear.

*/

/**
  • Specifies the point in space at which the fog begins. This is only used if

  • the mode is M_linear.

*/

set_linear_opaque_point()

C++ Interface: set_linear_opaque_point(const Fog self, const LPoint3f linear_opaque_point) set_linear_opaque_point(const Fog self, float x, float y, float z)

/**
  • Specifies the point in space at which the fog completely obscures geometry.

  • This is only used if the mode is M_linear.

*/

/**
  • Specifies the point in space at which the fog completely obscures geometry.

  • This is only used if the mode is M_linear.

*/

set_linear_range()

C++ Interface: set_linear_range(const Fog self, float onset, float opaque)

/**
  • Specifies the effects of the fog in linear distance units. This is only

  • used if the mode is M_linear.

  • This specifies a fog that begins at distance onset units from the origin,

  • and becomes totally opaque at distance opaque units from the origin, along

  • the forward axis (usually Y).

  • This function also implicitly sets the mode the M_linear, if it is not

  • already set.

*/

set_mode()

C++ Interface: set_mode(const Fog self, int mode)

/**
  • Specifies the computation that is used to determine the fog effect. If

  • this is M_linear, then the fog will range from linearly from the onset

  • point to the opaque point (or for the distances specified in

  • set_linear_range), and the fog object should be parented into the scene

  • graph, or to the camera.

  • If this is anything else, the onset point and opaque point are not used,

  • and the fog effect is based on the value specified to set_exp_density(),

  • and it doesn’t matter to which node the fog object is parented, or if it is

  • parented anywhere at all.

*/