DepthOffsetAttrib
from panda3d.core import DepthOffsetAttrib
- class DepthOffsetAttrib
Bases:
Bases:
RenderAttrib
This is a special kind of attribute that instructs the graphics driver to apply an offset or bias to the generated depth values for rendered polygons, before they are written to the depth buffer.
This can be used to shift polygons forward slightly, to resolve depth conflicts. The cull traverser may optionally use this, for instance, to implement decals. However, driver support for this feature seems to be spotty, so use with caution.
The bias is always an integer number, and each integer increment represents the smallest possible increment in Z that is sufficient to completely resolve two coplanar polygons. Positive numbers are closer towards the camera.
Nested DepthOffsetAttrib values accumulate; that is, a DepthOffsetAttrib with a value of 1 beneath another DepthOffsetAttrib with a value of 2 presents a net offset of 3. (A DepthOffsetAttrib will not, however, combine with any other DepthOffsetAttribs with a lower override parameter.) The net value should probably not exceed 16 or drop below 0 for maximum portability.
Also, and only tangentially related, the DepthOffsetAttrib can be used to constrain the Z output value to a subset of the usual [0, 1] range (or reversing its direction) by specifying a new min_value and max_value.
Deprecated: See
DepthBiasAttrib
andDisplayRegion.set_depth_range()
instead.Inheritance diagram
- static get_class_type() TypeHandle
- get_max_value() float
Returns the value for the maximum (farthest) depth value to be stored in the buffer, in the range 0 .. 1.
- get_min_value() float
Returns the value for the minimum (closest) depth value to be stored in the buffer, in the range 0 .. 1.
- static make(offset: int) RenderAttrib
Constructs a new
DepthOffsetAttrib
object that indicates the relative amount of bias to write to the depth buffer for subsequent geometry.
- static make(offset: int, min_value: float, max_value: float) RenderAttrib
Constructs a new
DepthOffsetAttrib
object that indicates the bias, and also specifies a minimum and maximum (or, more precisely, nearest and farthest) values to write to the depth buffer, in the range 0 .. 1. This range is 0, 1 by default; setting it to some other range can be used to create additional depth buffer effects.
- static make_default() RenderAttrib
Returns a
RenderAttrib
that corresponds to whatever the standard default properties for render attributes of this type ought to be.
- property max_value float
Returns the value for the maximum (farthest) depth value to be stored in the buffer, in the range 0 .. 1.