I am excited to announce the release of a brand new version of Panda3D. This is another bug fix release, improving stability and reliability. However, several new features have been added in places where there was no chance that doing so would introduce incompatibilities. Below are a few highlights, but you can also head straight to the download page and view the full release notes there.
We’ve fixed too many bugs to list here, but a few will be highlighted in particular. Notably, a bug has been fixed in the collision test between spheres and polygons, improving the stability of the collision response. We’ve also fixed a bug causing shadows to stop being updated after post-processing filters were reconfigured, a bug that caused the shader generator to ignore alpha values specified in the material, and a regression that caused maya2egg to not properly convert animations.
High Dynamic Range Filter
This feature was originally slated for the 1.11.0 release, but since that is still at least several months down the line, it was decided to make this available early. This filter can be used as alternative to the excellent panda3d-simplepbr or RenderPipeline packages and provides an easy way to enable HDR rendering with filmic tone mapping in a Panda3D application.
This post will not go into detail about the merits of HDR rendering, but in short, by default all lighting calculations take place in display-referred space, which places all values in the narrow range between 0 (black) and 1 (white) as they appear on the monitor. But in the real world, there is no such thing as a “maximally white” light beam—lights just get brighter and brighter! With HDR rendering, we instead render in what’s called scene-referred space. Practically, this means we render the scene to a floating-point framebuffer and disable the output clamping, so that it can contain realistic radiometric light values. Then, we use a post-processing filter with a tone mapping operator that simulates how our eye interprets incoming light in order to transform the colors to display-referred space, compressing the values back down to the low dynamic range that can be displayed on a computer monitor.
The chosen tone mapping operator is an approximation of the Academy Color Encoding System (ACES) pipeline that is also used for film production. We may add other tone mapping operators in the future, if desired, and extend the functionality with additional color grading filters.
In the images below, the leftmost example shows a scene with bright lights that becomes completely washed out in the default rendering mode. The naive approach of simply scaling down the brightness of the lights is shown in the middle; it still results in overly saturated colors and washed out highlights. The rightmost image was achieved by simply enabling the HDR filter, which revealed the original colors of the skybox and maintained the differences between the dark and light areas of the grass.
There is a separate “exposure adjust” feature that allows you to adjust the perceived brightness of the scene. For example, when the player moves from a dark cave to a bright sunny outdoor scene, the exposure adjustment value should be decreased in a similar manner to how our eyes adjust to the brighter lights in real life. (As of yet, there is no built-in way to automatically adjust the exposure based on the brightness of the scene.) The below images show the effects of varying the exposure by 1 stop:
These new filters should be regarded as experimental and may be subject to future changes. To learn how to configure them, see the corresponding manual page.
We’ve previously talked about the importance of using a linear rendering workflow using the sRGB framebuffer and texture formats in Panda3D. In this release, more tools have been added to make these features easier to work with.
For one, an sRGB encoding filter has been added to the CommonFilters class. This is mainly useful if the target hardware doesn’t support sRGB framebuffers, which are otherwise still the preferred method for applying the inverse sRGB EOTF. By default, the filter won’t activate if an sRGB framebuffer was sucessfully obtained, to prevent an accidental double-application of the sRGB transformation. It is therefore recommended to always enable this filter if you are using a linear workflow.
Secondly, it has been made easier to automatically assign sRGB formats to textures loaded from .egg files. This can be achieved by setting
egg-force-srgb-textures true in Config.prc. Textures that are assigned to a special slot (such as a normal map or gloss map) are not affected. Please note that this setting will not take effect on cached .egg files, so it is necessary to clear the model cache after changing it.
Lastly, sRGB framebuffers and textures are now supported when using EGL / OpenGL ES, so that it is possible to use them on mobile platforms as well.