Home Unity

Physically Based Lighting

hello after i saw some tech demoes of upcoming nextgen games and especially the order 1886 and deepdown i got inspired to make a phys based lighting shader, heres some screens:

[IMG][/img]m9t6k0.png
[IMG][/img]e9tcpg.png
[IMG][/img]25zs54x.png

diffuse ibl:
2090f2v.png

the shader has only two parameters..the rougness and the metalness of the material,u can assign a rougness texture and an albedotexture plus i was reading the order 1886 paper and implemented some material layers...so each material has a mask just like in the paper, the lighting model is a standart coock-torrance with some modified functions(like ggx and schlick) pretty standart stuff that ull see in nextgen game engines if the papers are correct...
ihave some problems though,if somebody here can help me integrate normal mapping into the shader it would be great,the problem is when i apply a normal map to my material the ibl cubemap lookup goes wrong because it needs a world normal,so i need a way to convert a tangent normal to world space,how? thanks!

Replies

  • Drew++
    Options
    Offline / Send Message
    Drew++ polycounter lvl 14
    Good start.... Although, it's hard to tell how well it looks with all of the noise and chromatic aberration going on.
  • Farfarer
    Options
    Offline / Send Message
    The instructions to get world normal in a surface Shaffer are in the documentation.

    Input struct needs...

    float3 workdNormal;
    INTERNAL_DATA

    Then in the surf function...

    float3 wNormal = WorldNormalVector(IN, o.Normal);
  • SteppeHawk
    Options
    Offline / Send Message
    ihave already done that but when i assign the normal map to o.normal the worldnormal becomes tangent automatically
  • Farfarer
    Options
    Offline / Send Message
    I suspect you're not doing it right then. Can you post your code up?
  • OverlordNeko
    Options
    Offline / Send Message
    on the topic of pbl shaders in unity, how would one go about implementing HDR cubemap support?
  • aieth
    Options
    Offline / Send Message
    aieth polycounter lvl 4
    on the topic of pbl shaders in unity, how would one go about implementing HDR cubemap support?

    Unity lacks a proper way to import HDR images. It doesnt even suppott real hdr 16 or 32 byte images. Existing assets in Unity usually work around this with rgbm encoding. Ive got a physically based shader editor extension doing that on the asset store called Jove. I do believe marmoset skyshop is the only asset that can actually import hdr images though
  • OverlordNeko
    Options
    Offline / Send Message
    aieth wrote: »
    Unity lacks a proper way to import HDR images. It doesnt even suppott real hdr 16 or 32 byte images. Existing assets in Unity usually work around this with rgbm encoding. Ive got a physically based shader editor extension doing that on the asset store called Jove. I do believe marmoset skyshop is the only asset that can actually import hdr images though

    Ok, I guess I'll try doing it with RGBM.

    How about importing prefiltered mip-maps, unity doesn't seem to support importing custom mip map levels?
  • aieth
    Options
    Offline / Send Message
    aieth polycounter lvl 4
    Ok, I guess I'll try doing it with RGBM.

    How about importing prefiltered mip-maps, unity doesn't seem to support importing custom mip map levels?

    No it doesn't and that was a major source of frustration. In the end I gave up on the extremely complicated workflow it meant to import mip-maps and instead wrote my own tool to filter them inside Unity. The only way I found to do it was to use like 5 different programs to export the mip levels separately and then reassemble everything inside Unity using a script. As I said, horrible workflow :poly124:
  • bugo
    Options
    Offline / Send Message
    bugo polycounter lvl 17
    Can I see screenshots without the chromatic aberration and the noise please? ;)
Sign In or Register to comment.