Unreal Engine 4 Color Grading
- matsilagi
- Topic Author
I really like how it looks on Unreal Engine and i think it would be a nice addition to the framework.
I kinda wanted to get the colors close to this using the currently available tonemapping formulas (Spent an afternoon on it): but no avail, i think that if that gets added, i may be able to somehow "rip" the LUT from UT4 myself.
EDIT:Ah, didnt knew the fixed post was about the same shader , still, ME's lut still doesnt give me the results like the screenshot.
Please Log in or Create an account to join the conversation.
- Kleio420
matsilagi wrote: Would it be possible to do this? docs.unrealengine.com/latest/INT/Engine/...orGrading/index.html
but no avail, i think that if that gets added, i may be able to somehow "rip" the LUT from UT4 myself.
I really like how it looks on Unreal Engine and i think it would be a nice addition to the framework.
I kinda wanted to get the colors close to this using the currently available tonemapping formulas (Spent an afternoon on it):
EDIT:Ah, didnt knew the fixed post was about the same shader , still, ME's lut still doesnt give me the results like the screenshot.
you can try to edit it , or if nothing comes close and have some suggestions to make it better shoot marty a msg here reshade.me/forum/shader-presentation/161...born-official-thread
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- kingeric1992
http.developer.nvidia.com/GPUGems2/gpugems2_chapter24.html
ME is using 1D per channel.
The main difference is that 3D LUT is color to color, while the latter one is channel to channel.
Please Log in or Create an account to join the conversation.
- vfxninjaeditor
All you have to do is load a screenshot without any effects on it into photoshop, copy the LUT file over the screenshot, make your adjustments to both the screenshot and the LUT, crop to the LUT, save it and load it into UE4. Voila! The results you see in UE4 are identical to the ones you just made in photoshop.
I really wish this could be implemented into the Framework. It really allows you to get more creative.
Please Log in or Create an account to join the conversation.
- crosire
This is the problem however. ReShade only supports native 2D textures, so 3D textures would need to be emulated in shader code.kingeric1992 wrote: 16x16x16 3D LUT
Please Log in or Create an account to join the conversation.
- kingeric1992
// LUT Scale = 256x16, left side is .b == 0,
color.rgb = tex2D(OriginalColor, coord.xy).rgb;
color.b *= 15;
float shift = floor(color.b);
color.r = (color.r + shift) / 16;
color.rgb = lerp( tex2D(LUT, color.rg).rgb, tex2D(LUT, color.rg + float2(0.0625, 0)).rgb, color.b - shift);
Please Log in or Create an account to join the conversation.
- Ganossa
A difference you will always have anyway compared to a game internal LUT is that you have to apply them to the entire image and not just texture as it is done in UT for sure.
Please Log in or Create an account to join the conversation.
LuciferHawk wrote: Edit::okay, read the document you linked. If you give me a COMPLETE LUT in 2d space, I can implement it in the next release.
A difference you will always have anyway compared to a game internal LUT is that you have to apply them to the entire image and not just texture as it is done in UT for sure.
Good to see that this may be implemented.
Also, any way to keep the texture used by the shader the UT's one? (Would be much easier for me)
Please Log in or Create an account to join the conversation.
- Ganossa
matsilagi wrote: Good to see that this may be implemented.
Also, any way to keep the texture used by the shader the UT's one? (Would be much easier for me)
Then crosire needs to implememt 3d texture support first (or do they also provide 2d ones?) in the source which seems will not happen.
I need a raw gradient LUT that covers the entire color space in 2D (similar to those that you use when choosing colors in editing tools).
Edit: can actually create one myself with a shader.
Please Log in or Create an account to join the conversation.
- Marty McFly
kingeric1992 wrote: This should be fine, UE is also doing that , 16x16x16 3D --> 256x16 2D with some offset + lerp.
// LUT Scale = 256x16, left side is .b == 0, color.rgb = tex2D(OriginalColor, coord.xy).rgb; color.b *= 15; float shift = floor(color.b); color.r = (color.r + shift) / 16; color.rgb = lerp( tex2D(LUT, color.rg).rgb, tex2D(LUT, color.rg + float2(0.0625, 0)).rgb, color.b - shift);
Either your code isn't 100 right or the LUT I use is shitty, however it produces heavy clipping. Colors are in 0~1 range.
EDIT: Yes, even a neutral LUT produces clipping. Cannot nail it down to a color channel though.
Please Log in or Create an account to join the conversation.
- vfxninjaeditor
Marty McFly wrote:
kingeric1992 wrote: This should be fine, UE is also doing that , 16x16x16 3D --> 256x16 2D with some offset + lerp.
// LUT Scale = 256x16, left side is .b == 0, color.rgb = tex2D(OriginalColor, coord.xy).rgb; color.b *= 15; float shift = floor(color.b); color.r = (color.r + shift) / 16; color.rgb = lerp( tex2D(LUT, color.rg).rgb, tex2D(LUT, color.rg + float2(0.0625, 0)).rgb, color.b - shift);
Either your code isn't 100 right or the LUT I use is shitty, however it produces heavy clipping. Colors are in 0~1 range.
EDIT: Yes, even a neutral LUT produces clipping. Cannot nail it down to a color channel though.
I believe he copied that code directly from UE4 source.
Please Log in or Create an account to join the conversation.
- vfxninjaeditor
LuciferHawk wrote: Edit::okay, read the document you linked. If you give me a COMPLETE LUT in 2d space, I can implement it in the next release.
A difference you will always have anyway compared to a game internal LUT is that you have to apply them to the entire image and not just texture as it is done in UT for sure.
What do you mean by this Lucifer? Did you not see the workflow I posted on how UE4 LUT's are modified?
Please Log in or Create an account to join the conversation.
- Ganossa
Please Log in or Create an account to join the conversation.
- kingeric1992
vfxninjaeditor wrote: I believe he copied that code directly from UE4 source.
No, just guessing from provided LUT texture.
@Marty
I didn't add texture offset to sample the center of pixel, so there was some artifact at border.
Here is the fix(tested with enb)
// LUT Scale = 256x16, top left corner == 0.
float2 pixelsize = 1 / float2(256, 16);
color.rgb = saturate(tex2D(OriginalColor, coord.xy).rgb);
color.b *= 15;
float shift = floor(color.b);
color.rg = color.rg * 15 * pixelsize + 0.5 * pixelsize ;
color.r += shift * 0.0625;
color.rgb = lerp( tex2D(LUT, color.rg).rgb, tex2D(LUT, color.rg + float2(0.0625, 0)).rgb, color.b - shift);
Please Log in or Create an account to join the conversation.
- Ganossa
Anyway, here is a quick comparison using
GTAV vanilla
blue-ish photoLUT applied (altered with filters in photoshop)
GTAV above photoLUT ( + ambient light + DoF )
I like the LUT simply because it reduces performance you would need to run a bunch of other color correction algorithms, however, it needs to be improved.
Please Log in or Create an account to join the conversation.
- Kleio420
is there any plans to improve and push this possibly to the next framework update ?would love to use this ik i can already using the code the user posted , been trying to use Reinhard tonemapping and it either destroys to much detail or makes the image foggy im thinking using LUT will help some on what im doingLuciferHawk wrote: So I implemented the UT - LUT using the same color depth. It works well but there is room for improvement.
Anyway, here is a quick comparison using
GTAV vanilla
I like the LUT simply because it reduces performance you would need to run a bunch of other color correction algorithms, however, it needs to be improved.
Please Log in or Create an account to join the conversation.
- Ganossa
It is currently one part of the TuningPalette shader of CustomFX suite with the following options::
/*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯*\
‡ • Color LUT PARAMETERS • ‡
\*……………………………………………………………………………………*/
#define TuningColorLUTDstTexture "CFX_ColorLUTDst.png" //needs to have 256x16 pixels
#define TuningColorLUTNorm float2(1f/256f, 1f/16f)
#define TuningColorLUTIntensity 1.0f
/*ˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆ*\
\*……………………………………………………………………………………*/
Please Log in or Create an account to join the conversation.