Deferred Pipeline w/ Physically Based Shading

Added support for parallax mapping this morning:
The right side shows parallax mapping, the left side regular normal mapping.
The result isn’t that good, but i believe this might be an issue of the used textures, too.
Full res

I also added PointLight shadows amongst other features.

1 Like

I’ve been using Panda3D since 2008 when I was still in high school. And I’ve had to switch to other engines for numerous reasons, such as lack of modern rendering features (such as a deferred renderer as a part of the engine, scene and terrain editor, as well as mobile platform support). I’ve been following this thread for some time, and it’s something that if I saw Panda could do would make me come back to using this engine at least for the Desktop projects. But first I have to ask this question: where are you going with this? I don’t mean what more you intend to add, I’m asking what is it going to “be” when you think it’s matured enough? All the modern engines have these included as part of the engine. A shader system and general shaders are included in such engines and toggled by simple function calls or even simply set in the scene editor. Don’t you think it would be best at some point to add this as a Panda3D package at least, distributed with the engine? Don’t get me wrong, I like what you’re doing, for free. It’s amazing. But I’ve seen time and time again that when someone doesn’t contribute features to the main librarie’s code, but makes his own “interface” sitting on top of the engine, with separate webpage to download it, separate documentation, separate installation it always 1) at one points stops being developed by the original developer and nobody picks it up, 2) is not used by many because its not included nor is mentioned on the main webpage of the engine, 3) makes potential users not decide on this engine because they hadn’t seen there’s an unofficial “engine on top of the engine” which had the features they needed. I don’t think the last point can even be debated. Check the images of Panda projects in the Gallery page then your screenshots. Miles away in render quality. And 4th point is, people like me don’t want to commit to a library not part of the main library which is more likely to face this faith than the engine itself.
If Panda had a strict philosophy of having certain features separate from the engine I would understand, but this is an engine which officially includes several audio and physics libraries and a second GUI library. Heck, even the Panda AI library which was made by some CMU students is still part of the engine and has had some bugs fixed over the years, while its own separate webpage is long gone.
Now, if you want we could discuss this elsewhere, but I think if you disagree that this should at one point be part of the game engine you should at least give the reasons for everyone to know. Because I’ve seen this happen before and seeing the road Unity, Unreal and even the newborn Godot are going and how many more people use them for professional work it’s sad to see Panda stay this way.
Thanks,
Anon

Well, the pipeline is thought as an addition to Panda3D. It aims to add functionality where Panda3D lacks. However, coming with its own render system, it does have some concepts differing from Panda3D. For example, I have my custom implementation of Lights, not using Panda3D’s light system (for reasons, the light system doesn’t quite support everything I’d need yet). My light system has a very similar interface, but internally works fundamentally different.

rdb is already constantly integrating features from the Pipeline to Panda3D, like adding PBS properties to Materials or improving the Shader system, as well as many gl optimizations.

However, adding the pipeline to Panda3D would kinda stop its development. I’m frequently pushing updates, and those might be rather stable or not. When added to Panda3D, I would have to get the pipeline to a more stable version, and I also don’t want to push that many commits to the main Panda3D repository that often.

Additionally the pipeline comes with its own setup which would have to somehow get integrated into Panda3D too. It also comes with custom editors for the Plugin settings, which stands in contrast to pandas PRC files (I’m using YAML almost everywhere).

I’m not really seeing an advantage when integrating it into Panda3D. Just having it in the Panda3D source doesn’t automatically mean its maintained. (Best example is contrib/src/sceneeditor for example).

It certainly helps keeping it advertised tho. Maybe there could be an additional download button or so, I’m not too sure about that.

Okay, few things about your response,
I understand your reasons but 1) I’m not talking about your library at this point, but the future when you’ll consider it stable. This is both to your point about making changes often and doing some things different than Panda, and 2) I didn’t say merging your code with panda would automatically make it always be maintained, what I said was it makes it more likely and also makes it more accessible and gave reasons. See, even with things like the PandaAI AI library, as far as I know the original devs are gone, their site too, and not much has been added except of bug fixes, but it’s still as usable as it was when it was released. And I don’t think it would be fair to compare that or the never-finished incomplete scene editor demo with at some point possibly finished deferred rendering pipeline which is an essential feature way more devs need.
And if there are certain features different between Panda and your code that cannot be changed because of the nature of fixed function and could not be overcome with some abstraction layer (I can’t think of an example right now though), then so be it, then the users shall write slightly different code for each rendering mode. I don’t see this as a good reason by itself to keep the codes separate.

