HOWTO: Installing Panda3d on Raspbian / Raspberry Pi 4

Building Panda3d on a Raspberry Pi 4

Date: April 9, 2020

About

Building Panda3d can be a time-consuming process, especially on single board computers. The goal of this document is to get you building Panda3d on a Raspberry Pi 4 with minimal pain.

This document is based on my experience building Panda3d 1.11 (git master) on Raspbian 10-buster (Desktop) on a Raspberry Pi 4 with 2G of RAM.

Don’t want to build? Download it instead:

The build artifact of this document (compiled on Raspbian 10 Buster Desktop Edition) can be grabbed at: https://drive.google.com/open?id=1f1qUSNmdh8s4D8JjFjzR4xScK1DzAjTA

This build includes ffmpeg support.

Dependencies

Panda3d requires quite a bit of pre-configuration to get going. Thankfully all of the packages you need are in the Debian package repositories.


build-essential

libavformat-dev

libavcodec-dev

libswscale-dev

libsquish-dev

libeigen3-dev

libopenal-dev

libfreetype6-dev

zlib1g-dev

libx11-dev

libjpeg-dev

libvorbis-dev

libogg-dev

libassimp-dev

libode-dev

libssl-dev

So, let’s install those now by running:


sudo apt install build-essential libavformat-dev libavcodec-dev libswscale-dev libsquish-dev libeigen3-dev libopenal-dev libfreetype6-dev zlib1g-dev libx11-dev libjpeg-dev libvorbis-dev libogg-dev libassimp-dev libode-dev libssl-dev

Downloading Panda3d

Now that we have the dependencies installed, we need to download Panda3d. We can snag the latest and greatest master branch from the git repository by running:


git clone https://github.com/panda3d/panda3d.git

Building Panda3d


cd panda3d

Next, we need to invoke MakePanda, which is Panda3d’s smart build script that will handle everything from dependency detection to building everything we need for Python to run Panda3d based programs.


python3 makepanda/makepanda.py --everything --installer --threads=2 --use-gles2

(Note that we use python3 on our system because we’re targeting python 3.0 - If you’re still on 2.7, then run MakePanda with your python2 executable)

This process will take quite a while. On my setup, it took about 3.5 hours. On higher-end systems with more available memory, feel free to mess with the --threads argument to potentially squeeze more power out of the build process.

Installing Panda3d

After the build process runs, it generates a .deb artifact that we can use with the Debian package installer to install Panda3d to our system. At the time of this writing, the deb file was panda3d1.11_1.11.0_armhf.deb though the name will change depending on the version you’re compiling.

Let’s install the package by running:


sudo dpkg -i panda3d1.11_1.11.0_armhf.deb

Afterward, we should be able to test things out by running the Panda3d sample programs.

Configuration (Look here when things don’t work)

By default, configurations are read from /etc/Config.prc, so the values I have listed below are saved there. What is listed below is not the entire config. Anything not listed is left as the default.


load-display pandagl

fullscreen #t

show-frame-rate-meter #t

Testing Your Panda3d Installation

Panda3d ships with several samples located in /usr/share/panda3d/samples. Let’s run the Roaming Ralph sample to make sure we’re good:


cd /usr/share/panda3d/samples/roaming-ralph

python3 main.py

You should see the little Ralph character submerged in a 3d world with complete skybox. You should also be able to move him around using the keyboard shortcuts listed on the screen. On my setup, this runs at 50-60fps. In order to enable the on-screen FPS display, set show-frame-rate-meter #t in your /etc/Config.prc file.

Changes To This Document

In the event that I missed anything, or if you’d like to contribute updates, just let me know in this thread or on Discord (JimmyHacksThings). Any changes will be reflected in the appropriate sections above and annotated here.

  • April 9, 2020 - Initial Revision
3 Likes

Thank you for those build and install instructions.
When I try to run I get:
Unable to load libpandagl.so warning
followed by the error

Exception: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.

Do I need to do additional install steps?

-=====================================
I have the following in my Config.prc:
load-display pandagl

During the build I got:
Could not locate thirdparty package gles2, excluding from build

I also added

libgles2-mesa-dev

and the game running at 30 fps now, so looks ok.

Hi, did you get shadows workking?

