UIDetect

  • Posts: 281
2 years 4 months ago - 1 month 3 days ago #1 by brussell
UIDetect can be used to automatically toggle shaders depending on the visibility of UI elements.
It's useful for games, where one wants to use effects like DOF, CA or AO, which however shouldn't
be active when certain UI elements are displayed (e.g. inventory, map, dialoque boxes, options
menu etc.). Multiple UIs can be defined, while each is characterized by a number of user-defined
pixels and their corresponding color values (RGB).
-> see full description here: github.com/brussell1/Shaders/blob/master/Shaders/UIDetect.fxh

Example video (DOF, CA and Moviebars get toggled when UI becomes visible)
Example video with RGB mask (DOF (exaggerated) is disabled on HUD, inventory and options menu)

For the latest updates visit my repository github.com/brussell1/Shaders

Changelog
Warning: Spoiler! [ Click to expand ]
The following user(s) said Thank You: crosire, Wicked Sick, conan2k, Qsimil

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

  • Posts: 3740
2 years 4 months ago #2 by crosire
You definitly want "UIPixelCoord" and "UIPixelRGB" to be "static const float3", or else they will be interpreted as uniforms instead of constants, which is considerably slower.
The following user(s) said Thank You: Pondural, brussell, Qsimil, Fu-Bama

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

  • Posts: 281
2 years 4 months ago #3 by brussell
I've added an example video to my initial post, in case anybody thinks tl;dr

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

  • Posts: 1
2 years 4 months ago - 2 years 4 months ago #4 by Illuzio
Your shader is great, thank you for your work!

I had an idea that might interest you!
All PC video game interfaces that are played on the keyboard/mouse have a common point when displayed on the screen (and which is identical for all resolutions) "A cursor appears".

Here's my idea: your shader should be able to detect the presence of the cursor on the screen, it compares the pixels of the cursor (relative to an image of it in the folder "textures") and it makes this comparison on the position of the cursor in the screen.
(The shader must be able to detect several different cursors because there are games that use more than one cursor).

With this system, you can even create a shader to display a custom cursor when the interface appears!

There is already a shader that can replace the cursor (but it's still visible.), it can maybe help you, you can find it here .

(Excuse my bad English, I'm french.)

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

  • Posts: 43
2 years 2 months ago - 2 years 2 months ago #5 by hunt1hunt
@brussell:
thank you very for your shader! Want to know Can use the mouse to get the coordinates of the ui element and the corresponding RGB value sequence instead of the eyedropper when the effect sequence is not started? tanks!

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

  • Posts: 281
2 years 2 months ago #6 by brussell
@Illuzio
I've tried to use the mouse pointer for ui detection recently, but it's not really reliable. Every game behaves differently.

@hunt1hunt
Currently not, but I'll look into it!

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

  • Posts: 28
2 years 2 weeks ago #7 by JizargoLikesKitten
I tried everything for past 3 hours tonight to get this shader working and have been completely unable to hide any UI in ESO from DoF.

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

  • Posts: 28
2 years 2 weeks ago #8 by JizargoLikesKitten
After messing around with this some more, I think the problem is because the UI is semi-transparent.

Any work around for this?

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

  • Posts: 281
2 years 2 weeks ago #9 by brussell
No. But you could try it with an UI mod like this one: www.esoui.com/downloads/info1678-CleanerHUD.html

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

  • Posts: 1
1 year 9 months ago - 1 year 9 months ago #10 by rogueyoshi
Hello. HiAlgo Boost is able to automatically detect UI elements during it's Dynamic Resolution Scale without needing a pre-determined mask. It is even toggle-able. Perhaps it is possible to do this in ReShade using the same method?

www.hialgo.com/TechnologyBOOST.html

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

  • Posts: 18
3 months 4 weeks ago #11 by ZabaZu
Have you considered setting up a database of sorts for user submitted per-game UI profiles? It could be an incredibly useful contribution to the community. Not implying anything fancy necessarily, something along the lines of a google spreadsheet just so a user can find their game and copy paste the settings.

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

  • Posts: 281
3 months 3 weeks ago #12 by brussell
@ZabaZu

Unfortunately the color values of the pixels are different depending on resolution, anti-aliasing and other settings (probably even on gpu vendor).
So even if there were a database of game profiles, everyone of them would only be valid for a very specific game/hardware configuration.
While I basically like the idea, in it's current state it would not be very useful or user-friendly.

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

  • Posts: 3740
3 months 3 weeks ago - 3 months 3 weeks ago #13 by crosire
@brussell While I have you, would you mind rearranging your github.com/brussell1/Shaders repository slightly, so that all fx files are in a single directory? The upcoming ReShade setup tool will allow the user to select your repository directly to download (unless you don't want that), but it is only capabable of extracting shaders from a single directory. It doesn't really matter how that directory is named, just that all fx files are in it and not spread into multiple directories (like how in github.com/crosire/reshade-shaders all shaders are in a "Shaders" directory).
The following user(s) said Thank You: brussell

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

  • Posts: 281
3 months 3 weeks ago - 3 months 3 weeks ago #14 by brussell
@crosire
Already done!

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

  • Posts: 281
1 month 3 days ago - 1 month 3 days ago #15 by brussell
Updated to v. 2.0.

Changelog:
-added RGB mask support via external texture
-> Example video (here shaders are disabled on HUD, Inventory and Options menu): i.imgur.com/cvfOq54.mp4
-added ShowPixel technique

A full description and configuration info can be found in UIDetect.fxh
The following user(s) said Thank You: Faustus86

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

  • Posts: 455
1 month 3 days ago #16 by Martigen
This is fantastic, thank you!

I don't suppose you (or someone else) could make a step-by-step tutorial for the mask method? Even reading the instructions in UIDetect.fxh with Gimp was a little over my head (I've used Gimp before, but nothing related to layers etc).

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

  • Posts: 8
1 month 2 days ago - 1 month 2 days ago #17 by MinerOfWorlds
Awesome! Working flawlessly with System shock 2 so far.

By the way, how did you get this working with deus ex? The huds transparent for me or is it one of the later games?

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

  • Posts: 281
1 month 2 days ago #18 by brussell
@Martigen
I thought the instructions are pretty straightforward. Maybe you can write where you're stuck?

@MinerOfWorlds
You can disable the transparency in the game options.

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

  • Posts: 3
4 weeks 12 minutes ago - 3 weeks 6 days ago #19 by Radstark
Some games have a UI with very subtle transparency. Would it be possible to make the effect check if the pixels are in a range of colours, rather than of that exact colour?
For example, if a certain pixel has an RGB value of (30,55,190) in my screenshot, but I know it varies slightly, I could set an offset value - say, 5 - so that the effect, rather than checking that exact RGB value, would instead check if the pixel's red value is between 25 and 35, green between 50 and 60, and blue between 185 and 195.
Would it be worth a try? I don't think it would affect performance much if at all.

On a side note: I had difficulty figuring out what colour of the mask should correspond to mask 1, 2, or 3. I guess it's red for mask 1, green for mask 2 and blue for mask 3 but I'm not sure since I couldn't get it to work with DCUO anyway for the above reason. I think it would be ok to add this information in the instructions just to be sure.

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

  • Posts: 1
1 day 19 hours ago #20 by Sauron462
When trying to use this with ReShade 4.7, it gives me an error that these shaders failed to compile, and shows they have a few errors preventing them from doing so. Am I doing something wrong?

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