October 2018 Development Update

PyWeek

Two weeks ago, the semi-annual PyWeek challenge was held. In case you are not familiar with PyWeek, it’s a challenge to create a game within only seven days. The contestants are free to use any engine as long the game is written mostly in Python. Before the challenge begins, contestants vote on a theme in order to inspire and challenge the entrants’ creativity. The theme for the October challenge was “Flow”.

In this 26th PyWeek, two contestants have used Panda3D for their submissions. We’d like to highlight some of the challenges they faced and show how Panda3D helped them to finish their games in such a short time. They both used development builds of the upcoming Panda3D 1.10, which made for a great opportunity to test the new features, and the new deployment system in particular. Being able to quickly install Panda3D using pip has also been a very welcome feature for PyWeek, since installing Panda3D has been a stumbling block for PyWeek users in the past.

Chart of Flowrock

Chart of Flowrock

This entry was created by our community member wezu. It is an original take on the dungeon crawler game using only three keyboard buttons where possible moves are represented with a flowchart diagram at the bottom of the screen.
One feature from the Panda3D engine that helped wezu getting this game done was the intervals. These are functions to manipulate values—such as an object’s position and rotation—over a given period of time without the need to use tasks to manage those updates manually. Using intervals, he was able to quickly develop convincing walking animations with head bob and tilting when turning.

The game’s impressive graphical style was achieved thanks to a shader framework wezu developed, which is publicly available at GitHub. It has been made as a drop-in replacement for the built-in Cg-based ShaderGenerator, implementing various modern effects using GLSL 1.30. This proved to be a bit of a challenge in testing: while GLSL 1.30 shaders are typically usable on most platforms, OpenGL support has always been a bit behind on macOS, and has in fact even been deprecated by Apple as discussed in a previous blog post. This forced him to implement a special “potato mode” for low end and macOS systems that wouldn’t utilize these shaders. In this mode, the game would still be playable, just without those fancy graphics.
Working on an improved shader pipeline that avoids some of the driver-specific compatibility issues is high on the agenda for the Panda3D developers, which will help making shader-based game work reliably on multiple platforms without requiring extensive testing and tweaking the shaders for different drivers.

Chart of Flowrock won silver rating in the Production category and ranked sixth overall among the individual entries.

Let There Be Light

Let There Be Light

Our second entry that has been made for PyWeek was created by our main engine developer rdb. This game is a kind of strategic puzzle building game where you have to build an energy grid in order to supply cities with power and enable them to grow. The energy demand of the cities grows over time so you have to carefully plan your network so that your wires don’t overheat. For this game rdb decided to take a less heavily graphics-focused approach, instead going for a minimalistic art style with flat colors, low-poly models and simple lighting. The game employed numpy for calculating the currents through the nodes of the energy grid.

As the power lines were one of the most important elements of the game, some attention to detail was given with how they are rendered. The LineSegs class made it easy to draw nice catenaries between the pylons. Panda3D made the math rather easy to ensure that the wires connected up properly to the pylons regardless of their orientation: dummy points were added to the pylon models indicating the points where the wires should attach, so it was only necessary to use getRelativePoint() to determine the correct two points to draw the arc between.

As the player interacts with the game primarily using the mouse, extra attention was given to ensure a good user interface so that it is clear to the player what to do. Panda3D’s text nodes and billboard effects made it particularly easy to add labels in the 3D scene to clearly communicate where the user needs to click and what will happen when they click it, and intervals made it easy to give the important labels a nice animation to draw the eye. The free Font Awesome icon font was used to easily render crisp icons.

The sound and music had to be pushed off to the last few hours of the final day, but fortunately loading and playing spatialized sounds in Panda3D takes only a few lines of code. Having sound effects can really help with the user experience like this by giving direct feedback to the player’s actions. Smoothly adjusting the play rate of the music depending on the game speed was a nice touch appreciated by the reviewers, which took only a few minutes to implement using Panda3D.

Let There Be Light won gold ratings in the Fun and Production categories, Silver in the Innovation category and became the winner of PyWeek 26 among the individual entries.

Engine Developments

Despite the distraction of PyWeek, development of the engine has not remained idle. Plenty of bugfixes and stability improvements bring the engine ever closer towards the upcoming 1.10 release. We’ll give you a small selection of the many changes that have happened.

