Welcome, Guest.
Username: Password: Remember me

TOPIC: Unreal Engine 4 Color Grading

Unreal Engine 4 Color Grading 1 year 6 months ago #1

  • matsilagi
  • matsilagi's Avatar
  • Offline
  • Posts: 199
  • Thank you received: 54
Would it be possible to do this? docs.unrealengine.com/latest/INT/Engine/...orGrading/index.html

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 :P , still, ME's lut still doesnt give me the results like the screenshot.
Loves to test stuff for no reason.
Last Edit: 1 year 6 months ago by matsilagi.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #2

  • Kleio420
  • Kleio420's Avatar
  • Offline
  • Posts: 213
  • Thank you received: 28
matsilagi wrote:
Would it be possible to do this? docs.unrealengine.com/latest/INT/Engine/...orGrading/index.html

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 :P , 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
Last Edit: 1 year 1 month ago by crosire. Reason: Fixed link
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #3

  • matsilagi
  • matsilagi's Avatar
  • Offline
  • Posts: 199
  • Thank you received: 54
I tried to, spent an afternoon playing around with LUTs and nothing, i dont think ME's LUT + SweetFX tonemapping stuff can get close to UE4's one.
Loves to test stuff for no reason.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #4

UE page is referring to 16x16x16 3D LUT,
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.
Last Edit: 1 year 6 months ago by kingeric1992.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #5

I posted about this month ago actually but didn't really get a straight answer. I am a developer at Druid Gameworks and I can honestly say that using the 16x16x16 LUT is far easier than using the one in ME.

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.


Witanlore: Dreamtime
Last Edit: 1 year 6 months ago by vfxninjaeditor.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #6

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2437
  • Thank you received: 1384
kingeric1992 wrote:
16x16x16 3D LUT
This is the problem however. ReShade only supports native 2D textures, so 3D textures would need to be emulated in shader code.
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: W S

Unreal Engine 4 Color Grading 1 year 6 months ago #7

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);
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #8

  • Ganossa
  • Ganossa's Avatar
  • Offline
  • 최정장군
  • Posts: 790
  • Thank you received: 838
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.
Last Edit: 1 year 6 months ago by Ganossa.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #9

  • matsilagi
  • matsilagi's Avatar
  • Offline
  • Posts: 199
  • Thank you received: 54
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)
Loves to test stuff for no reason.
Last Edit: 1 year 6 months ago by matsilagi.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #10

  • Ganossa
  • Ganossa's Avatar
  • Offline
  • 최정장군
  • Posts: 790
  • Thank you received: 838
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::I can actually create one myself with a shader.
Last Edit: 1 year 6 months ago by Ganossa.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #11

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
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.

Warning: Spoiler! [ Click to expand ]


EDIT: Yes, even a neutral LUT produces clipping. Cannot nail it down to a color channel though.
Last Edit: 1 year 6 months ago by Marty McFly.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #12

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.

Warning: Spoiler! [ Click to expand ]


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.


Witanlore: Dreamtime
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #13

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?


Witanlore: Dreamtime
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #14

  • Ganossa
  • Ganossa's Avatar
  • Offline
  • 최정장군
  • Posts: 790
  • Thank you received: 838
I read it but I still need the raw 2D LUT as reference.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #15

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);
Last Edit: 1 year 6 months ago by kingeric1992. Reason: typo
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #16

  • Ganossa
  • Ganossa's Avatar
  • Offline
  • 최정장군
  • Posts: 790
  • Thank you received: 838
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


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.
Last Edit: 1 year 6 months ago by Ganossa.
The administrator has disabled public write access.
The following user(s) said Thank You: matsilagi, BillyAlt, Constantine PC, BrandonHortman

Unreal Engine 4 Color Grading 1 year 6 months ago #17

  • matsilagi
  • matsilagi's Avatar
  • Offline
  • Posts: 199
  • Thank you received: 54
Amazing! Cant wait to actually use it.
Loves to test stuff for no reason.
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #18

  • Kleio420
  • Kleio420's Avatar
  • Offline
  • Posts: 213
  • Thank you received: 28
LuciferHawk 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.
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 doing
The administrator has disabled public write access.

Unreal Engine 4 Color Grading 1 year 6 months ago #19

  • Ganossa
  • Ganossa's Avatar
  • Offline
  • 최정장군
  • Posts: 790
  • Thank you received: 838
Yes, its basically ready and I will ship it together with the motion focus shader once its done.

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
 /*ˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆ*\
 \*……………………………………………………………………………………*/
The administrator has disabled public write access.
The following user(s) said Thank You: SpinelessJelly, jas01