In pybullet, is it possible to change the current background color (light blue/purple) to another color, or even to a texture?
For example, is it possible to have a starry night background, similar to the one found in DeepMind's control suite?
https://github.com/deepmind/dm_control
Changing background color or texture?
Re: Changing background color or texture?
I have found out we can change the background color of the GUI window using the following code:
Code: Select all
import pybullet as p
p.connect(p.GUI, options='--background_color_red=1.0 --background_color_green=0.0 --background_color_blue=0.0')
Re: Changing background color or texture?
Regarding this, I find myself unable to change the background color (which will remain light purple) either in the GUI window or in DIRECT mode when using the code above. I have experienced this issue with pybullet 3.2.5 on the following OS/python versions
- python 3.9.12 on MAC OS 11.6.5
- python 3.8.10 on Ubuntu 18
An example of the output I get is the following:

Has anyone experienced the same issue?
- python 3.9.12 on MAC OS 11.6.5
- python 3.8.10 on Ubuntu 18
An example of the output I get is the following:
with background color:Python 3.9.12 (main, Mar 26 2022, 15:52:10)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pybullet as p
pybullet build time: Jun 16 2022 23:11:14
>>> p.connect(p.GUI, options='--background_color_red=1.0 --background_color_green=1.0 --background_color_blue=1.0')
argv[0]=--background_color_red=1.0
argv[1]=--background_color_green=1.0
argv[2]=--background_color_blue=1.0
Version = 4.1 ATI-4.6.21
Vendor = ATI Technologies Inc.
Renderer = AMD Radeon Pro 5300M OpenGL Engine
b3Printf: Selected demo: Physics Server
startThreads creating 1 threads.
starting thread 0
started thread 0
MotionThreadFunc thread started
0

Has anyone experienced the same issue?
Re: Changing background color or texture?
You can change the background color of the GUI in PyBullet using the p.configureDebugVisualizer() function.
You can specify the background color using the rgbBackground parameter. This function accepts multiple parameters other than rbgBackground parameter.
Here’s an example:
In this example, the rgbBackground parameter is used to set the background color to black. You can pass an RGB vector [red, green, blue] to set a color of your choice. Each color value should be between 0 and 1.
You can specify the background color using the rgbBackground parameter. This function accepts multiple parameters other than rbgBackground parameter.
Here’s an example:
Code: Select all
p.configureDebugVisualizer(rgbBackground=[0, 0, 0])