If you have ever tried loading models in a model format other than Panda3D’s own bam or egg formats, you may have already come across the Assimp loader, which has been in the Panda3D source for a while but was considered experimental. This uses the Assimp library, which supports most of the 3D formats in common use. This importer is now enabled by default and can be used in recent development builds.

On the graphical side were a few fixes and enhancements too. A big change was made in the rendering system to resolve some inconsistencies in how colors and material were being applied in the absence of lighting. It is normally the case that materials are not visible unless you have a light applied to the model, but in some cases (such as in the presence of a color scale), the material colors could show up anyway. It was also not always clear when vertex colors would show up or when they would be suppressed by the material. These behaviors have now been made consistent between the different rendering back-ends and the shader generator. If these changes are affecting your game, just let us know and we can help you resolve these problems.

As of 1.9.0, Panda3D has a GLSL preprocessor which among other things allows #include statements to include other files within the current shader. This is crucial for games that rely heavily on shaders, as functions often need to be shared between different shaders or just separated for better code organisation. It has recently seen some improvements, such as the ability to use it with procedurally generated shaders that are passed into Shader.make(), some optimizations to reduce the preprocessed size, and some parsing fixes.

There also have been some improvements on the Windows front. It is now possible to change the undecorated and fixed-size attributes of already-opened windows. There have also been some improvements in the build time when compiling with Eigen support on Windows.

The deploy-ng system has received a new feature: it can now use an optimized version of the Panda3D binaries, stripped of debug information and safety checks, when deploying a game. deploy-ng can make use of an optimized version of the Panda3D wheels that are available on our pip mirror under a special +opt tag. This allows deployed games to be smaller and faster while still providing the benefit of all the debug features and safety checks in the SDK.


August / September 2018 Development Update

In catching up with our delay in bringing out these posts, we have decided to cover the developments in the months of August and September in a single blog post. This allows us to better focus our developments on the work ahead, concordant with our plan to release 1.10 before the end of the year.

Stability improvements

To that end, we have been working diligently on improving the stability of the engine and getting the major feature branches stable enough to be merged. Among the fixes are improved thread safety for various interfaces, regressions in the shader generator, improvements to the build system, fixes for the Android port and a few improvements to the Python 3 support.

A long-standing bug has been fixed whereby Eigen-enabled builds would load some .egg models in the wrong orientation. This turned out to be a compiler bug which we managed to find a workaround for. If you were using a development build of Panda3D and had added an additional rotation in your code to work around this bug, you may need to double-check that your models are still loaded the right way.

Input API

The new input device API being developed on the input-overhaul branch has been significantly changed following a round of community feedback on the design. Sample programs showing off the various types of game devices have been added to the repository as well. After some adjustments to the API to take touch input into account, and some other finishing touches, the final review process can take place after which the code can be merged.

Stay tuned, we will follow up on this with a more in-depth post describing the new changes.

Multi-touch

As part of improving our support for mobile platforms, we have designed a new API as part of the input-overhaul effort for handling multi-touch more effectively. The new interface makes it easier to handle both touch and mouse input in the application, as well as other future pointing devices, such as the “laser pointer” style of pointing input seen in Virtual Reality games. It is expected to become part of the new release of Panda3D.

The design unifies both touch inputs and mouse clicks/drags through a concept called “active pointers”, which refers to a finger contacting the surface of the screen or a mouse with at least one button active. Whenever an active pointer is added, an event called `pointer-down` is fired. An argument is passed indicating the pointer type, a unique identifier in the case of a finger touch, as well as the position and velocity of the pointer. Likewise, events called `pointer-move` and `pointer-up` are fired when this pointer is dragged or when it ends, respectively.

Of course, it will still be possible to track the mouse or a stylus that is hovering over the surface of a digitizer independently of this by exposing a single “primary pointer” that can be accessed by legacy applications or ones that do not require multi-touch support.

You are quite welcome to provide input on the specification via the corresponding specification document, which we expect to be implemented in the coming weeks.

Other changes

