In the documentation for the Color Correction LUT image effect, it mentions:
The image shows a texture of the dimension 256x16, yielding a 16x16x16 color lookup texture (lut). If the resulting quality is too low, a 1024x32 texture might yield better results (at the cost of memory).
I’ve been going off of the included 256x16 neutral texture, but there isn’t a 1024x32 neutral look up texture included with Image Effects. I can’t seem to find one anywhere, and I’m not sure how to make one. Does anybody have one?
Hmm. Thank you! But it didn’t seem to work properly. Maybe I have to modify the script somehow to accept the bigger LUT?
You are right, it does not work properly.
After seeing the source of the image manipulation, the reason it does not work is not related to the image size.
Indeed, the image size is specified as “needs to be of the format w * h, where h is the ‘depth’ (or 3d dimension ‘dim’) and w = dim * dim”. Usable dimensions are 16x256, 32x1024, 64x4096. ( Obviously, a developer could offer support for other image dimensions, see colourful using a square texture here http://www.thomashourdel.com/colorful/doc/lut.html ).
The problem with the image seems to be in the jpeg encoding, which obviously alters the image colors.
I couldn’t find a neutral lut file in these dimensions, I have noticed that there is an app, http://3dlutcreator.com/ which has some output capabilities. You could contact the developers and ask if they can provide the output you need.
Kind regards
-Ippokratis
It is quite easy to make your own in photoshop. Just examine how the 256x16 was made and translate that over to a 1024x32 texture… or use the one below.
The one Ippokratis posted was not made for Unity ImageEffects in mind I guess. Probably for Unreal Engine.
[Edit]
See the post below for correct code and textures
Nice Ippo, that code might come in handy some time in the future - though the output seems to be different. If you take a look at the LUT in the documentation you’ll notice that your code swizzled the green and blue channel and your green channel starts with zero at the bottom instead of on top.
Thank’s a lot, guys! Hope this helps other people who stumble across this with the same problem
@Ippokratis :
Yours is giving me a result that differs a little more from the original photoshop tweak. May depend on what function one uses to color grade the scene. But here’s the result:
Marco : You are right, it is not correct.
Corrected code :
#pragma strict
import System.IO;
var tex2D : Texture2D;
var dims:int;
function Start ()
{
CreateIdentityLut(dims);
}
function CreateIdentityLut (dim : int)
{
var newC : Color[] = new Color[dim * dim * dim];
var oneOverDim : float = 1.0f / (1.0f * dim - 1.0f);
for(var i : int = 0; i < dim; i++)
{
for(var j : int = 0; j < dim; j++)
{
for(var k : int = 0; k < dim; k++)
{
newC[i + (j*dim) + (k*dim*dim)] = new Color((i*1.0f)*oneOverDim, Mathf.Abs( ((k*1.0f)*oneOverDim) - 1.0f ), (j*1.0f)*oneOverDim, 1.0f);
}
}
}
tex2D = new Texture2D (dim*dim,dim, TextureFormat.RGB24, false);
tex2D.SetPixels(newC);
tex2D.Apply();
var bytes = tex2D.EncodeToPNG();
File.WriteAllBytes(Application.dataPath + "/../3DLUT" + (dim*dim).ToString()+"ll" + ".png", bytes);
}
Corrected textures :
1 Like
Does this code work in 5? Having some trouble with it but I may also just be dumb…
Thanks.