Real-time Colour Cast Neutralizer
- Duran.te
- Topic Author
I was wondering if it was possible to achieve an effect like the neutralize filter seen in photoshop to reduce color casting.
(What is the neutralize filter)
I'll take the game Need for Speed 2015 as an example. I took screenshots of two scenes with excessive color tint, I then applied the filter in photoshop and here's the result:
(gameplay source: )
Please Log in or Create an account to join the conversation.
- Marty
At the very least you can apply the effect to LUT in Photoshop.
Please Log in or Create an account to join the conversation.
- Wicked Sick
Please Log in or Create an account to join the conversation.
Principle is this:
• Sample whole image and determine maximum and minimum levels for Red Green and Blue
• On second pass apply this to the image:
CastRemoved = (SourceImg.rgb-Minimum.rgb)/(Maximum.rgb-Minimum.rgb)
I would try it, but don't know how to pass variables between passes
Please Log in or Create an account to join the conversation.
- Chavolatra
Please Log in or Create an account to join the conversation.
- Daodan
Fu-Bama wrote: I would try it, but don't know how to pass variables between passes
Maybe save the min/max RGB values into a 1x1 texture and use RGBA16 as the format (max value stored in the upper, min value in the lower 8 bits).
And then read from that texture when applying the color correction.
[Edit]
Or, having a pass that has two render targets (1x1 texture) would be easier.
@Fu-Bama I just wrote up a gist that could act as a baseline.
It gets the min/max RGB values and applies them in the formula you provided.
Please Log in or Create an account to join the conversation.
- Daodan
[Old Version]
[Edit]
- Added control to set the interpolation speed of min/max values between frames (does anyone know how to do that framerate independent?)
- Added control to set the effect strength
Base image:
Tinted:
Neutralized:
Please Log in or Create an account to join the conversation.
- MaxG3D
Please Log in or Create an account to join the conversation.
- Duran.te
- Topic Author
Please Log in or Create an account to join the conversation.
- OtisInf
I assume you use a temporal lerp between 2 1pixel textures? You could adjust the speed with a timer, instead of simply adding a value with each pass (frame), so if the framerate is low or high it doesn't matter.Daodan wrote: Added control to set the interpolation speed of min/max values between frames (does anyone know how to do that framerate independent?)
Shader looks great! good job
Please Log in or Create an account to join the conversation.
- Daodan
- More meaningful name: RemoveTint.fx
- When interpolating the min/max RGB values the frametime is taken into account
- It is possible to set custom min/max RGB values, can lead to some interesting results (add REMOVE_TINT_CUSTOM_COLORS to the preprocessor defs)
[strike]But, it seems the shader doesn't work in d3d9 yet.[/strike]
Changed tex2Dfetch() with tex2D() and it works now. tex2Dfetch() in d3d9 seems to be bugged at the moment.
Please Log in or Create an account to join the conversation.
- Wicked Sick
Please Log in or Create an account to join the conversation.
- crosire
Fixed: github.com/crosire/reshade/commit/0fc8fe...e793afdd47cf958513d7Daodan wrote: Changed tex2Dfetch() with tex2D() and it works now. tex2Dfetch() in d3d9 seems to be bugged at the moment.
tex2Dfetch didn't work on the backbuffer and depth buffer in D3D9 (worked on user textures). This fixes that.
Please Log in or Create an account to join the conversation.
- Daodan
This is one of my all-time favourites
Please Log in or Create an account to join the conversation.
- sulpherStaer
Here are two images to show what I mean.
The top image one has the UI hidden. and as you can see, the right side (where the UImask is) is being corrected.
The bottom image shows the ui, and the masked area is no longer corrected. How would I solve this? How do I create a 'sample area' so that the UI is ignored in the color pick.
Please Log in or Create an account to join the conversation.
- Daodan
Please Log in or Create an account to join the conversation.
- klotim
Daodan wrote: I've updated the shader - see one of my posts with the link in it. Using that might help a bit with your problem as the min/max rgb values are now taken from a mipmap and not the full resolution.
With strength 1.0
I'm not sure but it still looks way different to photoshop neutralize.
Is it possible to make it look like PS Neutralize?
PS Neutralize
Reshade Remove Tint
Please Log in or Create an account to join the conversation.
- mirt81
- Daodan
klotim wrote: I'm not sure but it still looks way different to photoshop neutralize.
Is it possible to make it look like PS Neutralize?
[strike]Have you tried setting REMOVE_TINT_MIPLEVEL_EXP2 to 1 so the min/max RGB values are taken from the native resolution and not a mipmap?[/strike] This will probably not work as there could be too many iterations in the for-loop (-> shader fails to compile).
This shader is still some sort of "draft" - when I find time I will rework it and post it in the presentation thread.
Please Log in or Create an account to join the conversation.
- klotim
Daodan wrote:
klotim wrote: I'm not sure but it still looks way different to photoshop neutralize.
Is it possible to make it look like PS Neutralize?
[strike]Have you tried setting REMOVE_TINT_MIPLEVEL_EXP2 to 1 so the min/max RGB values are taken from the native resolution and not a mipmap?[/strike] This will probably not work as there could be too many iterations in the for-loop (-> shader fails to compile).
This shader is still some sort of "draft" - when I find time I will rework it and post it in the presentation thread.
Alright, thanks anyway, im looking forward to a updated version. To neutralize colors for a game is really nice to have.
Please Log in or Create an account to join the conversation.