The annoying “attrib lock” that prevented changing certain properties of a Material after it had been assigned to a node has been removed. It used to be necessary since the shader generator was not able to detect certain changes to existing materials after the shader for that material had already been generated. However, the improved shader generator architecture in 1.10 makes it possible for Panda3D to handle this case correctly without the attribute lock.

Support for Maya 2018 has been added, and the latest development builds now contain exporter and importer plug-ins for this version of Maya.

IRC channel

Due to ongoing spam attacks on the FreeNode network, we have needed to restrict access to the #panda3d channel on FreeNode to users who are registered with FreeNode. Click here to find out how to do so. This restriction does not apply to users of the webchat interface.


July 2018 Development Update

Despite the vacation period, the developers have not remained idle in July. Here is an update on some of the new developments.

Collision shapes

While the internal collision system provides many useful tests between various collision solids, the CollisionTube solid (representing a capsule shape) in particular was only really useful as an “into” collision shape. Many of you have requested for more tests to be added so that it can also be used as a “from” shape, since many see it as a good fit for use with character bodies. Earlier, we had already added tube-into-plane and tube-into-sphere tests. We have now also extended this to include tube-into-tube tests and tube-into-box tests. We have also added a line-into-box test to complete the suite of CollisionBox tests.

For those who are using Bullet physics instead of the internal collision system, we have also extended the ability to convert collision solids from the Panda3D representation to the Bullet representation to include CollisionTube and CollisionPlane as well. These solids can now be easily converted to a BulletCapsuleShape and BulletPlaneShape, respectively. This way you can add these shapes directly to your .egg models and load them into your application without needing custom code to convert them to Bullet shapes.

Depth buffer precision

As most Panda3D programmers will know, two important variables to define when configuring a camera in any game are the “near” and “far” distances. These determine the range of the depth buffer; objects at the near distance have a value in the depth buffer of 0.0, whereas objects at the far plane have a value of 1.0. As such, they also determine the drawing range: objects that fall outside this range cannot be rendered. This is fundamental to how perspective rendering works in graphics APIs.

As it happens, because of the way the projection matrix is defined, it is actually possible to set the “far” distance to infinity. Panda3D added support for this a while ago already. Because of the reciprocal relationship between the distance to the camera and the generated depth value, the near distance is far more critical to the depth precision than the far distance. If it is too low, then objects in the distance will start to flicker as the differences in depth values between different objects becomes 0; the video card can no longer tell the difference between their respective distances and gets confused about which surface to render in front of the other. This is usually known as “Z-fighting”.

This is a real problem in games that require a very large drawing distance, while still needing to render objects close to the camera. There are a few ways to deal with this.

One way people usually try to resolve this is by increasing the precision of the depth buffer. Instead of the default 24 bits of depth precision, we can request a floating-point depth buffer, which has 32 bits of depth precision. However, since 32-bit floating-point numbers still have a 24-bit mantissa, this does not actually improve the precision by that much. Furthermore, due to the exponential nature of floating-point numbers, most precision is actually concentrated near 0.0, whereas we actually need precision in the distance.

As it turns out, there is a really easy way to solve this: just invert the depth range! By setting the near distance to infinity, and the far distance to our desired near distance, we get an inverted depth range whereby a value of 1.0 is close to the camera and 0.0 is infinitely far away. This turns out to radically improve the precision of the depth buffer, as further explained by this NVIDIA article, since the exponential precision curve of the floating-point numbers now complements the inverse precision curve of the depth buffer. We also need to swap the depth comparison function so that objects that are behind other objects won’t appear in front of them instead.

There is one snag, though. While the technique above works quite well in DirectX and Vulkan, where the depth is defined to range from 0.0 to 1.0, OpenGL actually uses a depth range of -1.0 to 1.0. Since floating-point numbers are most precise near 0.0, this actually puts all our precision uselessly in the middle of the depth range:

This is not very helpful, since we want to improve depth precision in the distance. Fortunately, the OpenGL authors have remedied this in OpenGL 4.5 (and with the GL_ARB_clip_control extension for earlier versions), where it is possible to configure OpenGL to use a depth range of 0.0 to 1.0. This is accomplished by setting the gl-depth-zero-to-one configuration variable to `true`. There are plans to make this the default Panda3D convention in order to improve the precision of projection matrix calculation inside Panda3D as well.

