Blender Game Engine PBR Shader Machine

materials
game
texturing
(Iza Zed) #1

Hi!

I played around with the shaders in UPBGE and after a day of frustration and surprise successes, I managed to come up with a node-based system that fakes PBR materials.

The way it works:

  • The main shader (basically a small principled shader) takes in 6 materials:
    • 3 metal materials (glossy, blurry, rough)
    • 3 dialetric materials (glossy, blurry, rough)
  • By mixing them together with the inputs from the main node, you can create a variety of materials

It’s not perfect yet, but I started using the PBR Machine in my workflow and so far I had no problems and an amazing increase in speed and quality.

Though I wouldn’t exactly encourage you to use it, for I have not tested the performance impact thoroughly enough, it would certainly be a good thing if people tested it and played around with it a bit.

DISCLAIMER:
I don’t own the textures in this file, I just used some to play around with, so don’t use them in projects!
If you give me HDRIs, I can give you Cubemaps and expand the repository

Download (Please credit me should you use it - “Leopold Auersperg-Castell”)

How to use:

  • Create a folder somewhere in your game directory and place the .blend there
  • Append the “PBR_Base_dialetric” and “PBR_Base_metallic” from the .blend
    - (they actually both do the same, they are just presets)
  • Assign one of the PBRs to the Object of desire and make a Single User Copy
  • Remember to make Single User Copies of the Texture Set Node and the Textures as well for new materials
  • Edit the PBR

Update 0.2:
Now uses Fresnel more accurately
Has correct roughness calculation (no more spec-meddling)

Update 0.3:
Fixed a normal map issue
added Ambient Occlusion input
tested with substance painter maps -> works

Pictures


Video Tutorial Link:

Hope this is of use to someone
Now blend something

1 Like
(BluePrintRandom) #2

Try UPBGE Cubemap environment probe w/LOD bias option on the same texture 3 levels

mix map for the 3 textures is called roughness

put a stencil over it and call it metalness

put a emissive map on there for FX after :smiley:

you don’t need to mess with spec as spec is faking reflection. turn it off.

(Iza Zed) #3

Thing is, i cant plug an environment map (Cube-Map) into the material in the “not-cycles”-nodes
same goes for the stencil, but I simpled it down a bit and added the emission socket (haven’t tested it yet though)

Also, the real-time-reflections in UPBGE 0.2.4 don’t seem to work, at least on my machine

But thanks for the feedback!

(BluePrintRandom) #4

set texture as environment material - select cube map

set the mapping to reflection, check ‘mirror’

(BluePrintRandom) #5

ok, figured it out

if you have a material in the scene on a distance object
Name it reflect - set the real mirror object up, and give it nodes, and use the reflect as the material in the nodes.

for some reason upbge does not update the mirror on the node material unless you have a instance of the ‘reflect’ mateiral in the scene

already talking to upbge developers about a fix.

2 Likes
(Iza Zed) #6

Oh nice!
I’m going to implement it when the fix is out then :slight_smile:

Might gonna get back at you on how to best implement it

1 Like