Enabling Shader by holding button

  • demolisher
  • Topic Author
More
4 years 1 month ago #1 by demolisher Enabling Shader by holding button was created by demolisher
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.

Please Log in or Create an account to join the conversation.

  • crosire
More
4 years 1 month ago #2 by crosire Replied by crosire on topic Enabling Shader by holding button
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:
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
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
More
4 years 1 month ago #4 by brussell Replied by brussell on topic Enabling Shader by holding button
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
More
4 years 1 month ago #5 by crosire Replied by crosire on topic Enabling Shader by holding button
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
More
4 years 1 month ago #6 by brussell Replied by brussell on topic Enabling Shader by holding button

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.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.