All the functionality needed to accomplish this is now available in the development builds. If you wish to play with this technique, check out this forum thread to see what you need to do.

Double precision vertices in shaders

For those who need the greatest level of numerical precision in their simulations, it has been possible to compile Panda3D with double-precision support. This makes Panda3D perform all transformation calculations with 64-bit precision instead of the default 32-bit precision at a slight performance cost. However, by default, all the vertex information of the models are still uploaded as 32-bit single-precision numbers, since only recent video cards natively support operations on 64-bit precision numbers. By setting the vertices-float64 variable, the vertex information is uploaded to the GPU as double-precision.

This worked well for the fixed-function pipeline, but was not supported when using shaders, or when using an OpenGL 3.2+ core-only profile. This has now been remedied; it is possible to use double-precision vertex inputs in your shaders, and Panda3D will happily support this in the default shaders when vertices-float64 is set.

Interrogate additions

The system we use to provide Python bindings for Panda3D’s C++ codebase now has limited support for exposing C++11 enum classes to Python 2 as well by emulating support for Python 3 enums. This enables Panda3D developers (and any other users of Interrogate) to use C++11 enum classes in order to better wrap enumerations in the Panda3D API.

Multi-threading

We have continued to improve the thread safety of the engine in order to make it easier to use the multi-threaded rendering pipeline. Mutex lock have been added to the X11 window code, which enables certain window calls to be safely made from the App thread. Furthermore, a bug was fixed that caused a crash when taking a screenshot from a thread other than the draw thread.


June 2018 Development Update

Due to the vacation period, this post is somewhat delayed, but the wait is finally at an end. Here is the new update with a selection of the developments in June.

OpenGL on macOS

At the Apple WWDC in June of this year, Apple formally announced the deprecation of the OpenGL graphics API, in favor of an Apple-only graphics API called Metal. This move puzzled many as a lot of software is relying on OpenGL for macOS support, including Panda3D, and investing significant resources into developing a whole new rendering back-end to support just a relatively small segment of the market is hard to justify.

While it seems likely that—despite the deprecation notice—Apple will continue to include OpenGL support as a part of macOS, we will need to start looking at another approach for maintaining first-class support for high-end graphics on macOS. It would be nice if there were one next-gen graphics API that would be well-supported on all platforms going forward.

Enter MoltenVK. This is an implementation of the cross-platform Vulkan API for macOS and iOS, implemented as a wrapper layer on top of Apple’s Metal API. It has recently been open sourced by the Khronos group, in an effort to make Vulkan available on every operating system. Despite being a wrapper layer, it was still found by Valve to have increased performance benefits over plain OpenGL. This will let us focus our efforts on implementing Vulkan and thereby support all platforms.

Accordingly, we have increased the priority towards developing a Vulkan renderer, and it has made several strides forward in the past months. It is still not quite able to render more than the simplest of sample programs, however. We will keep you updated as developments unfold.

Mouselook smoothness improved

In order to implement camera movement using the mouse, many applications use move_pointer to reset the cursor to the center of the window every frame. However, when the frame rate gets low, the mouse movement can become choppy. This is usually only an issue occurring on Windows as other platforms support the M_relative mouse mode, which obviates the need to reset the mouse cursor. For all those who can’t or don’t use this mode, a significant improvement in smoothing this movement has now been worked out.
In previous versions, small movements that occurred between the last iteration of the event loop and the call to move_pointer could have been ignored, causing the mouselook to become choppy. This has been fixed by changing the get_pointer() method to always obtain the latest mouse cursor position from the operating system, resulting in more accurate mouse tracking. In the future, we will further improve on this by emulating relative mouse mode on Windows and perhaps even adding a new interface for handling mouselook.

Grayscale and grayscale-alpha support with FFmpeg

Panda3D’s implementation of FFmpeg now gained the ability to load videos that only contain grayscale colours more efficiently, greatly reducing the memory usage compared to the previous approach of converting all videos to full RGB. This is also extended to videos that have a grayscale channel as well as an alpha channel for transparency. Do note, however, that not all video formats support grayscale pixel formats.

Removing ‘using namespace std’ from Panda3D headers

