Deferred Pipeline w/ Physically Based Shading




That is very, very impressive. 0_0 Very well done indeed, I do believe! :slight_smile:

(You’re making the rest of us look bad! :stuck_out_tongue:)


Well, after downloading 1.10.0 and fixing my obvious path errors, the actually runs until “compiling shaders” …
… and then spits out …

File "", line 289, in onSceneLoaded
AttributeError: 'NoneType' object has no attribute 'prepareScene'

Here’s a screenshot of the output of the command-line.

I’ll check the samples:
Simple works. Color banding looks horrible and there’s quite the latency between pressing a key and the program reacting.

Roaming Ralph works and again the input-lag.

The colours of the carousel seem to be off. Sometimes the grass is green, sometimes it’s yellow, it seems to have three different shadows.

The fourth one looks wrong again. I get errors from “LightManager” in the output console.

What baffles me is how the lag between input and reaction does not match the rather fluid movement of the program once it reacts to the input. CommandLine output keeps telling me it finds more lamps than there are supported, which seems to be 1 only.

Hope this helped! Can provide you with more screenshots of debug output or whatever, if you want.
What I don’t understand is that you provide screenshots of examples, but these examples don’t exist anywhere.
That’s quite the downer. :stuck_out_tongue:


Most of the samples are not in the repo to keep the repo clean (since it would push the repo far over 1GB), however rdb hosted some of them, if you update to a recent version of the pipeline, it will print out the download link, so you can download it and then run the main file.

For the color banding, are you having an AMD card? It seems there are issues with color LUTS on amd cards. About the carousel, can you try updating to a more
recent pipeline version first? (Keep in mind, you will have to checkout the new master, and not the old master, since I created a new master to reduce the repository size)

About the input lag, hm, I’m not sure what could cause this, looking at your screenshots you seem to have a relatively low frame rate tho, maybe you have
gpu-buffering enabled? (Are you on linux or windows?)

Just saw you’re on windows, in that case, try disabling gpu buffering in your driver control panel (set the number of max pre-rendered frames to 1)


I thought I’m using the most up2date version… will check.

I’m running a gtx765m with 2gb vram.

I will do as you said and report back with more screenshots, will probs take a bit again. :slight_smile:

Btw… does that mean changing driver settings is mandatory? That’s a bugger, because most people will never ever do that, or don’t know how to do so. Hm. Anyhow, will do!


Well, changing the driver settings certainly helps. For most bigger programs, the driver vendors already store the best values, so the user does not have to adjust anything. I’m not sure if panda3d can take influence on those settings (especially buffering)


Hi Tobias,

I used to go by the name “kurohyou” but I can’t seem to access that account anymore. I was developing an editor for Panda3d ( with plugin architecture. I’ve recently become interesting in this project again and will start fixing some of the issues with it in order to let others contribute to it more easily. My question is, do you think your stuff could be integrated with an editor easily?


Hey, I saw you don’t use shaders (Is that correct?), in that case it will be very easy, just have a look at the simplest example: Basically you just have to init the pipeline and replace the Lights provided by panda (SpotLight, DirectionalLight) with the equivalents from the pipeline.

I’m currrently refactoring the pipeline tho (including the api), so you might want to wait until I’m done with that (shouldn’t take too long)


I think I just use the native Panda shaders that get created automatically. I assume that I’ll have to turn that off in order to run your stuff?

I’ll see if I can do a basic integration of your pipeline into the editor. I had some success getting your terrain into the editor as well :wink: I’ve got plenty of bugs to fix in order to get plugins and wrappers to work properly so take your time. Will post if I get something cool happening.


I installed this great addition and it was easy to get it to work on my computer with the latest Panda version (Panda3D-SDK-1.10.0pre-9868d87-x64.exe) for windows 7 64 bit . When I run the examples, for example Tut-Roaming-Ralph, there’s a constant flickering. When Ralph is standing still, there’s a flickering of around 1 Hz, and when he’s walking the frequency is a couple of times per second. I tried different settings in configuration.prc and pipeline.ini, but I can’t get it away.
My test system:

  • Nvidia GTX770, 2 GB
  • OpenGL 4.4
  • driver version 355.60. WHQL (latest driver of Nvidia)

There are a number of warnings after I change a value in the Pipeline debugger : “Fragment shader is going to be recompiled because the shader key based on GL state mismatches”, but the flickering is not related to the frequency of the warnings.

There must be something I overlooked, any help would be appreciated.



Hm, you can safely ignore the fragment shader warning. About the flickering, hm, would it be possible to try a different driver maybe? Some nvidia drivers tend to be buggier than others. What for a flickering is it exactly, is the screen getting black? Can you press “V” and see if any buffer shows the flickering?


Its a flickering in which light and dark colours alternate rapidly. For example, the green grass becomes lighter green and then darker green, and then light green again, etc.

When I press V, a lot of buffers show the flickering, for example:

  • DeferredScenePass color
  • DeferredScenePass aux2
  • GlobalIlluminationPass
  • ShadowedLights
  • LightingPass
  • ExposePass
  • and all after that.
    DeferredScenepass color switches rapidly between pink and blue for the grass
    DeferredScenepass aux2 switches rapidly between full red and black/red


Can you go to Config/pipeline.ini and set enableEarlyZ to False there, and see if that helps? Also, do you have any custom configuration options, like threading or so enabled?


I haven’t changed any of the default values in pipeline.ini or configuration.prc. I also experimented with the driver settings (switch FXAA on/off, thread optimalisation automatic/off, etc) but that didn’t make a difference either.

I tried switching enableEarlyZ to False, but that doesn’t help. However, what I found was that is that the flickering disappears if I disable PBS and Shadows in the pipeline debugger. If one of these two is enabled again, the flickering reappears.



I don’t know what it means, but if I toggle all features off (occulsion, scattering,etc) in the buffer viewer, DeferredScenePass color and DeferredScenePass aux2 still show the flickering, although it can’t be seen in the FinalPass. If I then enable PBS, the flickering also can be seen in FinalPass and all buffers before that.

Another thing is that, depending on where Ralph is standing, there’s a flickering of 1 per second that matches with the start of ‘redrawing’ of DistributeVoxels.


Sorry for all the messages, but I think I now found it. When I set enableGlobalIllumination to False in pipeline.ini, the flickering is gone.


Hm, thats very strange, it seems more like a driver bug to me. Did you have the chance of trying an older driver?


Yes, I have tried 347.09 of Nvidia as well. I have now installed the latest driver of Nvidia, which is 355.60. Both show the same flickering. But I can live without the globalIllumination.

In my own databases I have a lot of transparent png textures. However, they are not drawn transparent, but as green rectangles even though I have set useTransparency = True in pipeline.ini. Is there another setting that may cause this ?


Yeah, I’m sorry, I accidentally disabled it in the latest commit. You have to go to Shader/DefaultShaders/Default/fragment.glsl and uncomment line 41.

FYI, useTransparency doesn’t relate to binary transparency, it only controls non-opaque objects


If I uncomment line 41 the transparant part of the texture changes from green to black, but its still not transparant. In the egg file, the texture looks like this, for example:

21 {
alpha { dual }
wrap { repeat }
wrapu { repeat }
wrapv { repeat }
minfilter { linear-mipmap-linear }
magfilter { linear }
envtype { modulate }

and this is drawn transparant in Panda. Do I need to make changes for trnasparant textures in the deferred pipeline ?