Pixel area detection?
- Nekres
- Topic Author
Less
More
8 years 6 months ago - 8 years 6 months ago #1
by Nekres
Pixel area detection? was created by Nekres
Is it possible to detect an area of red to black pixels like the HP orb in Guild Wars 2?
I would really love to have a bloody screen as texture overlay which gets bigger as my HP drops lower.
wiki.guildwars2.com/images/2/20/Health_orb.png
wiki.guildwars2.com/images/5/5a/Player-HP.jpg
Is it possible to detect when a red pixel is not existing anymore or got black?
I want to create such a script myself, but I do not know what arguments ReShade takes.
I would really love to have a bloody screen as texture overlay which gets bigger as my HP drops lower.
wiki.guildwars2.com/images/2/20/Health_orb.png
wiki.guildwars2.com/images/5/5a/Player-HP.jpg
Is it possible to detect when a red pixel is not existing anymore or got black?
I want to create such a script myself, but I do not know what arguments ReShade takes.
Last edit: 8 years 6 months ago by Nekres.
Please Log in or Create an account to join the conversation.
- crosire
Less
More
Yes, that's possible. Something like this pseudocode (just guessed the position of that HP orb on the screen now to be at around (0.5, 0.94-0.98), would need more experimenting):
float strength = 0;
strength += tex2D(RFX_backbufferColor, float2(0.5, 0.94)).r
strength += tex2D(RFX_backbufferColor, float2(0.5, 0.96)).r
strength += tex2D(RFX_backbufferColor, float2(0.5, 0.98)).r
strength /= 3;
finalcolor.rgb += tex2D(bloodyScreenSampler, texcoord).rgb * strength;
Please Log in or Create an account to join the conversation.
- Nekres
- Topic Author
Less
More
8 years 6 months ago - 8 years 6 months ago #3
by Nekres
Replied by Nekres on topic Pixel area detection?
My resolution is 16:9 (1920x1080) Can you explain me the arguments in your pseudocode?
I created a perfect 16:9 uiMask for GW2: i.imgur.com/WOYz9YO.png
The HP orb is in the bottom center.
I would love you if you created me the snippet of code (maybe with commentary) where it checks the circle so I can learn my way around.
(I would even consider paying you a small fee.)
Another question is, I can't seem to find a prober C++ source file (*.h) Wiki site with a list of arguments.
I created a perfect 16:9 uiMask for GW2: i.imgur.com/WOYz9YO.png
The HP orb is in the bottom center.
I would love you if you created me the snippet of code (maybe with commentary) where it checks the circle so I can learn my way around.
(I would even consider paying you a small fee.)
Another question is, I can't seem to find a prober C++ source file (*.h) Wiki site with a list of arguments.
Last edit: 8 years 6 months ago by Nekres.
Please Log in or Create an account to join the conversation.
- Ganossa
Less
More
The shader files are ending on .h because the syntax is similar but the language is hlsl.
If you need a testing environment I recommend the Custom.h in CustomFX suite which can be used to create new shader.
If you need a testing environment I recommend the Custom.h in CustomFX suite which can be used to create new shader.
Please Log in or Create an account to join the conversation.
- Nekres
- Topic Author
Less
More
8 years 6 months ago - 8 years 6 months ago #5
by Nekres
Replied by Nekres on topic Pixel area detection?
Is the pseudocode by cosire above detecting a circle?
Where is "RFX_backbufferColor" defined? Where can I check what it does?
I added my stuff to the pseudocode
I get errors in line 24, 7: global variables are considered uniform by default and line 25, 1: unexpected identifier
EDIT: I created a simple bloody screen texture for 16:9 res: i.imgur.com/1kWYsec.png
Where is "RFX_backbufferColor" defined? Where can I check what it does?
I added my stuff to the pseudocode
texture bloodTex < source = "ReShade/CustomFX/Textures/CFX_bloodyScreen.png"; > { Width = 1920; Height = 1080; MipLevels = 1; Format = RGBA8; };
sampler2D bloodSampler { Texture = bloodTex; };
float strength = 0;
strength += tex2D(RFX_backbufferColor, float2(0.5, 0.94)).r
strength += tex2D(RFX_backbufferColor, float2(0.5, 0.96)).r
strength += tex2D(RFX_backbufferColor, float2(0.5, 0.98)).r
strength /= 3;
finalcolor.rgb += tex2D(bloodSampler, texcoord).rgb * strength;
I get errors in line 24, 7: global variables are considered uniform by default and line 25, 1: unexpected identifier
EDIT: I created a simple bloody screen texture for 16:9 res: i.imgur.com/1kWYsec.png
Last edit: 8 years 6 months ago by Nekres.
Please Log in or Create an account to join the conversation.
- jas01
Less
More
8 years 6 months ago - 8 years 6 months ago #6
by jas01
Replied by jas01 on topic Pixel area detection?
Nekres wrote: EDIT: I created a simple bloody screen texture for 16:9 res: i.imgur.com/1kWYsec.png
You can try this .
Last edit: 8 years 6 months ago by jas01. Reason: quote
Please Log in or Create an account to join the conversation.
- Nekres
- Topic Author
Less
More
Thanks, but I need more help with the hlsl shader language. I need some sort of Wiki where I can look up individual arguments and functions of the language or someone who codes the detection of the circle from above.
Please Log in or Create an account to join the conversation.
- Nekres
- Topic Author
Less
More