viewport PBR using GLSL nodes?

blend4web team recently patched a fresnel node for GLSL nodes,

UPBGE has realtime reflection probes and offline reflection probes,

Has anyone been able to squeeze realtime PBR out of these 2 yet? Fresnel chooses mimap level to blend, and reflection stencil is used for metalness,

the rest is math nodes right?

it may require a custom build but this is doable now in master? (before 2.8)

and if this works now, it will be a nice bridge for us GE / GLSL folks waiting for PBR.

If I didn’t misunderstand you, you want a realtime PBR shader made with nodes, here is one I made: RealtimePBR.zip (599 KB)
It uses Schlick’s approximation instead of the Fresnel node, because the difference is not visible imho.
It uses the same inputs as UE4.
The image used for image based lighting is from there: https://hdrihaven.com/hdri.php?hdri=white_cliff_top
Don’t forget to also append the sun object if you append the material, for correct lighting (the color and rotation match the hdri).
The value inside the “HDR” node group controls the brightness of the whole scene.
“Bugs” of this shader:

  • for the IBL it uses 10 images (9 for the “glossy shader” with roughness 0, 0.125, 0.25, 0.375,… and one for the “diffuse shader”) so in between the different roughness values it blends between the images, so it is not perfect (but the most efficient realtime solution)
  • because the material node doesn’t support specular hardness i did blend between 9 specular materials… (pretty inefficient, I think… + the blending is quite ugly :/, so if you don’t use textures for roughness input, I’d recommend to use roughness values that are a whole multiple of 0.125)
  • a very small and probably also not noticeable bug is that there is no interpolation at the seams of the cubemaps (at least I can’t see it if i not search for it)
  • a bug that isn’t one: if you have a texture that has roughness values for blender cycles, simply add a math node and multiply it by itself/square it, then it’s looking like intended
    I hope I didn’t forget anything and I could help you :slight_smile:

@TheLumcoin
A very great thanks for your sharing, Friend! Congratulations i love UE4 too! :cool:
At soon…
Spirou4D

This is amazing!

now how do I get the realtime cubemap reflection probe blended with a static ref probe grid, and used as the reflection ?

(UPBGE) - I will share the setup with the devs :smiley:

I’ve made an updated version: RealtimePBRv0.2.zip (621 KB)
I’m still far from finished but I was able to implemented the GGX specular shading model (the default distribution for the cycles glossy shader => It looks gorgeous), the only negative aspects are that multiple lights are a mess, I have to find a way to make it easier… (you have to add nodes for every light source :/) + I haven’t yet completely understood how UE4 calculates the specular/when I implement what should be the correct shader, it does look crappy.
But because of the in nodes written specular shader the issue with the blending between several highlights doesn’t exist anymore (^.^)/ + it should run a little bit faster
(and I didn’t know that the issue with interpolation at the cubemap-seams doesn’t exist in UPBGE, so the shader is pretty close to perfect (if I find a proper way to handle multiple light sources and if I can fully implement the UE4 specular shader))
For the realtime cubemaps… I’ll optimise the environment maps in the shader tomorrow + hope that UPBGE is able to render 9 cubemaps at once xD if not, I have to find an easy understandable way to change the roughness effectively.

Mipmaps =D

@TheLumcoin, when you say you implemented the “GGX specular shading model”, you mean a glsl shader? If so heres a branch(ge_brdf) not finished. Link-> https://github.com/UPBGE/blender/tree/ge_brdf

@Akira_San, no, I made it via Material Nodes, that’s the reason why you have to add nodes for every additional light source. (just open the .blend and you will see)
@BluePrintRandom …how? Because I have no Idea how I can control the mipmap-level (via nodes)…

this is where we need to work with the upbge team at #upbgecoders Lumcoin

The shader looks nice, Lets see it with textures. :slight_smile:

G’day mate, I’ve made my own PBR shader for BGE and I’m using your Roughness Sample node for Reflections. Is it okay if I can share my PBR shader with your nodes in it? I’ll credit you.