Again, don’t get this the wrong way, you’re doing some amazing work. This is just my reasons why I think it will be best for everyone to at some point have these features within Panda like the other engines have had for a long time.

Great job and rapid progress. Kudos!

If I want to port it to GL 3.0 will that be possible easily?

Thanks

Well, rdb stated he will have a look of what features could be useful to panda in general (without using the renderpipeline, too), for example PSSM and IES Profiles.
Maybe the rest of the pipeline could be then somewhere in contrib/src.

Hm, the problem is that for the lighting, GL 4.0 is required. It uses a lot of imageLoadStore to populate the light buffers. The other plugins don’t use GL 4.0 that much, you could disable the ones who do. You would have to change the shader version in all shaders to 330 or something like that, and replace all those GLSL fma calls (can be simply done by a macro tho).

However, is there any reason you don’t want to use GL 4.0? It really provides many benefits, and almost all drivers (Except the bad intel drivers on linux) support it already, even laptop gpus.


Update:

Spent the last three days trying to implement volumetric clouds. Unfortunately, to get realtime performance, I can’t get it the way I’d like it to look. I will have to see if I find a better way for rendering clouds. Sprites didn’t quite work out because of the required ordering to get correct transparency.

This is with a budget of ~3ms, and a voxel grid of 256x256x16:
(Full Res)

Thanks for your answer.
Yeah I am primarly developing on Linux and have Skylake HD Graphics 530. I think Linux is still months away from having GL 4.0+ supprt. I actually wanted to try to port the RenderPipeline to OpenSceneGraph as a learning experiance. I will stick to Windows mean while.

Thanks again for everything.

Which game uses volumetic clouds? Thats impressive but you might be pushing the limit of modern hardware. All the games I’ve checked still use scrolling tileable animated textures if your character is on the ground or billboards fading as you approach them on your plane, etc.

Sure why not?
I’m trying to install your pipeline but I get this error:

-------------------------------------------------------------------------------

Render Pipeline Setup 1.1

-------------------------------------------------------------------------------


[ 01 ]  Checking if the repo is complete ..


It appears the submodule 'RenderTarget' is missing! Most likely you used the 'Do
wnload ZIP' button or did not use 'git submodule init'. Do you want the setup to
 automatically download the submodule for you? (y/n): y
Fetching: https://github.com/tobspr/RenderTarget/archive/master.zip
Extracted 6 files and 0 directories


It appears the submodule 'GLSL-Color-Spaces' is missing! Most likely you used th
e 'Download ZIP' button or did not use 'git submodule init'. Do you want the set
up to automatically download the submodule for you? (y/n): y
Fetching: https://github.com/tobspr/GLSL-Color-Spaces/archive/master.zip
Extracted 3 files and 0 directories


The C++ modules of the pipeline are faster and produce better results, but we wi
ll have to compile them. As alternative, a Python fallback is used, which is slo
wer and produces worse results. Also not all plugins work with the python fallba
ck (e.g. PSSM). Do you want to use the C++ modules? (y/n): y


[ 02 ]  Downloading the module builder ...
        Running script: Code/Native/update_module_builder.py


[ 03 ]  Building the native code .. (This might take a while!)
        Running script: Code/Native/build.py
Traceback (most recent call last):
  File "build.py", line 40, in <module>
    run_cmake(config, args)
  File "C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\Native\Script
s\setup.py", line 90, in run_cmake
    try_execute("cmake", join_abs(get_script_dir(), ".."), *cmake_args)
  File "C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\Native\Script
s\common.py", line 157, in try_execute
    output = subprocess.check_output(args, bufsize=1, stderr=subprocess.STDOUT)
  File "C:\Panda3D-1.10.0-x64\python\lib\subprocess.py", line 566, in check_outp
