-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
Check out the wiki entry Adding lights to an existing project.
Shadow softness is given by the variable shadow_blur_radius
in LightingEngine
. By default, this variable is set to 5.
-
For softer shadows, increase the value of
shadow_blur_radius
. Note that increasing the value of this variable also increases the computational cost.If you want to have very soft shadows, it is more efficient to instead downscale the resolution of the lightmap when initializing the engine. That is, set the
lightmap_res
argument to a lower resolution when constructing the lighting engine. -
For harder shadows, decrease the value of
shadow_blur_radius
. For fully hard shadows, you want to set it to 1.Keep in mind that if the lightmap has a lower resolution than the screen, it will still have some blur due to upscaling.
If you want pixel-perfect shadows, you need to do the following:
lights_engine.set_aomap_filter((pl2d.NEAREST, pl2d.NEAREST))
TODO
TODO
One way that memory leaks are commonly introduced with this engine is by forgetting to free the data of a temporary texture.
For example, if you want to render some text onto the screen to show the FPS of the game, you may be doing this:
- Use
pygame
to draw text with the current FPS on aSurface
object. - Turn the
Surface
object into a OpenGLTexture
object using this engine'ssurface_to_texture
function. - Render the texture with the engine's
render_texture
method.
Since you are creating a new texture in every single frame of the game, you will have a memory leak unless you free the data of the temporary textures. To do so, you need to call release
on the texture after you render it:
texture.release()