GLSL PBR Shader for viewport

Had a quick go on OSX, I get black viewport though :frowning: this is with the test file from your site)

Attachments


Getting this when I run it out of the terminal on mac:

GPUShader: compile error:
ERROR: 0:2592: Invalid call of undeclared identifier ‘texelFetch’
ERROR: 0:2595: Use of undeclared identifier ‘depth’
ERROR: 0:2598: Use of undeclared identifier ‘depth’
ERROR: 0:2603: Invalid call of undeclared identifier ‘texelFetch’
ERROR: 0:2606: Use of undeclared identifier ‘depth’
ERROR: 0:2609: Use of undeclared identifier ‘depth’
ERROR: 0:3232: Invalid call of undeclared identifier ‘texelFetch’
ERROR: 0:3243: Invalid call of undeclared identifier ‘texelFetch’
ERROR: 0:7211: Invalid call of undeclared identifier ‘texelFetch’

@anadin & @TheNinja : I was afraid of this problem. texelFetch needs glsl 1.3 which is opengl 3.0. I may find a workaround at some places but I hope that blender Opengl code will move to GL3 ASAP. I gess the depth error is also related but I might be wrong I’ll check.

So bottom line is : no fix soon for OSX sorry :frowning:

I may be wrong since I don’t know much on all the technical stuff but I think on the BF roadmap for blender 2.8 opengl 3 upgrade is on the to do list.

@hypersomniac No problem! I’ll probably just need to set up Ubuntu or find a PC. Thanks for all of your work on this project.

Animated material values seem to be broken. Not sure if they ever worked, but it limits the utility for the branch to be used for real-time animation renders.

@m9105826 : I know :confused: that’s not in my goal. I think we would have to make driven/ animated properties updated with uniform variable in GLSL but that’s not the scope of this branch at all.

@TheNinja : fortunately there’s a fix but I’m away from my computer for a week at least so I wont be able to update

very important information

same problem here !

Hi Hypersomniac, amazing work. I have a question for you, Are you planning to have emission material like the ones available in some real-time engines?:

Also are you planning to have some post-processing filters like Vignetting, GI multiplier, Lens Flares, Motion Blur…?

Attachments


Hypersomniac, i have a quiestion aboud baked textures. I have baked diffuse in cycles, and want to quick reflections on it. If i use standart glossy+diffuse material diffuse try to raytrace. I dont need it, cause i have BAKED diffuse :slight_smile: If i try emission shader, it induce a looong time to render on big models (4-5M poly), diffuse does not have this problem. But diffuse shader is unsuitable for baked diffuse texture. Is it way to simple NOT RAYTRACE showing diffuse baked texture by shader?? (like background shader in world settings)

Vignetting is easy post process i won’t bother doing it for viewport (Ok maybe i’ll try).
GI multiplier I don’t know what exactly you mean by this.
Lens Flares not planned.
Motion Blur is doable.

Also the effect you refer in you picture is bloom / glare effect. I want to implement that but I need to render the post process buffer in HDR first.

@RZ3X : About that i hoped that the emission is what you needed but i don’t see why it’s long to render. About the raytrace thing I don’t know what you are talking about. When you are talking about long render time what exactly it is? Viewport renders in fraction of seconds or seconds for large opengl preview. Maybe your baked texture is so big it slows everything.

Maybe… I try to use one texture atlas 16384x16384 px :slight_smile: Titan Z (768 bit), 32 Gb, core i7 4790k. Are u reccommend smaller sizes?

PS: SamCameron suggest an interesting idea. Bloom glare effect in viewport Like in octan, it makes the blender out of competition !

16384px² oh my goodness you must have a huge level to have a high resolution like this. remember it’s 16 4K maps. you should definitely try smaller textures.

Are you using splat mapping/tileable textures? that sounds HUGE for a atlas.

Hi hypersomniac, about the GI multiplier… that’s an option in some real-time engines when you want to crank up the GI look, let’s say you have some objects “tinting” others but you are not happy enough, then you can use the multiplier to increase the effect much more. I know this is a little bit against PBR but sometimes is good to have creative freedom to achieve the look you’re planning to.

One style that comes to my mind where they crank up the GI way higher than the realistic formulas is Mirror’s edge:

http://img.photobucket.com/albums/v123/Tie23/Games/MirrorsEdge2009-01-1923-50-46-57.jpg

SamCameron: just bake the indirect diffuse lighting and multiply the lightmap intensity. The indirect lighting is not calculated in the cycles viewport. The only way you can see it is to bake it to a texture.

more and more, I wonder why something like the cycles armory engine GLSL cant be used in the viewport,

Right now you hit p, and it converts all the cycles shaders to realtime gfx, with differed rendering screen space reflections, mesh lamps, single bounce global illumination…

why can’t that code be ported? is it not accurate enough?

So let me enlighten you.

What lubos is doing with the Armory Engine is a very flexible game engine. He has total control on how to translate the shading nodes and even setup rendering pipeline. The engine is external to blender and have little dependency.

On the other hand, I do a preview viewport. The code that draws meshes in the viewport is the same I use to draw meshes with pbr.
My goal is to give an pseudo accurate preview of what the render will look like. And my strech goal be able to have good visual quality result for the opengl render (where having 2sec / frame is not a problem).

Our goals differ a bit : game engine strive for efficiency first, I strive for quality first. In the end it’s not one or the other. Both have to be done.

The viewport is render in forward shading I can’t simply change that easily. I won’t go into detail (look up the bf-viewport mailing list archive i discussed that in the past) but doing so would be very difficult and it wont be possible to do a lot of thing. For instance doing something like the carbon fiber shader I did in the last video (anisotropic shader + glossy coat) is impossible for now in unreal 4 (well you can fake it with a normal map but won’t get the same result).

So deferred shading is a bit limiting.

About why it can’t be just ported. Well as I said i’m using the core rendering pipeline of blender (forward shading) so numbers of restrictions apply to me. But I did got the first SSR implementation from lubos’ github. It did help in figuring how to do it and in the end use the 2D raymarching (Last time I checked this algorithm was commented in his code).

Also I prefer to extend the current material preview.

But be sure it help to have his code opened. It’s just not as simple to just port everything he does. we would have to change maybe half the blender drawing code to do that.