C++ users, take note: besides the changes to add better C++11 support, we have also eliminated the bad practice of having using namespace std; in the public Panda3D headers. This prevents the entire std namespace from being pulled in and causing namespace clashes. If your codebase relied on being able to use standard types without an explicit std:: prefix, you may need to add using namespace std to your own headers. It would be even better to fully qualify your references to standard types and functions with an std:: prefix or—where appropriate—pull in specific types with individual using std::x; statements.

Bullet Vehicle chassis-to-wheel synchronisation

Using Bullet’s BulletVehicle class to simulate car physics had a problem with syncing the wheels to the chassis if the wheels were parented to the the vehicle’s RigidBodyNode. The wheel models would always be one frame ahead of the chassis model, resulting in visible artifacts as the wheels would appear to move away from the chassis. Especially if the vehicle accelerates to a significant speed, the wheels may appear to drift quite far from the vehicle. This bug was fixed thanks to a contributor.


May 2018 Development Update

With the work on the new input system and the new deployment system coming to a close, it is high time we shift gears and focus our efforts on bundling all this into a shiny new release. So with an eye toward a final release of Panda3D 1.10, most of the work in May has centered around improving the engine’s stability and cleaning up the codebase.

As such, many bugs and regressions have been fixed that are too numerous to name. I’m particularly proud to declare the multithreaded render pipeline significantly more stable than it was in 1.9. We have also begun to make better use of compiler warnings and code-checking tools. This has led us find bugs in the code that we did not even know existed!

We announced two months ago that we were switching the minimum version of the Microsoft Visual C++ compiler from 2010 to 2015. No objections to this have come in, so this move has been fully implemented in the past month. This has cleared the way for us to make use of C++11 to the fullest extent, allowing us to write more robust code and spend less of our time writing compiler-specific code or maintaining our own threading library, which ultimately results in a better engine for you.

Thinking ahead

Behind the scenes, many design discussions have been taking place regarding our plans for the Panda3D release that will follow 1.10. In particular, I’d like to highlight a proposed new abstraction for describing multi-pass rendering that has begun to take shape.

Multi-pass rendering is a technique to render a scene in multiple ways before compositing it back together into a single rendered image. The current way to do this in Panda3D hinges on the idea of a “graphics buffer” being similar to a regular on-screen window, except of course that it does not appear on screen. At the time this feature was added, this matched the abstractions of the underlying graphics APIs quite well. However, it is overly cumbersome to set up for some of the most common use cases, such as adding a simple post-processing effect to the final rendered image. More recent additions like FilterManager and the RenderPipeline’s RenderTarget system have made this much easier, but these are high-level abstractions that simply wrap around the same underlying low-level C++ API, which still does not have an ideal level of control over the rendering pipeline.

That last point is particularly relevant in our efforts to provide the most optimal level of support for Oculus Rift and for the Vulkan rendering API. For reasons that go beyond the scope of this post, implementing these in the most optimal fashion will require Panda3D to have more complete knowledge of how all the graphics buffers in the application fit together to produce the final render result, which the current API makes difficult.

To remedy this, the proposed approach is to let the application simply describe all the rendering passes up-front in a high-level manner. You would graph out how the scene is rendered by connecting the inputs and outputs of all the filters and shaders that should affect it, similar to Blender’s compositing nodes. You would no longer need to worry about setting up all the low-level buffers, attachments, cameras and display regions. This would all be handled under the hood, enabling Panda3D to optimize the setup to make better use of hardware resources. We could even create a file format to allow storing such a “render blueprint” in a file, so something like loading and enabling a deferred rendering pipeline would be possible in only a few lines of code!

This is still in the early design stages, so we will talk about these things in more detail as we continue to iron out the design. If you have ideas of your own to contribute, please feel free to share them with us!

Helping out

In the meantime, we will continue to work towards a final release of 1.10. And this is the time when you can shine! If you wish to help, you are encouraged to check out a development build of Panda3D from the download page (or installed via our custom pip index) and try it with your projects. If you encounter an issue, please go to the issue tracker on GitHub and let us know!


April 2018 Development Update

Welcome back to our monthly developer news. This month we don’t have much interesting to offer on the current developments. Most time has been spent to fix bugs and iron out existing functionality. So we decided to provide you with some outlook on which future developments you can expect to see next.

New app framework