ut
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Panda3D-1.10.0-x64\python\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Panda3D-1.10.0-x64\python\lib\subprocess.py", line 958, in _execute_c
hild
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Failed to execute 'build.py'
Output: Command '['C:\\Panda3D-1.10.0-x64\\python\\python.exe', '-B', 'build.py'
]' returned non-zero exit status 1
 Creating directory C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\N
ative\Scripts\..\win_amd64_py27
Executing command:  cmake C:/Users/User/Desktop/RenderPipeline-refactoring_beta/
Code/Native -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_EXECUTABLE:STRING=C:\Pand
a3D-1.10.0-x64\python\python.exe -DPROJECT_NAME:STRING=RSNative -DINTERROGATE_LI
B:STRING=libp3interrogatedb -GVisual Studio 10 2010 Win64 -DPYTHONVER:STRING=27
-DIGATE_VERBOSE=0 -DOPTIMIZE=3


Setup failed:  Python script didn't return properly!
Please fix the errors and then rerun this file
Press any key to continue . . .

I’m using WIndows 7 and Panda 1.1.10

Well yeah, I also noticed that, but I thought I’d give it a try and see how well it works out :slight_smile: Also I think its not bad to have some kind of “extreme” setup for those guys with crazy pcs :stuck_out_tongue: I believe the default option will be to use a simple skybox tho.

Hm, it seems that downloading the module builder failed. Can you check if Code/Native/build.py exists?
You can also try rerunning the setup. Maybe something went wrong while downloading the zip.

If nothing of the above two options helps, try running Code/Native/update_module_builder.py. This should generate a build.py which you can then run. After that, run the setup with “setup.py --skip-native”. That’d be only the emergency option tho :stuck_out_tongue:

I tried it few times. BTW, first there was an error because it assumed I have the “six” package and didn’t download it iself. I was able to fix it myself, but just letting you know.

The file build.py exists:

#!/usr/bin/python

import sys
import os
import argparse
from os.path import join, realpath, dirname

from Scripts.common import get_ini_conf, write_ini_conf

if __name__ == "__main__":

    # Arguments
    parser = argparse.ArgumentParser(description="P3DModuleBuilder")
    parser.add_argument(
        '--optimize', type=int, default=None,
        help="Optimize level, should match the one used for the Panda3D build",)
    parser.add_argument(
        "--clean", action="store_true", help="Forces a clean rebuild")
    args = parser.parse_args()

    # Python 2 compatibility
    if sys.version_info.major > 2:
        raw_input = input

    config_file = join(dirname(realpath(__file__)), "config.ini")
    config = get_ini_conf(config_file)

    # Find cached module name
    if "module_name" not in config or not config["module_name"]:
        module_name = str(raw_input("Enter a module name: "))
        config["module_name"] = module_name.strip()

    # Write back config
    write_ini_conf(config, config_file)


    # Just execute the build script
    from Scripts.setup import make_output_dir, run_cmake, run_cmake_build
    make_output_dir(clean=args.clean)
    run_cmake(config, args)
    run_cmake_build(config, args)

    print("Success!")
    sys.exit(0)

As for the second option, I ran update, then executed build.py .Got an error:

Creating directory C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\Na
tive\Scripts\..\win_amd64_py27
Executing command:  cmake C:/Users/User/Desktop/RenderPipeline-refactoring_beta/
Code/Native -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_EXECUTABLE:STRING=C:\Pand
a3D-1.10.0-x64\python\python.exe -DPROJECT_NAME:STRING=RSNative -DINTERROGATE_LI
B:STRING=libp3interrogatedb -GVisual Studio 10 2010 Win64 -DPYTHONVER:STRING=27
-DIGATE_VERBOSE=0 -DOPTIMIZE=3

Traceback (most recent call last):
  File "build.py", line 40, in <module>
    run_cmake(config, args)
  File "C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\Native\Script
s\setup.py", line 90, in run_cmake
    try_execute("cmake", join_abs(get_script_dir(), ".."), *cmake_args)
  File "C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\Native\Script
s\common.py", line 157, in try_execute
    output = subprocess.check_output(args, bufsize=1, stderr=subprocess.STDOUT)
  File "C:\Panda3D-1.10.0-x64\python\lib\subprocess.py", line 566, in check_outp
