Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Filmic Tonemapping DELUXE - Now with Eye Adaptation (High Quality)

Discussion in 'Assets and Asset Store' started by G-Mika, Apr 2, 2015.

  1. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    Filmic Tonemapping DELUXE
    --->Asset Store Link<---

    Overview
    In my quest to create a full lighting post process pipeline for Unity I developed a highly customizable Filmic Tonemapping effect to fix the "foggy" look issue of 3D Unity games developped with linear space.

    Filmic Tonemapping is used to map HDR values to visible range while making colors more interesting and sharper. Your screen is limited by the 256 possible values for each channel of each pixels (8 bits) and by remapping those values where it matters (in mid color range of your scene) you can produce a more High Definition look while creating interesting lighting contrast. It is at the core of most modern AAA video games graphics engine.

    Filmic Tonemapping is an addition to color correction. It will upgrade colors in a way that can't be achieved with most color correction tools.

    Since version 1.2, a high quality histogram based eye adaptation effect have been added. This effect is able to simulate how human eyes adapt to lighting while keeping an optimal contrast and white point.

    Filmic Tonemapping DELUXE features
    Filmic Tonemappping

    • Combinable color and luminance mapping
    • Highly Customizable Contrast (dark and bright features)
    • Map HDR values to LDR (visible range)
    • Will not desaturate dark colors
    • Works with or without HDR
    • Optimized GPU code
    Eye adaptation
    • Natural feeling
    • Keep an optimal contrast between colors
    • Optimized GPU code with two performance profiles
    • Stable exposure (no bad "flickering")
    • Real-time histogram visualization
    • Highly customizable (esposure offset/multiplier, speed up, speed down, histogram analysis settings, and more)
    Examples
    Filmic Tonemapping DELUXE is highly customizable and those examples only show one possible settings of what this tonemapper can do.

    --------------------------------------------------------------------------------------------------------------------
    This first scene is an indoor scene. You can see that with filmic tonemapping dark colors and bright colors pops out more while making mid-range value more clear and defined.
    --------------------------------------------------------------------------------------------------------------------
    This second scene is an outdoor scene. With Filmic Tonemapping DELUXE, the sunlight actually look intense making the scene more vibrant (this kind of contrast cannot be done by simply tweaking the Unity light settings).​
    --------------------------------------------------------------------------------------------------------------------
    Future Versions
    Now that the eye adaptation update is done, I plan on adding small features and refinements based on users feedbacks.
     
    Last edited: Apr 25, 2015
    Pulov, SAOTA and astrand130 like this.
  2. stalker_23b

    stalker_23b

    Joined:
    Jul 28, 2011
    Posts:
    87
    Hey, great asset, it really does his job. But, after updating to 1.1, i get just black image in build. In editor everything is OK, but in build - black screen.

    UPD: I am getting this error in build : "Graphics.Blit: material is null"
    UPD: Fixed by placing shaders into "Resources" folder. Otherwise, they are not included in build bacause nothing is referencing them.

    Also, i was having a problem in previous version - using Deluxe Tonemapping kills DOF effect in build. When tonemapping is used, dof is just not there. Again, this problem was in build version only, everything ok in editor...
     
    Last edited: Apr 2, 2015
  3. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    Hi Stalker,

    Unity for some reasons, won't automatically include all shaders in builds. If you want to make it works in builds, you need to go to "Edit/Project Settings/Graphics" and add all Filmic Tonemapping DELUXE shaders to the always included shaders. This should fix it. =)

    I also submitted an update (shoud be available soon) and with this version you won't need to do this anymore.
     
    Last edited: Apr 2, 2015
  4. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    The new version 1.1ff is now available on the store. It works in builds without any problems now. I tested with DoF and it works fine now, it was probably linked to missing shaders when generating the exe too.
     
  5. DennG

    DennG

    Joined:
    Dec 5, 2013
    Posts:
    158
    Great stuff!
    What's the progress on the Eye Adaption feature?
     
  6. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    Hi DennG,

    It's almost done. I had to find a couple of workarounds to build a multiplatform GPU based histogram with Unity and it was trickier than I thought. It's now working and I am in the optimization phase.
     
  7. DennG

    DennG

    Joined:
    Dec 5, 2013
    Posts:
    158
    Good to hear.
    Sounds complicated though... what's the estimated release?
     
  8. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    I plan on submitting the eye adaptation feature this weekend if everything goes well. It should be available on the store next week.
     
    SAOTA likes this.
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Hi I bought this. Bug: using the cog to reset values on the hdr version results in bad settings.
     
  10. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    I had no idea you could force a reset on the component since I never used this feature before (right click/reset ?) . The HDR values are set when the component is added to the camera and it won't reset to hdr default values as a consequence. I it should be fix in the next update =)
     
    Last edited: May 22, 2015
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I like it so far. I welcome the eye adaptation thing and any speed increases. A fast tone mapping is a good tone mapping! :)
     
    shkar-noori likes this.
  12. DennG

    DennG

    Joined:
    Dec 5, 2013
    Posts:
    158
    Nice! Is there a video or better a webplayer demo where we can check it out?
     
  13. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    You can watch a preview here:


    Everything is customizable (adaptation speed up/down, exposure, exposure range, and more). The Eye adaptation is a different component so that you can use it before other effects like bloom, or use it without tonemapping.

    I need to refine a couple of things and I'm done.
     
    SAOTA likes this.
  14. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    already in -to-be-bought list :D
     
  15. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    So excited for this update.
     
  16. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looks nice, bit worried that it's not combined actually due to the fact it's going to be slower in 2 passes.
     
  17. DennG

    DennG

    Joined:
    Dec 5, 2013
    Posts:
    158
    I'm not disappointed. It looks very natural.
    I'll buy it definitely.
     
  18. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    The eye adaptation update have been accepted and published =)

    I'm happy with the results and performances and I'm pretty sure there is no comparable eye adaptation algorithm done in Unity since computing a multiplatform histogram on the GPU with Unity is a big hack (with the others engines like unreal engine it requires Dx11/compute shaders. It's working with Dx9, Dx11 and OpenGL with Filmic Tonemapping DELUXE).

    With the optimization flag, on my old 2012 macbook air with intel hd 4000, it was running at about 0.3ms in-editor.

    It's currently being used with success in the game the forest.
     
    SAOTA and thempus like this.
  19. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    I am so excited to try this. I have been getting decent results with the last version, but the documentation still refers to seperate components for hdr/ non hdr setup. Took me a while to find values that worked in HDR. Hopefully the new update's eye adaptation solves this.
     
  20. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    In this new update, there is only one way to add the tonemapping component, and I added some HDR and non-HDR (LDR) presets to get started instead (you can select them inside the component presets box). It should be more intuitive that way.

    In the old version, it was really just the same component with different default values (notably, the non-hdr default values had the white point (maximum color value) set to 1 since LDR image buffers can't handle values over 1).
     
  21. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    I am interested in the non-hdr part, because generally hardware-Antialias is not available when HDR is enabled.
    Could you provide some information if the eye adpation effect makes sense without HDR and if it looks still beautiful as in the video then?
     
    Last edited: Apr 27, 2015
  22. simcovr

    simcovr

    Joined:
    Jul 3, 2012
    Posts:
    43
    Hi,

    is it possible, with your image effect, to use it in a multy screen scenario? I'm working on driving simulation and having a "master" control on the exposure is crucial in order to avoid discontinuity in the final image on other screens that are running on different exe.

    Thank you for your support
     
  23. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    It will work, but you would have to make sure that you don't put extreme values in the minimum exposure and maximum exposure because colors will saturate quickly. It still works best with HDR enabled.
     
  24. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    It should work if every .exe compute the exposure on the same image at the same time. If they all compute a different image, it won't work since the target exposure will be different for every screens.
     
  25. simcovr

    simcovr

    Joined:
    Jul 3, 2012
    Posts:
    43
    Is it possible to calculate the exposure in the "main screen" and pass the calculated exposure by network on other machines? I mean: is it possible to change manually the exposure while keep the eye adaction active?
     
  26. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  27. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    It haven't been thought that way for performance reasons. The exposure is only known on the GPU and it remains unknown to the application. You can only multiply or offset the computed exposure . The reason is that reading data from the GPU every frame is a major performance issue, since it will block the GPU from working in parallel, everything need to be kept on the GPU. The only way to make it working right know would be to compute the exposure from the very same image on every computer/.exe. It would requires minor changes to the source code.
     
  28. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Minor bug, when using dropdown list to choose between tonemaps, it sometimes applies them additively, as if one of them doesn't reset the values.
     
  29. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    This is strange, I tried to import the latest version in an empty Unity 5 project and I haven't seen that warning. Are you sure it's not something else in your project? I uploaded two versions, one for Unity 4.6, and one from Unity 5.0 . The latest version have been developed in Unity 5.0, then ported to 4.6, it shouldn't contains obsolete API.
     
  30. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    It's not a bug from the tonemapper, this is coming from the eye adaptation effect. In the game view, the image won't get updated unless you click on something, and it will gets adapted after a couple of frames (since it is 100% computed on the GPU, the effect is depends on the image update). For now, you might wan't to disable the eye adaptation effect to calibrate colors. I'll see what I can do for this in the next update.
     
  31. DivergenceOnline

    DivergenceOnline

    Joined:
    Apr 19, 2015
    Posts:
    244
    Purchased but cannot use man.
    The console gets spammed with copies of:
    NullReferenceException: Object reference not set to an instance of an object
    TonemappingDeluxeEditor.OnInspectorGUI () (at Assets/ThirdParty/Tonemapping/Editor/DeluxeTonemapperEditor.cs:35)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1094)
    UnityEditor.DockArea:OnGUI()

    Hundreds and hundreds of them.

    EDIT: And also this:

    Shader error in 'Hidden/Deluxe/EyeAdaptationBright': D3D shader assembly failed with: (25): error X5204: Read of uninitialized components(*) in r2: *r/x/0 *g/y/1 *b/z/2 *a/w/3

    Shader Assembly: ps_2_0
    dcl_2d s0
    dcl_2d s1
    def c2, 0.00000000, 0.00010000, 1.00000000, 0.99989998
    def c3, 0.50000000, 0.25000000, 0.89990234, 1.00000000
    dcl t0.xy
    texld r5, t0, s1
    mov r5.w, c2.z
    add r0.x, c0.y, -c0
    add r1.x, t0, -c0
    min r1.x, r0, r1
    rcp r0.x, r0.x
    max r1.x, r1, c2
    mul r4.x, r1, r0
    mov r4.y, c3.x
    add r1.x, -r1, c2.y
    rcp r0.x, c1.x
    cmp r1.x, r1, c2.z, c2
    mov r1.w, c3
    texld r3, r4, s0
    mul r0.x, r3, r0
    add r3.x, -r4, c2.w
    cmp r3.x, r3, c2, c2.z
    add_pp_sat r1.x, r1, r3
    cmp_pp r6, -r1.x, r2, r5
    rsq r0.x, r0.x
    add r2.x, c0.w, -c0.z
    add r3.x, t0.y, -c0.z
    min r3.x, r2, r3
    max r3.x, r3, c2
    rcp r2.x, r2.x
    mad r7.x, -r3, r2, c2.w
    add r4.x, -r3, c2.y
    rcp r0.x, r0.x
    mad r0.x, -r3, r2, r0
    cmp r4.x, r4, c2.z, c2
    cmp r7.x, r7, c2, c2.z
    add_pp_sat r7.x, r4, r7
    cmp_pp r4.x, -r1, c2.z, c2
    mul_pp r1.x, r4, r7
    cmp_pp r6, -r1.x, r6, r5
    cmp_pp r1.x, -r1, r4, c2
    cmp r2.x, r0, c2, c2.z
    mul_pp r0.x, r4, r1
    mul_pp r2.x, r0, r2
    cmp_pp r1.x, -r2, r1, c2
    mul_pp r0.x, r0, r1
    mov r3.w, c3.x
    mov r3.xyz, c3.y
    mad r3, r5, c3.x, r3
    cmp_pp r2, -r2.x, r6, r3
    mov r1.xyz, c3.z
    cmp_pp r0, -r0.x, r2, r1
    mov_pp oC0, r0
     
    Last edited: May 19, 2015
  32. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    This happens because you moved the asset folder, this will break resources path and many other assets won't work that way because of this. I found a workaround since it's used only at only one place in-editor, I plan on updating the asset this week with other minor changes, this will be included.

    For the shader compilation error, this depends on which GPU you are using. So far, it's been tested with success on Nvidia/AMD/Intel on windows/mac and been released with success in some games. I wonder what is your configuration? The error you reported is straightforward to fix.

    I will send you an update with those minor changes today.
     
  33. DivergenceOnline

    DivergenceOnline

    Joined:
    Apr 19, 2015
    Posts:
    244
    1) I definitely don't want to start having to put third-party scripts in my root asset folder if at all possible.

    2) I'm using a standard Radeon 7850 so there shouldn't be any compatibility issues.

    3)I've noticed that if i manually add the eye adjustment script to the camera, when it's turned on, the whole view will be either 100% white or 100% black. Hope it helps!

    4)Thanks! I can't wait to get that fix that you mentioned so just send it to me at your earliest convenience.
     
  34. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    NEWS
    I submitted an update to the 1.2 version with a couple of changes and fixes reported by the users.
    • Xbox One support have been added
    • A compilation error with AMD cards when using Dx9 have been fixed
    • The screen turning super bright when undoing with the eye adaptation component have been fixed
    • The "Add Eye Adaptation" menu item have been fixed
    You might need to delete the old asset folder before updating since I had to delete and rename some files.

    I also plan on updating the asset with more tonemapping color correction tools for the 1.3 version.
     
    SAOTA and DennG like this.
  35. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @G.Mika Do you think you could make a walk-through tutorial on Youtube that has a scene and explains what each value on the Filmic Curve does to the image visually? Despite having your documentation, I still feel I'm not sure how to get the most out of my scene, or how I should setup my Unity project settings and light settings.
     
  36. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    Hi Ben,

    I'm busy right now, but I plan on making a video tutorial, maybe next week. In the latest version, I added a couple of presets from which you can start, it gives some examples on how it could be used with or without HDR. Starting from there, with some experimentation you can probably get an interesting result. If you work on a desktop game, to get an optimal result, you also need to set your project with linear lighting and your camera with HDR enabled.

    I also have the project of making an all-in-one HDR tutorial. It would include an in-depth coverage on how to effectively use HDR inside Unity and how to setup the perfect configuration for your project with HDR assets like Filmic Tonemapping DELUXE.
     
    toxtronyx and Ben-BearFish like this.
  37. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Sounds good. Thanks for the update.
     
  38. joeconstable97

    joeconstable97

    Joined:
    Jul 30, 2013
    Posts:
    50
    Hey, I've been looking into buying this and was wondering if the eye adaptation supports a clamped exposure?
     
  39. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    Yes you can set the exposure range as well as other exposure settings, this is how the component appears in the inspector:

     
    joeconstable97 likes this.
  40. toxtronyx

    toxtronyx

    Joined:
    Aug 21, 2014
    Posts:
    114
    Man I love this nifty little piece of software!
    You wouldn't mind sending me a little testscene with a usefull setup? I am able to produce the results I always wanted with the Tonemapping but somehow the eye adaption doesn't do anything here. When I lift up the exposure multiplier I see that it is actually doing something but the eye adaption effect itself does not react. I already tried to play with every slider I could but that resulted only in a ruined look or no reaction at all.
    I am running on U5.02f1, Gamma Color Space, Forward Rendering
    For the Sky I use Time of Day (currently the only light source in the scene) set to HDR.
    My camera has the following applied:
    Eye Adaption
    Bloom
    TOD Rays +TOD Main Camera Script (both from Time of day and deactivating them makes no difference
    Filmic Tonemapping

    The histogram shows a lot differences during movement of the camera in the scene but as stated earlier thats everything that is happening.
    Hope you can help me out. I am really loving the effect at the viking village video you posted earlier.
     
  41. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    Hi toxtronyx, i'm glad you like the tonemapper so far.

    You should be using linear space as HDR won't work well with gamma space, it will cause issues with how color is processed and the eye adaptation effect won't behave correctly and it is probably the cause of issue. The PBR pipeline of Unity 5 don't handle gamma space very well either. If you worry about how it will look with linear space, you will be able to clean the look with the tonemapper.
     
  42. toxtronyx

    toxtronyx

    Joined:
    Aug 21, 2014
    Posts:
    114
    Thanks for your quick reply. I'll give it a try.
     
  43. toxtronyx

    toxtronyx

    Joined:
    Aug 21, 2014
    Posts:
    114
    OK well, caused some errors for some of my materials but overall it is the better choice and yes eye adaption works like a charm now. Thanks a lot!
     
    G-Mika likes this.
  44. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
  45. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    It's not the same but it's similar (S shaped). He actually compares against non-filmic tonemapping curves (linear and Reinhardt).
     
  46. bluemoon

    bluemoon

    Joined:
    Dec 14, 2012
    Posts:
    85
    This looks great. I've wanted an improved tonemapper for a long time now. I'm definitely picking up a copy after the weekend!
     
  47. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    Hello,
    sorry for beginner question. But I'm wondering what is correct order for these image effects used with filmic tonemapper and eye adapatation? This is how I ordered it with my common sense (it doesn't mean that I need all but it would be nice to get idea how it may be ordered).

    SSAO
    Deluxe Eye Adaptation
    Bloom
    Deluxe Tonemapper
    Depth of Field (or before eye adaptation?)
    Color grading
    Vignette
    Antialiasing

    Regards
    Peter
     
  48. G-Mika

    G-Mika

    Joined:
    Jul 17, 2012
    Posts:
    99
    @camel82106

    This looks mostly alright except that you should place DoF right before eye adaptation or at least before tonemapping.
     
  49. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    Thanks you very much for help

    And of course thanks for your plugin. It was massive change for my visuals.
    Peter
     
    Last edited: Jun 13, 2015
  50. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,766
    m_MainCurve.m_ToeStrength being inverted when set via a script:

    we purchased the Deluxe Tonemapper. In our script, we set the m_ToeStrength to -0.99f. But the deluxe tonemapper script continues to switch the m_ToeStrength to +0.99.

    Here is the code:
    Code (csharp):
    1.  
    2. private DeluxeTonemapper toneMapper;
    3. toneMapper=this.GetComponent<DeluxeTonemapper>();
    4.  
    5. toneMapper.m_MainCurve.m_BlackPoint = 0.006f;
    6. toneMapper.m_MainCurve.m_WhitePoint = 0.57f;
    7. toneMapper.m_MainCurve.m_CrossOverPoint = 0.015f;
    8. toneMapper.m_MainCurve.m_ToeStrength = -0.99f;
    9. toneMapper.m_MainCurve.m_ShoulderStrength = -0.81f;
    10. toneMapper.m_Tint=Color.white;
    11.  
    then after setting the values, the tonemapper shows this:
    upload_2015-6-18_18-56-43.png

    The dark intensity is now 0.99.

    is there something wrong with what we are doing?
    Thanks.