Community Coding: The New vvvv Standard Shader

hi everyone,
when it comes to writing a standard shader, i personally think of having just one single shader as a true Phong replacement. Of course this means no shadows, no fancy post fx, just a pure implementation of a physically based BRDF (in this case with a GGX normal distribution function, see patches below).

The main differences to the Phong implementation:

  • PBR doesn’t really make sense, if you only have one light source (unless you light your objects from environment maps). So we have ONE buffer for all different light types, but instead of introducing a new DX11 buffer, i decided to use the already existing DynamicBuffer(SpotLights) for all lights. This could be a little misleading, but its layout fits our needs in this case.
  • There is an option to output the result in gamma or in linear color space for further post fx.
  • I consider normal mapping as very important in a PBR shader, since it might be tightly bound to roughness in many cases.
  • For anisotropic specular reflections (e.g. on brushed metals), you have to tell the shader, whether your geometry has tangents and bitangents. This also might be a good example for the usage of preprocessor directives.
  • For the diffuse BRDF you can switch between Lambert and a modified version of the Disney diffuse BRDF. This modification is adopted from the already mentioned “Frostbite”-paper. (Woei posted a link above).

There are still a few comments in the patches, which i consider as important for people who are new to PBR.

Thats’s just my two cents! Anything to add, or even leave out?

GGX_PunctualLights.7z (71.5 KB)

4 Likes

HI FLux, thanks for your efforts,

However, your GGX INstance hader report the following errors:

E 69 invalid register specification, expected ‘b’ binding X3530 GGX_simple_instanced.fx C:\Users\Guest\Documents\GGX_PunctualLights\dx11

E 135 There was an error compiling expression -1 GGX_simple_instanced.fx C:\Users\Guest\Documents\GGX_PunctualLights\dx11

I changed the buffer registers from “c*” to “b*”. GPUs may elicit different behaviour.

Ah, yes…thank you for pointing this out.
So, here’s an updated version.

GGX_PunctualLights.7z (71.5 KB)

5 Likes

This looks nice, very clean and easy setup.
Thank you.

this only renders black spheres on my card… anything i can try to debug?

very nice, works for me.

what card? @tonfilm

Nvidia GTX970 M, should have all powers needed. how did you start it and with which vvvversion?

b35.8 and opening the first of the help patches works for me.
Didn’t check the other ones.

same as @tonfilm here
b35.8 gtx970m or gtx 780ti //windows 8.1

same here, all black, Quadro M4000

Wow nice @flux, works perfectly here, Geforce 1080TI, have you guys updated to the latest Nvidia driver? sometimes that helps…

Great shader! Works fine on my 1060.

All fine here on 1080 and 1080Ti !

ok, i just tested it on 2 different setups, both with b35.8x64 and dx11-1.1 pack:

  1. gtx 980m, win 8.1
  2. gtx 970m, win 10

…and everything works fine on both. The only thing i can think of is, that anything gets messed up with the constant registers, since i use the SIZEOF semantic to get the lightbuffer size. In the patches below i switched to the GetDimensions function. Maybe that helps… otherwise i can’t reproduce this issue right now.

One more thing: I also just noticed, that i can’t load any geometry with the 32-bit vvvversion. GeometryFile (Dx11.Geometry Assimp) stays red. But this might be an issue with the Dx11 pack…

GGX_PunctualLights_fix.zip (107.0 KB)

7 Likes

the new file works for me, thanks!

Glad to hear that ;)

great stuff flux!

works perfectly here on nVidia Titan Black and on my dell xps laptop (nVidia GeForce GTX 1050)

i am not getting a frame more then 60, mainloop set to 120, is this by design? I am running on 1060

@StiX:
Just turn VSync off in the Renderer settings (via the Inspektor).