ut
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Panda3D-1.10.0-x64\python\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Panda3D-1.10.0-x64\python\lib\subprocess.py", line 958, in _execute_c
hild
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

I downloaded the WHL of subprocess from here, pypi.python.org/pypi/pyutilib.subprocess , installed it with PIP,

pip install pyutilib.subprocess-3.6.2-py2-none-any.whl

but same error.

Oh well, sorry for that, there was an issue in the RenderPipeline init script, not adding six to the path (should be fixed now). Six is included in the render pipeline so you don’t have to install it yourself :slight_smile:

EDIT: Found another issue with it. Give me a second to fix it.
EDIT2: Okay should be fixed now (Hopefully)

You also don’t need to install the subprocess modules, they are a builtin module in python.

Are you using Python 3 or Python 2? It looks like you are getting some really weird issues.

The Python version came with Panda 1.10 (2.7). panda3d.org/download.php?pla … =devel&sdk

Sorry, still the subprocess error.

C:\Users\User\Desktop\RenderPipeline-refactoring_beta>python setup.py
-------------------------------------------------------------------------------

Render Pipeline Setup 1.1

-------------------------------------------------------------------------------


[ 01 ]  Checking if the repo is complete ..


It appears the submodule 'RenderTarget' is missing! Most likely you used the 'Do
wnload ZIP' button or did not use 'git submodule init'. Do you want the setup to
 automatically download the submodule for you? (y/n): y
Fetching: https://github.com/tobspr/RenderTarget/archive/master.zip
Extracted 6 files and 0 directories


It appears the submodule 'GLSL-Color-Spaces' is missing! Most likely you used th
e 'Download ZIP' button or did not use 'git submodule init'. Do you want the set
up to automatically download the submodule for you? (y/n): y
Fetching: https://github.com/tobspr/GLSL-Color-Spaces/archive/master.zip
Extracted 3 files and 0 directories


The C++ modules of the pipeline are faster and produce better results, but we wi
ll have to compile them. As alternative, a Python fallback is used, which is slo
wer and produces worse results. Also not all plugins work with the python fallba
ck (e.g. PSSM). Do you want to use the C++ modules? (y/n): y


[ 02 ]  Downloading the module builder ...
        Running script: Code/Native/update_module_builder.py


[ 03 ]  Building the native code .. (This might take a while!)
        Running script: Code/Native/build.py
Traceback (most recent call last):
  File "build.py", line 40, in <module>
    run_cmake(config, args)
  File "C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\Native\Script
s\setup.py", line 90, in run_cmake
    try_execute("cmake", join_abs(get_script_dir(), ".."), *cmake_args)
  File "C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\Native\Script
s\common.py", line 157, in try_execute
    output = subprocess.check_output(args, bufsize=1, stderr=subprocess.STDOUT)
  File "C:\Panda3D-1.10.0-x64\python\lib\subprocess.py", line 566, in check_outp
ut
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Panda3D-1.10.0-x64\python\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Panda3D-1.10.0-x64\python\lib\subprocess.py", line 958, in _execute_c
hild
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Failed to execute 'build.py'
Output: Command '['C:\\Panda3D-1.10.0-x64\\python\\python.exe', '-B', 'build.py'
]' returned non-zero exit status 1
 Creating directory C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\N
ative\Scripts\..\win_amd64_py27
Executing command:  cmake C:/Users/User/Desktop/RenderPipeline-refactoring_beta/
Code/Native -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_EXECUTABLE:STRING=C:\Pand
a3D-1.10.0-x64\python\python.exe -DPROJECT_NAME:STRING=RSNative -DINTERROGATE_LI
B:STRING=libp3interrogatedb -GVisual Studio 10 2010 Win64 -DPYTHONVER:STRING=27
-DIGATE_VERBOSE=0 -DOPTIMIZE=3


Setup failed:  Python script didn't return properly!
Please fix the errors and then rerun this file

It seems the issue is that you do not have cmake installed, or not on your path. The error shown is pretty cryptic, so I didn’t see it right in the beginning.

