Demomaster application framework with wxpython navigator

As part of my self-learning exercise in panda and 3D application development, I build an application framework that uses wxPython with Panda3D, to allow easy manipulation of panda 3d objects through auto-generated wxPython control GUI interface.

I aim at reusing the framework and the corresponding higher level objects to simplify the development in panda3d.

For example, I can mix the ode objects, shadow manager, and the camera control object together in this sample program:

I have also started to port some shader programs, like the Ocean in ogre, to panda:

Since it is my learning exercise, I collect various demo programs in this forum and including them in my framework: (please let me know if you find any of the sample programs violate distribution licenses and should be removed).

Camera - Split Screen
Fog - Tunnel with a test shader
Geometry - Create various geometries
GeoMipTerrain - Yarr
GeoMipTerrain - Yarr with water
Misc - Carousel
Misc - Disco Light
Misc - Normal Mapping Demo
Misc - Splash Card and LOD
ODE - Demo 1
ODE - Demo 2
ODE - with Shadow Manager
ODE - with Shadow Manager 2
Shaders - Basic Demo
Shaders - Change Shapes
Shaders - Show Models with various effects
Shaders - Show Panda Shaders
Shadow - Shadow Manager from pro-rsoft"
Shadow - Shadow Manager from rollingt70
Texture - Skydome effect
Texture - Waterfall effect
Water - Ocean 2 from Ogre
Water - Use yarr water shader

You can download the version 0.1 from here:

It is only tested on my Windows XP machine with NVIDIA 9500 GT. Most of the program assume a powerful video card. is the main program to run.

I will have active development on this project in near future. Will post more updates soon.

There is a bug in in version 1.5.4 , most likely you may encountered if you run in Windows XP. You have to apply the fix mentioned here:

Mar 23, 2009 version 0.2 released:
This release is mainly including a simplified Ocean 2 demo to see if older PC can run it properly. Note that all nature related demo are all moved to demo_nature.

I’ve also started to add the grass effect and added a draft version. This grass object will be more generic and other scene can adopt it easily.

Version 0.3 Mar 30, 2009 major changes:

  1. new skydome added (nature scene like skydome)
  2. new grass shader added (support multiple grass models)
  3. Preliminary tree models added (using simple polygons)
  4. Panda walking on grass fields (grass movement also !)
  5. Preliminary Scene Graph navigator added (with grabbing auto shader)
  6. Shader – Advance Demo 1 (Reflection, Refraction, Fresnel and Chromatic dispersion effect)
  7. Shader – Advance Demo 2 (Dynamic mirror)

Apr 07, 2009
Version 0.4 major changes:

  1. add/fix reflection blur on various demo
  2. Water surface demos with Vertex Texture Fetching
  3. New lady model on grass field

New video:

Note that you probably need a powerful video card to run the new water demos.

Apr 18, 2009
Version 0.5 major changes:

  1. Fix some bugs in water demo, not all
  2. Compositor - various 2D filters port reference ogre demo
    (can chain multiple filters dynamically)
  3. Human model from makehuman, with script base animation (not standard blender animation)


May 12, 2009
Version 0.6 major changes

  1. Facial Expression for human model added. Major bug fixes and enhancement on the animation engine.
  2. Hair added for human model, experimental.
  3. ODE Car, enhanced version of ninth @
    car model, sound, skydome, camera views added.
  4. “Shaders – Facing Ratio” added
    Facing Ratio Shader, from ynjh_jo … acingratio
  5. Several Morphing Demos added, including Captain Blender
  6. More compatible with version 1.6.x
  7. PSSM shadow manager added (but not used)


June 9, 2009
Version 0.7 release:

Use Psyco if installed
“Misc - Volumetric Light Demo” added (just a simple test)
“Misc – HDR Test” added (just a simple test)
“Shaders – DOF” Depth of Field shader added

“Shaders – Sun” Sun shader added
“Shaders – Compositor” add:

  • Heat effect
  • Old TV
  • Old Movie
  • ASCII 2 (an improved version of ASCII)
  • Half tone
  • Bloom 2
  • Tone Mapping

“Misc – Pool Demo” added

Bugs fixes for vtf water demos (to be able to run on 1.6.x)

June 25, 2009
Version 0.8

  1. “Shaders – Hatching *” demos added for hatching effects
  2. “Shaders – Compositor”
    add “Hatching” screen effects

    add “Multiple” screen effect
  3. Performance tuning for ODE demos
  4. “Shaders – Advance Demo 1”
    Velvet shader added (seems not working well ?)
    Mario, Crystal shader from mavasher added.
  5. “Misc - Lens flare” demo added
    From Legion -
  6. Panda GUI option support (now demomaster can run with no wxpython installed). base on treeform’s treegui

Run “ f f f” if you don’t want wxpython.

