BillboardRenderer Class |
Namespace: DigitalRune.Graphics.Rendering
The BillboardRenderer type exposes the following members.
Name | Description | |
---|---|---|
BillboardRenderer(IGraphicsService, Int32) |
Initializes a new instance of the BillboardRenderer class.
| |
BillboardRenderer(IGraphicsService, Int32, SpriteFont) |
Initializes a new instance of the BillboardRenderer class.
|
Name | Description | |
---|---|---|
CanRender |
Determines whether this renderer can handle the specified scene node.
(Overrides SceneNodeRendererCanRender(SceneNode, RenderContext).) | |
Dispose |
Releases all resources used by an instance of the SceneNodeRenderer class.
(Inherited from SceneNodeRenderer.) | |
Dispose(Boolean) |
Releases the unmanaged resources used by an instance of the SceneNodeRenderer
class and optionally releases the managed resources.
(Overrides SceneNodeRendererDispose(Boolean).) | |
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Render(SceneNode, RenderContext) |
Renders the specified scene node.
(Inherited from SceneNodeRenderer.) | |
Render(IListSceneNode, RenderContext) |
Renders the specified scene nodes.
(Inherited from SceneNodeRenderer.) | |
Render(IListSceneNode, RenderContext, RenderOrder) |
Renders the specified scene nodes.
(Overrides SceneNodeRendererRender(IListSceneNode, RenderContext, RenderOrder).) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
MaxBufferSize |
The maximum buffer size (number of billboards).
|
Name | Description | |
---|---|---|
BufferSize |
Gets the size of the buffer (number of billboards).
| |
DepthThreshold |
Gets or sets the depth threshold used for edge detection when upsampling the off-screen
buffer.
| |
EnableOffscreenRendering |
Gets or sets a value indicating whether off-screen rendering is enabled. (Requires HiDef
profile.)
| |
EnableSoftParticles |
Gets or sets a value indicating whether soft particles are enabled. (Requires HiDef
profile.)
| |
FarBias | Obsolete.
Gets or sets the bias factor used to bias the camera near plane when the z-buffer is
reconstructed. (Only used when EnableOffscreenRendering is set.)
| |
IsDisposed |
Gets a value indicating whether this instance has been disposed of.
(Inherited from SceneNodeRenderer.) | |
NearBias | Obsolete.
Gets or sets the factor used to bias the camera near plane when the z-buffer is
reconstructed. (Only used when EnableOffscreenRendering is set.)
| |
Order |
Gets the draw order of this scene node renderer.
(Inherited from SceneNodeRenderer.) | |
UpsamplingFilter | Obsolete.
Gets or sets the upsampling filter that is used for combining the off-screen buffer with
the scene.
| |
UpsamplingMode |
Gets or sets the upsampling filter that is used for combining the off-screen buffer with
the scene.
|
The BillboardRenderer is a scene node renderer which handles BillboardNodes and ParticleSystemNodes.
Particle systems need to have certain particle parameters for rendering. If a required particle parameter is missing, the particle system is ignored by the renderer! See ParticleSystemNode for more information.
Buffer Size: The renderer batches billboards and particles using an internal buffer. The property BufferSize limits the number of billboards/particles that can be drawn with a single draw call.
Render States: The BillboardRenderer changes the following render states of the graphics device.
When using HiDef profile with soft particles the DepthStencilState is set to None (= depth-reads and depth-writes are disabled).
When using Reach profile or HiDef profile (without soft particles) the DepthStencilState is not changed. The DepthStencilState should be set explicitly before rendering billboards/particles. In most cases depth-writes should be disabled, for example:
graphicsDevice.DepthStencilState = DepthStencilState.DepthRead; billboardRenderer.Render(nodes, context);
Soft Particles (require HiDef profile):
Billboards and particles are usually rendered as flat quads, which cause hard edges when they
intersect with other geometry in the scene. "Soft particles" are rendered by performing an
explicit depth test in the pixel shader. Soft particles fade out near the camera and create
smooth transitions when they intersect with other geometry.
To enable rendering of soft particles set the property EnableSoftParticles to . In addition the depth buffer needs to be set in the render context (property GBuffer0).
For image billboards: The Softness property defines whether billboards are rendered "hard" or "soft".
For particle systems: The Softness parameter (a uniform particle parameter of type Single) defines whether particles are rendered "hard" or "soft".
High-Speed, Off-Screen Particles (require HiDef profile):
Large amounts of particles covering the screen can cause a lot of overdraw. This can reduce
the frame rate, if the game is limited by the GPU's fill rate. One solution to this problem
is to render particles into a low-resolution off-screen buffer. This reduces the amount of
overdraw, at the expense of additional image processing overhead and image quality.
To enable off-screen rendering set the property EnableOffscreenRendering to . In addition a low-resolution copy of the depth buffer (half width and height) needs to be stored in renderContext.Data[RenderContextKey.DepthBufferHalf].
In XNA off-screen rendering clears the current back buffer. If necessary the renderer will automatically rebuild the back buffer including the depth buffer. For the rebuild step it will use the same parameters (e.g. near and far bias) as the current RebuildZBufferRenderer stored in renderContext.Data[RenderContextKey.RebuildZBufferRenderer].
Caution |
---|
When off-screen rendering is enabled the BillboardRenderer automatically switches render targets and invalidates the current depth-stencil buffer. |