Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Class TSceneRenderingAttributes
Unit
CastleScene
Declaration
type TSceneRenderingAttributes = class(TRenderingAttributes)
Description
no description available, TRenderingAttributes description follows
Various properties that control rendering done with TGLRenderer.
They are collected here, in a class separate from TGLRenderer, because various things (like TCastleScene and TCastlePrecalculatedAnimation) wrap TGLRenderer instances and hide it, but still they want to allow user to change these attributes.
Hierarchy
Overview
Fields
Methods
Properties
Description
Fields
 |
internal const DefaultBlendingSourceFactor = GL_SRC_ALPHA; |
|
 |
internal const DefaultBlendingDestinationFactor = GL_ONE_MINUS_SRC_ALPHA; |
Default value of Attributes.BlendingDestinationFactor. See TSceneRenderingAttributes.BlendingDestinationFactor.
Using ONE_MINUS_SRC_ALPHA is the standard value for 3D graphic stuff, often producing best results. However, it causes troubles when multiple transparent shapes are visible on the same screen pixel. For closed convex 3D objects, using backface culling (solid = TRUE for geometry) helps. For multiple transparent shapes, sorting the transparent shapes helps, see TSceneRenderingAttributes.BlendingSort. Sometimes, no solution works for all camera angles.
Another disadvantage of ONE_MINUS_SRC_ALPHA may be that the color of opaque shapes disappears too quickly from resulting image (since GL_ONE_MINUS_SRC_ALPHA scales it down). So the image may be darker than you like.
You can instead consider using GL_ONE, that doesn't require sorting and never has problems with multiple transparent shapes. On the other hand, it only adds to the color, often making too bright results.
|
 |
internal const DefaultBlendingSort = false; |
|
 |
internal const DefaultSolidWireframeScale = 1; |
|
 |
internal const DefaultSolidWireframeBias = 1; |
|
 |
internal const DefaultSilhouetteScale = 5; |
|
 |
internal const DefaultSilhouetteBias = 5; |
|
Methods
 |
procedure ReleaseCachedResources; override; |
|
 |
procedure SetBlending(const Value: boolean); virtual; |
|
 |
procedure SetBlendingSourceFactor(const Value: TGLenum); virtual; |
|
 |
procedure SetBlendingDestinationFactor(const Value: TGLenum); virtual; |
|
 |
procedure SetBlendingSort(const Value: boolean); virtual; |
|
 |
procedure SetControlBlending(const Value: boolean); virtual; |
|
 |
procedure SetUseOcclusionQuery(const Value: boolean); virtual; |
|
 |
constructor Create; override; |
|
 |
destructor Destroy; override; |
|
 |
procedure Assign(Source: TPersistent); override; |
|
Properties
 |
property Blending: boolean
read FBlending write SetBlending default true; |
Render partially transparent objects.
More precisely: if this is True , all shapes with transparent materials or textures with non-trivial (not only yes/no) alpha channel will be rendered using OpenGL blending (with depth test off, like they should for OpenGL).
If this attribute is False , everything will be rendered as opaque.
|
 |
property ControlBlending: boolean
read FControlBlending write SetControlBlending default true; |
Setting this to False disables any modification of OpenGL blending (and depth mask) state by TCastleScene. This makes every other Blending setting ignored, and is useful only if you set your own OpenGL blending parameters when rendering this scene.
|
 |
property WireframeEffect: TWireframeEffect
read FWireframeEffect write FWireframeEffect default weNormal; |
You can use this to turn on some effects related to rendering model in special modes.
When this is weNormal (default), nothing special is done, which means that model polygons are simply passed to OpenGL. Whether this results in filled or wireframe, depends on OpenGL glPolygonMode setting, filled by default.
How the wireframe effects work when Mode = rmDepth is undefined now. Just don't use Mode = rmDepth if you're unsure.
See description of TWireframeEffect for what other modes do.
|
 |
property SilhouetteBias: Single read FSilhouetteBias write FSilhouetteBias default DefaultSilhouetteBias; |
|
 |
property UseOcclusionQuery: boolean
read FUseOcclusionQuery write SetUseOcclusionQuery default false; |
Should we use ARB_occlusion_query (if available) to avoid rendering shapes that didn't pass occlusion test in previous frame. Ignored if GPU doesn't support ARB_occlusion_query.
True may give you a large speedup in some scenes. OTOH, a lag of one frame may happen between an object should be rendered and it actually appears.
When you render more than once the same instance of TCastleScene scene, you should not activate it (as the occlusion query doesn't make sense if each following render of the scene takes place at totally different translation). Also, when rendering something more than just one TCastleScene scene (maybe many times the same TCastleScene instance, maybe many different TCastleScene instances, maybe some other 3D objects) you should try to sort rendering order from the most to the least possible occluder (otherwise occlusion query will not be as efficient at culling).
This is ignored if UseHierarchicalOcclusionQuery.
|
 |
property UseHierarchicalOcclusionQuery: boolean
read FUseHierarchicalOcclusionQuery
write FUseHierarchicalOcclusionQuery default false; |
Should we use ARB_occlusion_query (if available) with a hierarchical algorithm to avoid rendering shapes that didn't pass occlusion test in previous frame. Ignored if GPU doesn't support ARB_occlusion_query.
True may give you a large speedup in some scenes.
This method doesn't impose any lag of one frame (like UseOcclusionQuery).
This requires the usage of TCastleSceneCore.OctreeRendering. Also, it always does frustum culling (like fcBox for now), regardless of TCastleScene.OctreeFrustumCulling setting.
The algorithm used underneath is "Coherent Hierarchical Culling", described in detail in "GPU Gems 2", Chapter 6: "Hardware Occlusion Queries Made Useful", by Michael Wimmer and Jiri Bittner. Online on [http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter06.html].
|
 |
property DebugHierOcclusionQueryResults: boolean
read FDebugHierOcclusionQueryResults
write FDebugHierOcclusionQueryResults default false; |
View only the shapes that were detected as visible by occlusion query in last Render.
Use this only after render with UseHierarchicalOcclusionQuery. TODO: for UseOcclusionQuery I would also like to make it work, for now not done as frustum information is gone. This will disable actual occlusion query, instead reusing results from last occlusion query done when this debug flag was False .
Useful to quickly visualize the benefits of occlusion query.
|
Generated by PasDoc 0.13.0 on 2014-04-30 22:06:44
|