Search Unity

Antonov Suit - Physically Based Shader - First Release

Discussion in 'Works In Progress - Archive' started by Charkes, Apr 24, 2013.

  1. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Hello,

    This what I've been working on my free time, it's not finished but I'm starting to ride in circle ( started PBR research one year ago pfiou ) so I decided to release a first version.

    This is the Antonov Suit



    It consist of three main component the Dielectric, the Metallic and the Metallic and Dielectric shader.

    Dielectric shader is the non condictor material ( stone, brick, plastic etc ).

    Metallic shader is the conductor material ( any kind of metal ).

    Metallic and Dielectric shader have both properties.

    Current Features :
    • Forward only
    • Lightmap (Single, Dual and Directionnal)
    • PBR rendering
    • Specular Workflow
    • Metallic/Metalness Workflow
    • Pre integrated skin shader ( Eric Penner method )
    • Probe capture tool
    • RGBM Encoding for cubemap ( Free and Pro )
    • GPU based cubemap convolution using importance sampling.
    • Box and sphere projection for cubemap with attenuation.
    • Screen space reflection
    • Quixel Suit ( Profile included )
    Currently Working On :
    • Planar Reflection
    Next Features :
    • Billboard/Image reflection plane and its tool to capture reflection images.
    • Screen space subsurface scattering ( Jimenez method )
    • Full deferred rendering
    • Wetness/Rain effect
    • Glass shader
    • Terrain and foliage shader
    Web Demo :

    CMARK_41 : https://dl.dropboxusercontent.com/u/1812933/AntonovSuit/CMARK_41/CMARK_41.html

    Screen Space Subsurface Scattering : https://dl.dropboxusercontent.com/u/1812933/AntonovSuit/InfiniteScan/InfiniteScan.html

    GitHub : https://github.com/cCharkes/AntonovSuit

    Unity Packages : https://dl.dropboxusercontent.com/u/1812933/AntonovSuit/AntonovSuit_v0.055.unitypackage

    Unity Sample Packages :

    Io : https://dl.dropboxusercontent.com/u/1812933/AntonovSuit/AntonovSuit_Io_SAMPLES.unitypackage


    v0.055

    Added new specular occlusion

    Fixed issue with value being reset with probe tool

    Preview probe only happend OnDrawGizmosSelected()

    Changed probe object assignement à la Lux style
    Changed sky probe object remove behavior, you don't have to remove everything now

    Refactored AntonovSuitProbeEditor code

    Removed gizmo rotation as it was not working properly, use sphere projection if box projection can not fit
    Removed attenuation selection, now it is always on
    Removed probe tool item from top Unity menu

    Renamed AntonovSuitSky to AntonovSuitManager ( no more confusion with Marmoset Sky )
    Renmade Lookup Generator to Antonov Suit Lookup Generator

    Updated Documentations

    v0.053

    Fixed NullReferenceException Gameobject[] for sky and probe tool
    Fixed speed issue while using more than 8 probes
    Fixed convolution issue while using fog

    v0.052

    Added "Remove Probe" to the sky tool

    Changed sky editor code to add numbers in the name

    v0.051

    Added dual lightmaps support, use #define DUALLIGHTMAP_ON to enable it, see _ReadMe
    Added sky tool, it is no more needed to feed shaders with LUT textures manually, spawn a probe from it and you can set ambient light with it and apply general diffuse and specular cubemap
    Added metallic option to the SSR

    Fixed single, directionnal lightmap issues
    Fixed in error in G-Buffer for SSR

    Changed probe script code
    Changed SSR ray march code
    Changed SSR roughness behavior
    Changed diffuse convolution to be more powerfull (I may revert to the old one)

    Removed occlusion from direct diffuse lighting

    v0.050

    Fixed wrong shader parameter name
    Fixed illum shader

    v0.045, 046, 047, 048, 049

    Added documentations
    Added Quixel Suit profile
    Added SSR

    Fixed Cutoff not working in DX11
    Fixed casting shadows with self-illum shaders
    Fixed SSR for DX9
    Fixed Skin point/spot light red gradient

    Changed convolution code
    Changed Lod calculation for convolution

    v0.044

    fixed errors with build

    v0.043

    added exposure control for diffuse and specular cubemap ( request )
    added preview sphere for cubemap
    added edge scale bleeding for smoothedge ( DX9 )
    added three type of convolution for diffuse cubemap
    added view dependent roughness ( see GDC FOX Engine )
    added edge fix for dx9 in shader ( as a test )

    fixed black edge in the lookup texture generator
    fixed G_smith model in the lookup texture generator

    changed samples amount for a quality setting for convolution
    changed cubemap size for a fixed size choice
    changed exponent math for GGX cubemap to match more the importance sampling reference
    changed skybox convolution projection
    changed smooth edge to wokr only on DX9 as DX11 use its own edge fix
    changed fresnel for cubemap with lookup texture ( D_GGX and G_Smith used as default now )

    removed #pragma_multi_compil for convolution type and moved to different shader instead

    improved convolution speed ( a bit )

    v0.042

    added specular workflow
    added toksvig factor parameter in shader

    changed sphere projection code ( Nvidia approach )
    changed material path for specular and mettalic workflow.

    fixed occlusion on direct specular

    removed skin atten shadows from point and spot light in the Pre Integrated Skin

    v0.041

    added sqrt(roughness); roughness* roughness; which gives better reponse in low range. The Order 1886

    added Rea skybox shader
    added logo to the probe tool
    added "Bake With IBL" to allow IBL capture

    refactored probe tool GUI

    fixed DX11 flip upside down capture
    fixed Z Up vetor in the importance sampling shader
    fixed mip map lod math

    changed "Reflection" and "Irradiance" shader name to "Hidden/Antonov Suit/Radiance" and to "Hidden/Antonov Suit/Irradiance"

    v0.04

    added box and sphere projection
    added attenuation control for box and sphere projection ( experimental )
    added burley diffuse model ( use ANTONOV_DIFFUSE_BURLEY instead of ANTONOV_DIFFUSE_LAMBERT )

    changed fresnel for Skin PreIntegrated shader

    removed fresnel lut for a math fresnel ( as a test )

    fixed serialized enum being reset when changing values in the probe tool

    v0.036

    fixed "unexpected token '&&'"

    v0.035

    refactored some lines of code

    changed exponent calculation for convolution
    changed lightmap attenuation for cubemap to match dielectric and metallic behavior

    fixed sharp transition in the cubemap mip map
    fixed problem with point and spot light attenuation
    fixed a division by PI in the skin diffuse color

    v0.03

    added GPU based convolution for cubemap using importance sampling
    added GGX and Blinn-Phong specular model in the probe tool
    added toksvigAA ( as a TEST )

    v0.02

    added single and directionnal lightmap
    added importance sample amount control to probe tool

    changed RGBM encoding for unity free

    fixed issue with uint
    fixed issue with build : "Assets/Antonov Suit/Scripts/AntonovSuitProbe.cs(151,17): error CS0103: The name `EditorApplication' does not exist in the current context"
    fixed _Illum error while making lightmap with beast

    v0.01

    Initial Version

    Thanks, if you have any questions feel free to send me an MP or mail at antonovsuit@gmail.com.

    Hi,

    I'm working on a Physicall based shader for a while now on Unity and now I think it is time to show some of my progress on it.

    At the beginning I was developping a shader for a game I'm currently making on unity but more I was going deeper into it more I was thinking of making a version for folio ( my folio :) ).


    This shader use :

    HDR Cube map and Sky encoded in RGBM using a custom app to encode them from HDR to TGA.
    Ambient Cube using HDR Cube map as source of illumination.
    A normalized Blinn-Phong as specular term.
    Mipmap for gloss reflection.

    You can try a very first version of it here : http://www.charles-greivelding.com/UNITY/IngramShow/ShowCase.html

    Use the mouse to rotate the camera around and the mouse wheel for zooming in and out.

    Post Process are from Unity.

    Probes are from : http://www.hdrlabs.com/sibl/archive.html


    Some usefull reads :

    RGBM Encoding : http://graphicrants.blogspot.fr/2009/04/rgbm-color-encoding.html

    Jason Mitchell, Gary McTaggart and Chris Green,"Shading in Valve’s Source Engine," SIGGRAPH Course on Advanced Real-Time Rendering in 3D Graphics and Games, 2006. http://www.valvesoftware.com/public...Course_ShadingInValvesSourceEngine_Slides.pdf

    Gary McTaggart, "HDR in Valve’s Source Engine," SIGGRAPH Course on High-Dynamic-Range Imaging: Theory and Applications, 2006. http://www.valvesoftware.com/publications/2006/SIGGRAPH06_Course_HDRInValvesSourceEngine_Slides.pdf

    Hoffman, “Crafting Physically Motivated Shading Models for Game Development” and “Background: Physically-Based Shading” http://renderwonk.com/publications/s2010-shading-course/

    Lazarov, “Physically Based Lighting in Call of Duty: Black Ops” http://advances.realtimerendering.com/s2011/Lazarov-Physically-Based-Lighting-in-Black-Ops (Siggraph 2011 Advances in Real-Time Rendering Course).pptx
     
    Last edited: Nov 22, 2014
    Lex4art and Botanika like this.
  2. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    This is looking impressive... :)
     
  3. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Last edited: Apr 26, 2013
  4. DivideByZero

    DivideByZero

    Joined:
    Feb 18, 2013
    Posts:
    11
    Wow, very impressive. Is this going to be on the asset store?
     
  5. frankrs

    frankrs

    Joined:
    Aug 29, 2009
    Posts:
    300
    thats awesome
     
  6. mrmadprofessor

    mrmadprofessor

    Joined:
    May 22, 2012
    Posts:
    53
    What kind of maps are you using? The examples I have seen seem to use, Albedo, NormalMap, Roughness, Substance and Ambient Occlusion.

    I know a teacher at my former school made a PBL shader that uses these maps, his cgfx shader is located here if you want to compare.
    http://www.kostas.se/?p=30
     
  7. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    thanks guys !

    mrmadprofessor : I'm using a Diffuse Map ( sRGB ), a Specular Map ( more like reflectance value, sRGB ), a Gloss map ( linear space ), an AO map ( sRGB ) and a Normal Map ( linear aswell ).

    I've seen this stuff yes this is the same approach I'm using in fact for the basics wich aslo covered by Hoffman.

    Edit : You can see similar shader in FarCry 3 aswell.

    DivideByZero : At the moment it is for my own uses but I think I will do a some sort of tool allowing quick import of models and textures ( will need carefully calibrated since it is not the same workflow as most of the games today ) and allowing to capture renders for folio presentations with less things to tweaks. But this mean for me a lot of GUI stuff to do wich I'm not good at the moment :).
     
    Last edited: Apr 26, 2013
  8. mrmadprofessor

    mrmadprofessor

    Joined:
    May 22, 2012
    Posts:
    53
    Awesome, I will absolutely be following this thread!
     
  9. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    It's a pleasure to read that :).
     
  10. sickle

    sickle

    Joined:
    Mar 14, 2013
    Posts:
    8
    U r amazing bro
     
  11. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Thanks !

    Ok so it's bean a long time since my last update !

    So now my shader is ok and ready to use and now I'm focusing on Skin.

    It is based on a shader I did on UDK and posted on polycount ( http://www.polycount.com/forum/showthread.php?t=98253 ).

    The SSS part, based on Eric Penner's work use a lookup texture, see http://www.ericpenner.net/portfolio
    Ambient use also an experimental SSS effect.

    Pictures :










    Infinite, 3D Head Scan by Lee Perry-Smith : http://www.ir-ltd.net/infinite-3d-head-scan-released
     
    Last edited: May 8, 2013
  12. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Great update!
    I'll keep my eyes on this. :)
     
  13. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Thanks !
     
  14. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Very very very cool...
     
  15. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Great work!
     
  16. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Cool :)
    Can you show web player demo?
     
  17. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
  18. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Super awesome... also keep in mind that this should work correctly with Beast and light probes... will this be only on Unity 4?
     
  19. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109

    Attached Files:

    Last edited: May 10, 2013
  20. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Thank you guys for the support !

    Quick update :

    I've added a basic ui allowing to control the exposure.
    Alos changed my Lambert shading and made it energy conservating.

    Neptune_Imaging : I will add full Beast and Lightprobe support in the futur and yes it will be unity 4 only ( due to the use of some feature ) but If I find a way to make it full work on 3.5 I will.

    Jes28 : https://dl.dropboxusercontent.com/u/1812933/Unity/ShowCase/ShowCase.html :)

    The demo is a bit heavy at the moment.
     
  21. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    very nice improvements!
     
  22. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Last edited: May 16, 2013
  23. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Great update as usual!!! :)

    If you need a beta tester for your tool I am here, just PM me!
    Help you will be a great pleasure. :)

    Cheers,
    Kenshin
     
  24. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Kenshin : When I will need testers I'll let you know :) ! Thanks !

    Little update :

    I've added more parameters to the ui that will allow you to see how it works.

    Ingram only at the moment : https://dl.dropboxusercontent.com/u/1812933/Unity/ShowCase/ShowCase.html

    Edit : For some reason after the build the smooth edge feature is not kept so seams appears in the cube map.
     
    Last edited: May 20, 2013
  25. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    This is looking awesome! Congrats! One thing I don't really understand about IBL is how it can be incorporated into a dynamic lighting setup... such as a scene being lit by sunlight which changes over the course of the day... to my mind, lighting cubemaps/spheremaps would have to be dynamically generated. while this is certainly possible, it isn't very forgiving on performance. Any ideas regarding this?
     
  26. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    This is awesome, is this roaming to Asset store? I would love to use this beauty.
     
  27. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    chingwa :

    Image Based Lighting as I'm doing it, can't be used for a dynamic Time Of Day setup and that's why it is called IBL.
    All images ( cubemap and sky map ) are pre generated ( using cubemapgen, hdrShop and RenderMonkey for me ).
    The only dynamic part is my sun light ( not so dynamic because I can't move it :) ).

    But the shader I did can be added to a dynamic lighting setup, I'm using it for my game, I just use cubemaps ( encoded to RGBM for doing hdr ) generated in my levels instead of using hdr image of real life ( RGBM ).

    If I wanted to do some ToD setup I will captured my cubemaps at key points of ToD, then doing the ambient irradiance convolution and the specular convolution. After all that I could use them in my ToD.
    I will just need to blend all those cubemaps ( ambient and indirect specular ) according to the ToD.
    This will make lot of cubemaps ( 128*128*128 A8R8G8B8 ) but would work I guess.

    Cryengine 3 I think this kind of approach, also the Fox Engine and maybe FarCry 3.

    janpec : Definetly yes !


    So...Updates !

    I've added some post effects like Pseudo Lens Flare ( from John Chapma ) and Film Grain ( main idea and concept from Martins Upitis ) and it use the skin shader.

    I also reworked the ambient SSS term.

    https://dl.dropboxusercontent.com/u/1812933/Unity/IBLSkin/IBLSkin.html

    Controls are :

    To rotate the camera : Ctrl Left + Mouse Left
    To move the camera : Ctrl Left + Mouse Middle
    To zoom in and out : Alt Left + Mouse Left

    References :

    http://john-chapman-graphics.blogspot.co.uk/2013/02/pseudo-lens-flare.html

    http://devlog-martinsh.blogspot.fr/2013/05/image-imperfections-and-film-grain-post.html

    Infinite, 3D Head Scan by Lee Perry-Smith : http://www.ir-ltd.net/infinite-3d-head-scan-released

    HDR images from : http://www.hdrlabs.com/sibl/archive.html

    Enjoy and Thank you for the support !
     
    Last edited: May 30, 2013
  28. uuuaaa

    uuuaaa

    Joined:
    Jun 14, 2013
    Posts:
    1
    This is cool shader! :razz:

    Is it this asset?
    https://www.assetstore.unity3d.com/#/content/8257

    Does this asset contain IBLSkinShader?

    I want to purchase it if IBLSkinShader is packed.

    When there is the sample scene of IBLSkinShader, I am thankful. :grin:
     
  29. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Hey !

    No sorry this is not that one !
    Mine isn't released yet, I still need to clean some things before submit to the assets store.

    thank you !
     
  30. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    New test :

    With SSAO, SSIL and box projected cubemap.
     
  31. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    OMG can you make a deploy for pc?
    I would like to check the framerate.
     
  32. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
  33. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Lighting part of scene Looks amaizing, but now I have only 2 fps on my machine :) I have played BattleField 3 on it :)
     
  34. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Ye framerate is a bit disappointing, on my laptop (i7 - GT 540M) I have 10-15 fps (by eye) .
     
  35. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    I'm not surprised by that, both SSAO and SSIL are at a very wip stage and absolutely not optimised.
     
  36. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Looks interesting.
    Care to build a Mac version? Would like to try it out.
     
  37. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Cool!
     
  38. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    You should add some type of theshold adaptation for the shadow areas.

    I kills my pc if run at 1080 to pquality. Something lik 5-10fps or so.
     
  39. staticthefox

    staticthefox

    Joined:
    Feb 4, 2012
    Posts:
    14
  40. TWaanders

    TWaanders

    Joined:
    Mar 27, 2013
    Posts:
    46
    This looks fantastic! Would love to test it in one of my scenes ;) Do you have any ETA of an asset store release?
     
  41. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Lot of time as passed since my last update !

    I'm sorry about that but I've been quit a lot busy with my work. I never stop to work on this but since my progress was minor I didn't post anything about it.

    So I almost restart everything because while looking at it I realized I could make much better code now !

    It started with my specular term which now is based on the EPIC's and 1886 papers, so I'm using the GGX specular now.

    GGX is the most beautifull specular term I ever seen, it's perfect for metal and even other surfaces.

    Some code :

    Code (csharp):
    1. float sqr(float x)
    2. {
    3. return x*x;
    4. }
    5.  
    6. float GGX_V1(in float m2, in float nDotX)
    7. {
    8.     return 1.0f / (nDotX + sqrt(m2 + (1 - m2) * nDotX * nDotX));
    9. }
    10.  
    11. float GGX_Specular(float3 N, float3 H, float3 L, float3 E, float m )
    12. {
    13.     float NdotV = saturate( dot( N, E ) );
    14.     float NdotH = saturate( dot( N, H ) );
    15.     float NdotL = saturate( dot( N, L ) );
    16.     float LdotH = saturate( dot( L, H ) );
    17.  
    18.     float roughness = sqr(m);
    19.  
    20.     // David Neubelt and Matt Pettineo, Ready at Dawn Studios, "Crafting a Next-Gen Material Pipeline for The Order: 1886", 2013
    21.     float D_ggx = roughness / (PI * sqr(sqr(NdotH) * (roughness - 1) + 1));
    22.  
    23.  
    24.          // G come from BRDF tool If I'm correct
    25.     // Bruce Walter, Stephen R. Marschner, Hongsong Li, and Kenneth E. Torrance. Microfacet models forrefraction through rough surfaces. In Proceedings of the 18th Eurographics conference on RenderingTechniques, EGSR'07
    26.     float G_L = GGX_V1(roughness, NdotL);
    27.     float G_V = GGX_V1(roughness, NdotV);
    28.     float G = G_L * G_V;
    29.        
    30.     return D_ggx * G;
    31. }
    I've directly converted from formula those code and compared them with BRDF tool from dysney to make sure that they were the same and checked a potential mistake I could have made but I could have missed something.

    Here the direct lighting part from my surface shader :

    Code (csharp):
    1. inline half4 LightingAntonovDirect( AntonovOutput s, half3 lightDir, half3 viewDir, half atten )
    2. {
    3.     half4 frag = half4(0.0,0.0,0.0,s.Alpha);
    4.    
    5.         half3 L = normalize(lightDir);
    6.         half3 N = s.Normal; // Normalized in the surf
    7.  
    8.         half3 diffTerm = saturate(dot(N,L));
    9.         half3 diff = diffTerm * s.Albedo.rgb;
    10.         frag.rgb = diff * _LightColor0.rgb * (atten*2);
    11.  
    12.         half3 H = normalize(viewDir+L);
    13.         half3 E = normalize(viewDir);
    14.    
    15.         float NdotL = saturate( dot( N, L ) );
    16.         float LdotH = saturate( dot( L, H ) );
    17.  
    18.                 //s.Specular.x is the roughness and s.Specular.y is my occlusion
    19.  
    20.         float roughnessAA = Toksvig(N,s.Specular.x);
    21.  
    22.                 // Toskvig factor shouldn't be applied like this but until I fixed the problem I'm doing it that way
    23.         float3 directSpecular = GGX_Specular(N,H,L,E,roughnessAA*s.Specular.x)*_SpecColor;
    24.  
    25.                 // Spherical gaussian from Lagarde
    26.         float3 F = SG_Fresnel(s.SpecularRGB,LdotH);
    27.  
    28.         float3 spec = directSpecular*F*NdotL*s.Specular.y;
    29.        
    30.         spec *= _LightColor0.rgb;
    31.         frag.rgb += spec*(atten*2);
    32.  
    33.     return frag;
    34. }
    That's it for my direct specular part.

    Now for indirect specular I've decided to stop doing pre filtered cubemap with gaussian convolution. I want to get away from any pre computation as much as possible so now I'm doing Importance Sampling.

    The advantage of this is that I can match any specular model ( like my GGX ) on a cubemap !



    As you can see both direct and indirect specular match perfectly !

    The problem with Importance Sampling is it can be expensive, to prevent using 1024 samples NVIDIA propose to use the mip map ( regular mip map nothing else ) to allow less samples ( 16 in my case ) also EPIC provide an other and further optimisation by splitting the calulation. Basically they pre compute one part to limit the cost.

    With 16 to 40 samples you can achieve pretty cool result but still when very close to an object there's a huge impact so I'm thinking that maybe I could use compute shader but I don't have any knowledge on that subject.

    An other major thing I'm working on is Screen Space Raytraced Reflection.





    As you can see it reflect quit well and I'm able to simulate different roughness with jitter ( jitter represant random coord/directions of ray ) and spherical coord plus this is based on the GGX term so everything match ( well not completely because my SSRR still get too powerfull when it is rough ).

    All specular texture ( with roughness in the alpha ) is rendered into an RGBA32 RenderTexture ( like in deferred ). That way I can interact per material with my SSRR.

    Currently the SSRR and cubemap are just blend on top of each other.

    I'm not sure how I should blend them. I've tried to separate them completely but I got weird result as SSRR should reflect what the cubemap is reflecting if they are separated I get too much dark area.

    But I tested this with infinite cubemap projection maybe with parallax correction it won't look that weird.

    That's it for now !

    Resources :

    http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html

    http://blog.selfshadow.com/publications/s2013-shading-course/

    http://www.gamedev.net/blog/1323/entry-2254101-real-time-local-reflections/

    GPU PRO 3 CryEngine 3 Three Years Of Work in Review

    Secrets of CryENGINE 3 Graphics Technology

    http://forum.unity3d.com/threads/205549-Screen-Space-Local-Reflection

    Killzone: Shadow Fall Demo Postmortem
     

    Attached Files:

    Last edited: Feb 8, 2014
  42. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    Would I be correct in thinking rather than using a static image, you could use a rentertexture cubemap instead and use that for reflections? Or is that already the point? :L

    Looks great.
     
  43. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Why there's a black outline in the sphere? and the last screenshot looks great.
    Btw
    Code (csharp):
    1.  
    2. float roughnessAA = Toksvig(N,s.Specular.x);
    3.  
    what is Toksvig??
     
  44. WGermany

    WGermany

    Joined:
    Jun 27, 2013
    Posts:
    78
    I think its caused by the importance sampling. I am considering doing the same. Like UE4 did in their recent article.

    Toksvig, Michael Toksvig. Theres an article here I believe about specular lighting, aliasing etc.

    http://blog.selfshadow.com/2011/07/22/specular-showdown/
     
  45. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Fishman92 :

    It's not the point because real time caputre is still too expensive, imagine mutliple cubemap probe capturing at the same time in one scene, it's too much. For one I think that might work.

    The idea is to capture the cubemap in RGBM ( for getting HDR ) then thanks to importance sampling I can use them directly and no need to do expensive convolution and I can match any specular model I want with importance sampling. Here it's GGX but it could be phong, blinn-phong, cook torrance or even a cloth specular model.

    Also in order to work properly you need to use edge fixing of the cubemap, I'm not sure if it is possible for a real time capture. I'll test though.

    Also UE4 don't do real time cubemap capture ( as far as I know ) it's save to disk and I don't talk about voxel cone tracing. But for this they use compute shader and that make the whole process super fast !

    rea : Yeah it's the importance sampling doing that, as it is based on GGX it act like the specular model but it's a bit strong even for me.

    Toksvig or Toksvig Factor like WGermany says it's a way of getting rid of the aliasing on the specular lighting caused by the normal mip maps.

    The article that WGermany posted explain it very well.


    Thanks all
     
    Last edited: Feb 9, 2014
  46. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    I've made a little web demo to let you test the SSRR with experimental blurring.

    Currently it runs fine on my computer ( web demo is 720p and I use 1080p on build ) but it's too slow currently I think to be used on a game project.

    Hit F to turn on the flashlight !

    Demo : https://dl.dropboxusercontent.com/u/1812933/Unity/SSRR 0.1/SSRR 0.1.html

    Interrested to hear some crits about it.

    My config :

    Win 7 64bits
    Core I7-2600k 3.40ghz 3.70ghz
    16 go DDR3
    GTX 580
     
    Last edited: Feb 19, 2014
  47. Deleted User

    Deleted User

    Guest

  48. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    Thanks!

    How was the performance ?
     
  49. Deleted User

    Deleted User

    Guest

    Last edited by a moderator: Feb 19, 2014
  50. WGermany

    WGermany

    Joined:
    Jun 27, 2013
    Posts:
    78
    Very good indeed :)

    I don't have fraps at the moment. I just recently did a fresh install of Windows 8.1 on my SSD.

    It felt as though I was getting a smooth 60fps.

    You seem to have a great deal of knowledge and I think we both are very efficient in making Unity look good. Please PM I think we should talk about maybe working together on some things? Its hard to work alone :p I will also send you my Skype :)

    Specs:
    i5 2400
    8GB RAM
    GTX 660
    Win8.1