Thanks for the instruction. I wolud love to have Panda3D on RPi4. After building and installing .deb I have an python’s error message “No module named ‘direct’”. Panda’s docs tells that in this case I should make sure that the panda3d.pth is located inside the Python site-packages directory. I can’t find the file “panda3d.pth” anywhere. Did someone have a similar problem? What should be inside this file? Or maybe you’ve found another solution?

To diagnose, you should look for the location of direct/__init__.py on your system and check sys.path in Python to see if the parent folder of direct is included.

1 Like

Thanks a lot for the solution :slight_smile: There were no path to Panda3D. I had another message “Unable to load libpandagl.so”. I changed load-display setting to “p3tinydisplay” and images renders well but probably “pandagl” is something better (better performance or something?). Do you have any issue with pandagl?
I’ve found another thread about libpandagl.so, but probably it was something droped in my building process, because I can not find this file inside my “built” folder.

I don’t know if there is desktop OpenGL support on raspbian. If not, you may have to switch to OpenGL ES 1 or 2 with either one of:

load-display pandagles2
load-display pandagles

tinydisplay is a software renderer and will not take advantage of hardware acceleration.

Hi, there were no libs for gles in my previous build. I built it again and now I have them. I read in the docs that --everything in makepanda.py means everything, so --use-gles2 is not nesesery. It shouldn’t broke anything but this time I used makepanda.py like that: python3 makepanda/makepanda.py --everything --installer --threads=2 and now surprisingly load-display pandagles is working! I am so happy.

Thanks for help :slight_smile:

Yes, there are no shadows and lights in much faster load-display pandagles mode and everything is flat. But they are work for me in slower p3tinydisplay.

I have a good news. Lights and shadows now work for me also in GL mode. Is was easy like enter in raspi-config and there Advanced Options -> GL Driver -> GL (fake KMS)

I also installed libsdl2-dev but I am not sure it was necessary.

Hey, good news…I’ll try it.
Actually, I run a personal demo with animated character with around 800 faces and it run at 60fps but without shadows at the moment.
I’m using https://github.com/kergalym/YABEE to export models from blender 2.8

Hi,
I have only this error but no shadows.
Tested with pandagles, pandagl, pandagles2, GL (fake kms) option on raspi-config panel. I’ve build panda3d an other time with your tags but no shadows.

Sorry, my fault. I have no shadow too. I was excited because I saw the lights in the example, but objects do not drop the shadow at all.

I tryed also with panda3d-simplepbr with no success. Simplepbr works (slower) but shadows are not. Thanks for the note about Yabee exporter.

The shader generator shadows relies on Cg shaders, which are not supported in GLES2 (and GLES doesn’t support shaders at all, so, no shadows are available there).

Furthermore, the Cg Toolkit is not available for ARM architectures.

You will need to use GLSL shaders with pandagl or pandagles2 to get shadows.

This issue will be remedied in Panda 1.11 with the new shader pipeline.

Hi,
Thanks for your answer and happy to heard about a solution. Have you an idea about this new release ?
Thanks.

For people that found this discussion as I did, but might be using Ubuntu on the pi, here is a compiled package for Ubuntu Server 21.04. I’ll note it took me 2 days to compile on my 2 GB Pi 4 (eventually I had to define and increase my swap space). Note that if you’re using Ubuntu, you’ll also have to enable the OpenGL driver by adding a line to your /boot/firmware/config.txt. I added
dtoverlay=vc4-fkms-v3d
gpu-mem=256

Gist here with debian package - https://gist.github.com/ckemere/c862155111f929ad35f5c7eb0024143f

Hi, thanks for the tutorial, it worked perfectly for me until the config.prc. When I tried looking for the file under etc in the file manager it didn’t appear and when I used the terminal to try and access it, it displayed permission denied. Lastly, I took the sd card out and put it into my laptop and finally found the .prc, however once I had finished the suggested edits to the config, it would not let me save the changes. I did a bit more digging on the Pi’s terminal and it says the file is unwritable. Any help would be greatly appreciated!

Hi, I have a workaround for you. You can create a copy of the .prc file anywhere. For example copy to your Desktop and put this line of code into your python script:

loadPrcFile("/home/pi/Desktop/Config.prc")

Ok thank you so much!