Behind the scenes, much discussion has taken place regarding future developments of Panda3D.  In this post, we will discuss one of the plans on the table, namely to redesign the high-level application layer of the Panda3D library.

The current design of the ShowBase class as a monolithic singleton makes it easy to get started with prototyping a game in Panda, but it does have some downsides. It is cluttered with methods and variables that may not be needed by every application. It also makes running two instances of the application within the same process harder, and because it is implemented in Python, it is not available to C++ developers.

Our intent is to introduce a replacement for ShowBase that not only resolves these issues, but also encourages best practices and makes it easier for developers to write games for non-desktop platforms, such as mobile, web and VR.

For example, the ShowBase design gives the application developer complete agency over the lifetime of the application.  This is a great fit for traditional desktop applications, but not so great for mobile apps, where the operating system needs to be able to suspend and resume applications at any time in order to free up resources when needed.  Doing this today in Panda3D requires developers having to specifically detect these states, whereas we would ideally make this an intuitive part of the game structure.

Another example is virtual reality, where there is not really a meaningful “window” in the traditional sense, but the content is rather projected into a virtual 3D environment, with any GUI being superimposed into the scene in layers.  We would like to represent these concepts in a way that makes it easy for developers to develop applications for both VR and desktop, while giving them full control over the additional possibilities that virtual reality offers.

While the intent is not to remove control that game developers might need, we want to make a framework that encourages best practices that work well for all platforms.  We will follow up on this in the future with more concrete plans, but rest assured that ShowBase will remain available for the foreseeable future for any applications that rely on it.

CMake

CMake has in recent years rapidly become the de facto standard build system for open-source projects. As we have reported on before, we are working on replacing Panda’s own build system “makepanda” with it. This work is still underway on the cmake branch in GitHub.

For Panda3D developers, the integration of CMake in IDEs and other tools is far better than that of makepanda. This also allows us to better integrate the testing framework and code checking tools. Using CMake also simplifies building and directly running a built Panda3D instance (without installing) from the build directory using the rpath feature on Linux.
Another benefit is the simplified cross-compilation and exotic compiler support for mobile or ARM-based systems. In the future there might be support for CMake’s “exported targets” feature, meaning C++ users of Panda3D would not have to configure their libraries/includes/search path if they’re using CMake as well. Another exciting benefit is that CMake can lower the build times by roughly 30% dependent on the system and setup.
A little side effect of using CMake instead of makepanda is that we have less code to maintain and we get the benefits of the CMake community’s development efforts as a whole. That also means we get to focus our resources exclusively on making the engine itself awesome as we’re not distracted with the build tools.

The CMake branch is currently in a good enough state where it works great on Linux/BSD, and macOS support isn’t far behind. Windows support is slightly trickier and needs some more work before it gets up to that level of support. Mobile platforms are not yet supported.

If you run Linux or macOS feel free to grab the branch and try it for yourself. Whenever you find any bugs, just fill a report on the GitHub issue tracker or ask in the forum or on the IRC channel.

Ubuntu 18.04 “Bionic Beaver”

The most recent LTS version of Ubuntu, 18.04 has been released a few weeks ago with recent software packages. Panda3D has been successfully built on this version and updated install packages are available for the 1.10 development builds.


March 2018 Development Update

Winter is over and it’s time for a spring-cleaning. Many issues have been fixed this month and we’ve also completely refreshed the forum system. Also, changes have been made towards cleaning up the codebase and removing obsolete code. Keep an eye open for the awesome things our developers have in store for later this year!

Forum

The forums got a complete overhaul and has been moved over to Discourse, a 100% free and open source discussion board with plenty of neat features and a modern look. It has become quite a popular system of late, so it may appear familiar to some. The new software is considerably better at preventing spam and the increased mobile usability, code highlighting support and better notifications are welcome features as well. However, due to the conversion to Markdown, some formatting in old forum posts may not have been converted correctly.
If you have any trouble or concerns using the new forum, let us know! We’ll do our best to make the transition as smooth as possible.

Adjacency Geometry

Silhoutte rendering using a geometry shader. Model by Christophe Seux.

Silhoutte rendering using a geometry shader (click to enlarge). Model by Christophe Seux.

