Wednesday, January 4, 2017

Unity 5 shader for Substance Painter

Here is SP viewport shader that emulates Unity 5 BRDF:

Download from Google disk

It's not 100% match unfortunately, but close enough.
It is how GGX-based BRDF  should work, not how it works in Unity.
---------------------------------------------------------------------
If you are interested in details, please read below. 




Here are some comparison pictures:



So, what's wrong?



- Unity using Gamma space incorrect lighting by default. 

COME ON Unity! How could that be even possible in 2016!

actually I spent some time figuring that out, this is why I am angry:)
Please change your color space to linear at Edit -> Project Settings -> Player -> Other Settings

and read this article if u are not too lazy: LinearRendering-LinearOrGammaWorkflow

If you still want to use gamma space, or you forced to, for any reason, there is an option to switch shader from linear space by disabling this checkbox:

- Unity Indirect BRDF part has an error in it, despite the fact it is an approximation. 


Dominant reflection vector(you may consider it as an average of all  R vectors for that point of view) of the glossy surfaces tends to tilt closer to surface normal, and with roughness=1 it becomes normal , and distribution becomes uniform, lambertian. However in Unity, environment map always samples from reflection vector, and that leads to incorrect reflections and light leaking.

























I really hope unity will fix than in the next major update.

4 comments:

  1. Have you filed bugs for either of these issues?
    https://unity3d.com/unity/qa/bug-reporting

    Have they ever been resolved?

    ReplyDelete
  2. Hi! I am pretty sure that they are aware about that, Unity has acquired a couple of really talented computer scientists during last years, for example Sebastien Lagarde who fixed exactly the same issue for Frostbite engine. Though I don't know the reason why they haven't fixed that yet.

    ReplyDelete
  3. When you click on BruteForce all begins to lag.

    ReplyDelete
  4. once I download the shader and save it in the shelf, how do I apply it?

    Regards!

    ReplyDelete