Skip to content
Alessandro Febretti edited this page Jan 9, 2015 · 3 revisions

Last revision: ver. 5.1 - 5 November 2013

Implements shadow map support. Each shadow map can be attached to a Light to enable shadow mapping on that light.

Methods

Method(s) Description
setTextureSize(int width, int height) Sets the size of the shadow map texture in pixels
setSoft(bool soft), bool isSoft() Gets or sets the soft shadow mode for this shadow.
setSoftShadowParameters(float jitterScale, float softnessWidth) Sets the soft shadow parameters for this shadow. Only used by soft shadows.
setDirty() Forces a shadow map refresh. Used for manual refresh maps. See Light.setShadowRefreshMode

Troubleshooting

Shadow maps can be tricky to get right. Here are a few suggestion to generate good looking shadow maps.

  • when your light is perfectly orthogonal to a surface, a shadow map may end up appearing noisy. Avoid this. Even adding a small difference to a light direction helps. You can do this either through setLightDirection or by rotating the light scene node.

Examples

Shadow map creation

light = Light.create()
sm = ShadowMap()
light.setShadow(sm)
Clone this wiki locally