Support has been added to the OpenGL renderer for adjacency information. This is primarily useful for geometry shaders that need to access information about vertices connected to the primitive that is being processed, which is useful when implementing effects such as silhouette rendering (as seen in the screenshot to the right). Panda3D can automatically generate adjacency information for existing meshes, but can also take precomputed adjacency information.

Logging in deploy-ng

A new addition to deploy-ng which could help with debugging deployed apps—especially on Windows—is the possibility to provide a path to a log file to which a packaged app will automatically write all of its output. As GUI applications on Windows can’t write to the console, this new way of logging can be used to easily reroute the output to a log file without having to write an extra logging mechanism in your application.
To enable this feature for your application, you simply have to set the log_filename variable in your setup.py script. For an example, take a look at the setup script in the asteroids example in the deploy-ng branch. By default the log file will be rewritten every time, but with a simple switch of the log_append variable, you can preserve the previous content.

Dropping support for MSVC 2010

Since we are continuing to take greater advantage of C++11 features in the Panda3D codebase, we can no longer support the Microsoft Visual C++ 2010 compiler. The 2015 version has been made the new default for building Panda3D from source on Windows systems, and we intend to cease supporting 2010 very soon. If this is causing issues for you or your team, please make your voice heard as soon as possible on the corresponding GitHub issue!

Dropping Mac OS X 10.6 “Snow Leopard” support

Furthermore, we also intend to stop supporting Mac OS X 10.6 “Snow Leopard” due to the limits it imposes on how much of the C++11 standard can be used in the Panda3D codebase. However, if your application is still targeting this version of macOS, please give your opinion on the corresponding GitHub issue.

Video4Linux

Panda3D now supports the grayscale pixel format on Linux which is used for example by some infrared (IR) cameras. Additionally, the reading of video frames from the camera is now done asynchronously, meaning that the framerate of the application is no longer locked to the framerate of the camera in Augmented Reality applications. The previous behaviour can be restored by enabling the v4l-blocking configuration variable.

Better Python 3 Support

Support for Python 3 has been enhanced by replacing usage of the C++ string type with vector_uchar where it is used to refer to binary data. Since all strings are seen as UTF-8 now, this avoids exceptions which were raised due to confusion about whether buffers contained UTF-8 strings or binary data. Convenience functions have been added for efficiently dealing with the new way of representing binary buffers.

Media decoding and playing

CFSworks, who regularly contributes to the project, has done some work on various parts of the audio system, among many other changes. Firstly, he implemented workarounds for some rare OpenAL implementation bugs which are particularly prevalent on the Apple implementation. He also helped to clean up use of deprecated APIs in the FFMpeg integration and implemented features available to newer versions of this library. We are very grateful to him for his continued contributions.


February 2018 Development Update

We again bring you some of the highlights of the new developments in the past month. This is however not an exhaustive list of changes, which can be obtained from the commit logs in the GitHub repository.

Android developments

We’re happy to announce that the Android port has made great strides forward in the past weeks. Most importantly, there is now a complete Python interpreter added to the Panda3D app, so that Python applications can be run directly from the Android device. Many of the sample programs now run as well as they do on the desktop.

It is now even possible to compile Panda3D entirely on an Android device, using an app that provides a Linux-like terminal environment. One free and open-source example is termux, which provides a package manager that gives access to an impressive suite of software, including the compilers needed to compile Panda3D.

Furthermore, using a bash script that we provide, it is also possible to launch Panda3D from termux and pipe the output from the interpreter app back to the terminal, so that you can develop Panda apps on Android the same way as you would on the desktop.

Eventually, we intend to make it possible to use the new deploy-ng system to produce an Android package from any operating system, making it easy to deploy your application to both desktop and mobile platforms.

In a separate effort, a commercial port of Panda3D to Android has been released on the app store, called Cub3D. This is an impressively complete development environment for Panda3D apps, and can be used today to develop and run Panda apps on Android. (This software is developed by a third-party company that is not affiliated with the Panda3D team.)

Roaming Ralph running on an Android tablet

Roaming Ralph running on an Android tablet

Ball in Maze running on an Android watch with Cub3D

Ball in Maze running on an Android watch with Cub3D



CMake improvements

