ShadowManager

from panda3d._rplight import ShadowManager
class ShadowManager

Bases:

Bases: ReferenceCount

Inheritance diagram

Inheritance diagram of ShadowManager

__init__()

This constructs a new shadow atlas. There are a set of properties which should be set before calling ShadowManager.init, see the set-Methods. After all properties are set, ShadowManager.init should get called. ShadowManager.update should get called on a per frame basis.

__init__(param0: ShadowManager)
property atlas ShadowAtlas

This returns a handle to the internal shadow atlas instance. This is only valid after calling ShadowManager.init. Calling this earlier will trigger an assertion and undefined behaviour.

property atlas_size int
Getter

This returns the shadow atlas size previously set with ShadowManager.setAtlasSize.

Setter

This sets the desired shadow atlas size. It should be big enough to store all important shadow sources, with some buffer, because the shadow maps usually won’t be fitted perfectly, so gaps can occur.

This has to get called before calling ShadowManager.init. When calling this method after initialization, an assertion will get triggered.

getAtlas() ShadowAtlas

This returns a handle to the internal shadow atlas instance. This is only valid after calling ShadowManager.init. Calling this earlier will trigger an assertion and undefined behaviour.

getAtlasSize() int

This returns the shadow atlas size previously set with ShadowManager.setAtlasSize.

getNumUpdateSlotsLeft() int

This returns how many update slots are left. You can assume the next n calls to add_update will succeed, whereas n is the value returned by this function.

init()

This initializes the ShadowManager. All properties should have been set before calling this, otherwise assertions will get triggered.

This setups everything required for rendering shadows, including the shadow atlas and the various shadow cameras. After calling this method, no properties can be changed anymore.

property num_update_slots_left int

This returns how many update slots are left. You can assume the next n calls to add_update will succeed, whereas n is the value returned by this function.

setAtlasGraphicsOutput(graphics_output: panda3d.core.GraphicsOutput)

This sets the handle to the GraphicsOutput of the shadow atlas. Usually this is RenderTarget.get_internal_buffer(), whereas the RenderTarget is the target of the ShadowStage.

This is used for creating display regions and attaching cameras to them, for performing shadow updates.

This has to get called before ShadowManager.init, otherwise an assertion will be triggered.

setAtlasSize(atlas_size: int)

This sets the desired shadow atlas size. It should be big enough to store all important shadow sources, with some buffer, because the shadow maps usually won’t be fitted perfectly, so gaps can occur.

This has to get called before calling ShadowManager.init. When calling this method after initialization, an assertion will get triggered.

setMaxUpdates(max_updates: int)

This controls the maximum amount of updated ShadowSources per frame. The ShadowManager will take the first <max_updates> ShadowSources, and generate shadow maps for them every frame. If there are more ShadowSources waiting to get updated than available updates, the sources are sorted by priority, and the update of the less important sources is delayed to the next frame.

If the update count is set too low, and there are a lot of ShadowSources waiting to get updated, artifacts will occur, and there might be ShadowSources which never get updated, due to low priority.

If an update count of 0 is passed, no updates will happen. This also means that there are no shadows. This is not recommended.

If an update count < 0 is passed, undefined behaviour occurs.

This method has to get called before ShadowManager.init, otherwise an assertion will get triggered.

setScene(scene_parent: panda3d.core.NodePath)

This sets the target scene for rendering shadows. All shadow cameras will be parented to this scene to render shadows.

Usually the scene will be ShowBase.render. If the scene is an empty or invalid NodePath, an assertion will be triggered.

This method has to get called before calling ShadowManager.init, or an assertion will get triggered.

setTagStateManager(tag_mgr: TagStateManager)

This sets the handle to the TagStateManager used by the pipeline. Usually this is RenderPipeline.get_tag_mgr().

This has to get called before ShadowManager.init, otherwise an assertion will get triggered.

update()

This updates the ShadowManager, processing all shadow sources which need to get updated.

This first collects all sources which require an update, sorts them by priority, and then processes the first <max_updates> ShadowSources.

This may not get called before ShadowManager.init, or an assertion will be thrown.