Search Unity

Color Correction Lut android problem

Discussion in 'Editor & General Support' started by Hotsun, Feb 12, 2013.

  1. Hotsun

    Hotsun

    Joined:
    Aug 11, 2010
    Posts:
    122
    Hi,
    My problem is really simple,on android mode all image effects works fine but the color correction look up texture.
    After adding it to my camera the screen goes black in the editor.
    I didn't try the compiled version on a real mobile but it's not working in the editor.
    In the Hardware support for this image effect you can see "Mobile: OpenGL ES 2.0" so it should work without any problem.
    http://docs.unity3d.com/Documentation/Components/script-ColorCorrectionLut.html


    I searched for it but found nothing :(

    My system specs:
    CPU:I7-2600K
    VGA:GTX 580
    Ram:16GB DDR3
    Win 7 64-Bit Ultimate
    *Note that It is working very nice on PC mode.
     
  2. Hotsun

    Hotsun

    Joined:
    Aug 11, 2010
    Posts:
    122
    Anyone else seen this problem???
     
  3. fxcarl

    fxcarl

    Joined:
    Apr 8, 2010
    Posts:
    16
    Same Problem on ios ~ pop
     
  4. Iamdain

    Iamdain

    Joined:
    Feb 3, 2010
    Posts:
    90
    Ditto here with iOS as build target.
     
  5. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    this is an error in docs. If you read the article linked at full you will notice that it generated 3d texture and then use it to do magic. Alas, 3d textures are not really supported on mobiles
     
  6. Iamdain

    Iamdain

    Joined:
    Feb 3, 2010
    Posts:
    90
    Alexey I can only see it as supporting "Mobile: OpenGL ES 2.0" at the bottom. Was there something else I missed?
     
  7. Paulius-Liekis

    Paulius-Liekis

    Joined:
    Aug 31, 2009
    Posts:
    672
    Has anyone figured it out? I'm seeing same problem on iOS target.
     
  8. Paulius-Liekis

    Paulius-Liekis

    Joined:
    Aug 31, 2009
    Posts:
    672
    As Alexay said it doesn't work on mobiles. The reason is that it is based on 3D textures.

    I rewrote it work with 2D lookup texture instead - you can download the attached package. Import it on top of Image Effects package.
     

    Attached Files:

    UnityLighting likes this.
  9. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    @Paulius Liekis : your script works perfectly on Android! thanks!

    But still a little bit of memory consume, I am trying to enable/disable it in run-time.

    I catch the component<ColorCorrectionLut2D>(), tried to add an enable condition into the OnRenderImage() as below, but the screen switch to grey if I switch on enable = false;

    Code (csharp):
    1.    
    2. function OnRenderImage (source : RenderTexture, destination : RenderTexture)
    3. {
    4.     if(enable)
    5.     {
    6.      // etc....
    7.     }      
    8. }
    Any idea how I could make it disable?

    Thanks so far for your cool script.
     
  10. ahauser

    ahauser

    Joined:
    Oct 27, 2013
    Posts:
    1
    Hi Paul,
    Are you able to share this shader resource for allowing the reading of 3Dluts by using a 2D texture instead of a 3D texture.
    Im programming for a mobile device that doesnt support 3d textures.
    Thanks,
     
  11. Paulius-Liekis

    Paulius-Liekis

    Joined:
    Aug 31, 2009
    Posts:
    672
    @sama.van: I guess you could simply Graphics.Blit (source, destination); to OnRenderImage when script is disable, but that doesn't sound efficient enough. I guess you should be able to rewrite it so it doesn't reallocate recources on enabling/disabling.

    @ahauser: yes, the script uses 2D textures instead of 3D.
     
  12. Hotsun

    Hotsun

    Joined:
    Aug 11, 2010
    Posts:
    122
    Hi,
    When I want to use the Lut2D shader again in a new project based on Unity 4.3 I see too much artifacts.
    Is that really because of the new version of Unity or I made a mistake?
    Thanks.
     
  13. timohausmann

    timohausmann

    Joined:
    Apr 12, 2015
    Posts:
    1
    Thank you for the script, Paul!

    It doesn't work in Unity 5 though, I guess because Image Effects are now written in C# instead of UnityScript.
    So I rewrote the script to C#. The effect cuts my mobile framerate in half, so use with caution ;-)

    https://github.com/timohausmann/ColorCorrectionLut2DCSharp
     

    Attached Files:

    UnityLighting likes this.