Known bugs:
the head of Human 1 will disappear at certain angle
Captain Blender’s texture is not correct
Sound in ode car may not sounds right in 1.5.4.

Two word: total awesomeness :slight_smile:
This is very cool. Thanks so much for sharing it with us!

One thing: when I clicked something in the listbox (e.g. ‘toggle this/that’) I can’t click it again, I have to click something else first. Might want to make that the list item gets deselected once you clicked it?

Hi pro-rsoft, I believe you are testing it on Linux ? It behaves well on Windows XP.

I think I need to fix it … may be I can try it on my Linux virtual machine.

sweet! This looks great, clcheung!

Well, I have just tried to fix it in a virtualbox Ubuntu (running in Windows XP). Although it can run but I can only 0.2-0.5 FPS. Too slow for me to debug. But I don’t have a spare machine to run a native Linux at this moment.

If you click something on the “Functions” listbox, the framework will immediately set the focus to the Panda window. I am not sure if it causes the problem you described here.

The problem is I can’t click the same thing twice in the functions box.

I see. Looks like in Linux when a list box item is selected, the second select event will not be delivered again.
Here is a quick fix (not sure if it is the best fix):
Add one more line in

    def selectListDemoFunctions(self, evt):
        j = self.wxListDemoFunctions.GetSelection()
        self.executeFunction(j, False)

man I want to see that ocean demo! I just downloaded your app (and installed wxPython) and it doesn’t run; I’ll try later futzing around in the code to see if I can get it working. I’m on OSX 1.5.6.

Don’t miss that ocean demo ! Although it just a port, it spends me so much time to learn how to do it correctly…

Unfortunately I don’t have OSX experience. Please let me know your findings and see how can I merge your change to the demo.

holy cow this is sick! fantastic solution clcheung and awesome demo selection.

hm I can’t get it running on WindowsXP either. What exactly do I have to do run this? As in, step by step pretending I’m a total idiot.

I have Panda 1.5.4, installed wxPython (I got the unicode version if that makes any difference), now what?

If there is any error message ?

My configuration is, have a separate python 2.5 installed with wxPython. I do not run Panda’s python because I have many other python package already installed before I use Panda.

clcheung I gotta issues as well on the oceandemo
it loads till the end, but after that it exit with a segfault message. I tried to see the code but actually no ideas on how to fix it

Sorry that my experience is also limited. May be the shader is too complicated for your video card ? Have you tried the Ogre Ocean demo program on your machine ?

On top of the Orge ocean shader, I have added quite a number of parameters and I am not sure if it create a burden on it. I also passed the reflection plane to it for it to select a cubemap or reflection plane on the fly. And also, I added a debug colorplane on it. I believe it might create problems.

If you can run the Ogre demo well on your machine, I will reduce the shader program to match the Ogre one and see if it help.

what the hell, I can’t copy-paste text from the command prompt window?

Anyway, after a traceback through>> it dumps at
ImportError: No module named wx.lib

hm, that’s a problem with my install of wxPython right? I’ll try re-installing that.

ADDITION: Incidentally, where exactly is the shader for the ocean demo? When I go into demo-water>shaders there’s nothing, and that’s the only place that looks logical to me.

ADDITION2: nevermind I found the shader in “share”

no cheung I ain’t no OGRE here. I tried the “yarr with water” demo of your package with success though. I’ll investigate further playing with your shader and report back

Well re-installing wxPython took care of that error (I think I had it installed on the wrong version of Python before, this time I made sure it went with Panda’s Python) but now it gets the same error as I get when I try it on OSX:

There’s a whole bunch of lines that say “Listing .\something” and then “Compile result True” and finally “No application founded”

it is indeed the shader, cheung
if i comment out this line

self.waterNP.setShader(loader.loadShader( 'ocean2.sha' ))

in the script I reach the end of the script loading without errors, but of course I miss the show. Unfortunately I ain’t the knowledge to fix a shader but FYI the “shader wave demo” works very nice here on both the waves deformations and also the yarr water demo runs nice as well so it is just a matter to merge the wave shader with the sea shader of the yarr and voila’

Hi jhocking,

Let me explain the logic of the program may be it can help to track down the problem.

  1. It will first compiling all the python programs found under the current directories and below. That’s why you see “Listing …” lines.

  2. It will then look for all compiled files, one level down the current directories. e.g. demo_water\ocean2demo.pyc
    If it is a subclass of demobase.Demobase, it will be added to the available demo list.

  3. It will then create the container demomaster.Container of the demo program.

You have to look into importer.ImportCompiledObjects to check why there is no compiled object found. I suggest you put some print line statement in that function to see why no such objects found.

hi astelix,

The 's sea shader makes an ocean like water and yarr water shader make a pond like water surface. The ocean2.sha can support both effects, but may be it is too complicated to be run on your machine. I will post a stripped down version of the ocean2 and see if it helps.