Enabling Shader by holding button
- demolisher
- Topic Author
Less
More
There is option to toggle shader by pressing picked button, but is it possible to enable shader when you hold certain button and disable when it's unclicked?
Example: Game with TAA is blurrier in motion, so when you press movement key, it enables sharpen effect.
Example: Game with TAA is blurrier in motion, so when you press movement key, it enables sharpen effect.
Please Log in or Create an account to join the conversation.
- crosire
Less
More
It's possible, but only in shader code. It cannot be done from the GUI.
Example of a modification to LumaSharpen to make this work:
Example of a modification to LumaSharpen to make this work:
uniform bool movement_key_down < source = "key"; keycode = 80; >; // Get keycode from e.g. https://keycode.info, in this case it is "W"
...
float3 LumaSharpenPass(float4 position : SV_Position, float2 tex : TEXCOORD) : SV_Target
{
...
float3 ori = tex2D(ReShade::BackBuffer, tex).rgb; // ori = original pixel
// Add the following so effect is not applied while the key is not down:
if (!movement_key_down)
return ori;
...
}
The following user(s) said Thank You: demolisher
Please Log in or Create an account to join the conversation.
- demolisher
- Topic Author
Less
More
4 years 1 month ago #3
by demolisher
Replied by demolisher on topic Enabling Shader by holding button
Thanks, this works. Honestly, this is even better since you can tweak specific values by holding button.
Please Log in or Create an account to join the conversation.
- brussell
Less
More
Unfortunately this became far less convenient with the keypress timeout you introduced recently, crosire. Would you consider giving us the possibility to override the default 5 seconds with a pragma or sth ?
Please Log in or Create an account to join the conversation.
- crosire
Less
More
I don't see why. The OS will resend the key down event repeatedly after about one second, so the timeout is never triggered when you keep holding down the key (and yes, I verified that this works).
Please Log in or Create an account to join the conversation.
- brussell
Less
More
crosire wrote: I don't see why. The OS will resend the key down event repeatedly after about one second, so the timeout is never triggered when you keep holding down the key (and yes, I verified that this works).
Well, for me it only works if I hold ONLY the specified key (in your example W). If I press some other key while holding down W, reshade doesn't recognise the keypress anymore after short time (the 5 second intervall I guess).
Since one rarely presses only one key, this clearly doesn't work as intended (and it shouldn't work conveniently for the op's case either).
I'm using windows 7 x64 by the way.
Could it be related to keyboard ghosting or sth?
Please Log in or Create an account to join the conversation.