Behind the scenes, we have been working on adding support for the CMake build system on the cmake branch. CMake is a popular cross-platform build system that is rapidly becoming the de facto standard for open-source projects, and it is eventually intended to replace our own makepanda build script. This will make it easier to build Panda from source and to customize the build process. Last month, the CMake port saw some updates and improvements, bringing us closer to this goal.

Bullet thread safety

Users of the Bullet physics engine were previously encountering crashes when using Bullet in conjunction with the multithreaded render pipeline. This is caused by the fact that the Bullet library is not thread safe. To remedy this, we have added locking in the Panda3D wrapper for Bullet that protects the Bullet library from access by multiple threads, which makes it safe to use the Bullet integration in a multithreaded program.


January 2018 Development Update

The new year has brought with it new developments to the Panda3D engine, some of which we would like to present to you today. This is however by no means a comprehensive listing of the improvements we’re working on. Stay tuned for more posts, as we’ve got some exciting plans for 2018 ahead!

RenderPipeline light system

The light manager of Tobias Springer’s excellent RenderPipeline project has made its way into the Panda3D codebase. This is a light system designed to be used in conjunction with the GPU light culling and deferred rendering methods provided by the RenderPipeline, and is implemented in C++ for optimal performance. Now that it is included with Panda3D, it is even easier to use the RenderPipeline in your projects as it is no longer necessary to compile any C++ modules to do so—you now simply put the Python module into your project and follow the usual steps from there on out.

This feature is mainly useful from a RenderPipeline setup, but we are continuing to work on bringing the built-in lighting system more closely in line with the RenderPipeline lights. Examples of this are additional light types such as sphere and rectangle area lights and the possibility to set a light’s color temperature.

Input device support

The input-overhaul branch has received plenty of changes again and is day by day getting closer to a state where it can be merged into the master branch. The latest improvements include more devices being supported as well as overall improved handling and mapping of devices’ buttons and axes, such as for joysticks. For Windows users, there is also a new input manager available based on the Windows raw input system, which is used for devices that are not supported under the existing XInput implementation. Panda3D automatically chooses the right implementation to use for a device, so this all happens seamlessly to the developer.

Support for 3D mice has also been added. This is a class of devices that allow movement in six degrees of freedom (thrice as many as a regular mouse), and is particularly used by 3D artists for intuitively navigating a camera around a model or through a scene. This may be of particular use for the various CAD programs that are built around Panda3D.

Android developments

Android support is actively being worked on and great strides have already been made in this area. Stay tuned for the next post, in which we will have some exciting announcements to make on this front!


December 2017 Development Update

Hello everyone to our heavily delayed December post. Even though we’re quite late with this one due to lack of time, we wish you all a happy new year! Much has happened during the winter holidays, so read on to see what’s new.

What happened in the last month

The work on the input overhaul branch is almost complete and needs some more polish to finalize the API before we will merge it into the development trunk. In addition, we started to add a mapping table for known devices to have them work as expected. For other devices, the mapping is provided by the device driver with the help of some heuristics to detect the device type. Currently the input overhaul is still in heavy development and API changes will occur, though for those who are interested in testing it, sample applications are available and some manual entries with more or less accurate instructions have been created and will be finalized as soon as the API is stable.

Some long-standing bugs with the multithreaded pipeline were finally resolved. These issues caused deadlocks that occurred whenever geometry data was being manipulated on another thread, or when shadows were enabled using the automatic shader generator; as such, they were a significant barrier that prevented the multithreaded pipeline from being useful for some applications. However, more testing is needed before we can be completely confident that all the threading issues are resolved.

On macOS, it is now possible to get an offscreen rendering buffer without opening a window. This lets you render to a buffer on a headless mac server, which can be useful for plenty of things. Aside from scientific simulations where no immediate output is necessary or even desirable, another example is to send a frame rendered by Panda3D over a socket or network to display it elsewhere. This technique is used in the BlenderPanda project to render a Panda3D frame into a Blender viewport and thereby get a live display of how a model will look when used with the engine.

Looking into the crystal ball

In the coming months some of the newly developed features (input-overhaul, deploy-ng) will be polished off and merged into the master branch of panda3d. More work is also planned on the introduction of a new physically-based material model as well as support for the glTF 2.0 format. Stay tuned for more updates!