I have added an extra check to the setup now, which shows a message when cmake is not installed, instead of this cryptic error :slight_smile:

Sorry for the inconvenience, hopefully everything works now

Okay, tried the new version.

C:\Users\User>cmake --version
cmake version 3.4.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).
-------------------------------------------------------------------------------

Render Pipeline Setup 1.1

-------------------------------------------------------------------------------


[ 01 ]  Checking if the repo is complete ..


The C++ modules of the pipeline are faster and produce better results, but we wi
ll have to compile them. As alternative, a Python fallback is used, which is slo
wer and produces worse results. Also not all plugins work with the python fallba
ck (e.g. PSSM). Do you want to use the C++ modules? (y/n): y

Could not find cmake!
It seems that cmake is not installed on this system, or not on
your path. Please install cmake and make sure it is on your path.
You can ensure this by running 'cmake --version' in a command line.
Full error message:
[Error 2] The system cannot find the file specified
Setup failed:  cmake missing
Please fix the errors and then rerun this file
Press any key to continue . . .

BTW, did you know materials in the Blender 3d program can be accessed as GLSL shader and YABEE exported for Panda supports also exporting the shader materials? Maybe could be implemented in your pipeline somehow.

EDIT: Talking about Blender’s renderer, not the included Cycles ray tracing renderer

Have you tried updating the pipeline? Had a typo, which I committed after the other fix

Hm, well yeah, it would somehow have to fit into PBR tho. From what I saw, it looks like those shaders include their own brdf. One would have to modify them so they just output material properties. I haven’t yet found time to investigate into it

I deleted the folder and redownloaded. I’ll try again.

Cool that you’re interested.

Sorry man, doesn’t want to work for me.

-------------------------------------------------------------------------------

Render Pipeline Setup 1.1

-------------------------------------------------------------------------------


[ 01 ]  Checking if the repo is complete ..


The C++ modules of the pipeline are faster and produce better results, but we wi
ll have to compile them. As alternative, a Python fallback is used, which is slo
wer and produces worse results. Also not all plugins work with the python fallba
ck (e.g. PSSM). Do you want to use the C++ modules? (y/n): y


[ 02 ]  Downloading the module builder ...
        Running script: Code/Native/update_module_builder.py


[ 03 ]  Building the native code .. (This might take a while!)
        Running script: Code/Native/build.py


[!] FATAL ERROR: Subprocess returned no-zero statuscode!
Failed to execute 'build.py'
Output: Command '['C:\\Panda3D-1.10.0-x64\\python\\python.exe', '-B', 'build.py'
]' returned non-zero exit status 1
 Creating directory C:\Users\User\Desktop\RenderPipeline-refactoring_beta\Code\N
ative\Scripts\..\win_amd64_py27
Executing command:  cmake C:/Users/User/Desktop/RenderPipeline-refactoring_beta/
Code/Native -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_EXECUTABLE:STRING=C:\Pand
a3D-1.10.0-x64\python\python.exe -DPROJECT_NAME:STRING=RSNative -DINTERROGATE_LI
B:STRING=libp3interrogatedb -GVisual Studio 10 2010 Win64 -DPYTHONVER:STRING=27
-DIGATE_VERBOSE=0 -DOPTIMIZE=3

Process error:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:5 (project):
  No CMAKE_CXX_COMPILER could be found.



-- Configuring incomplete, errors occurred!
See also "C:/Users/User/Desktop/RenderPipeline-refactoring_beta/Code/Native/win_
amd64_py27/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User/Desktop/RenderPipeline-refactoring_beta/Code/Native/win_
amd64_py27/CMakeFiles/CMakeError.log".


Setup failed:  Python script didn't return properly!
Please fix the errors and then rerun this file
Press any key to continue . . .

It looks like you don’t have the Visual C++ compilers installed. Checkout Building the CPP Modules to see which requirements you need.

I will see if I can add an error message when no c++ compiler is installed. I will also add it to the readme :slight_smile:

For just trying out the pipeline, it might be enough to just use the Python modules, which don’t have to get compiled.

Oh, pipeline runs fine, except some shaders don’t have effect and it’s slow. So I want to check hpow the C++ version does.