Simple Shader that draws a png image onto screen

  • Posts: 17
5 years 2 months ago #1 by TrophiHunter
A message to anyone that can help, I am working on a Tank Hud for GTA5, I need to find/ have someone help me get a shader that draws a png image with an alpha over the Final "render' of the game "Last thing loaded because it needs to not be effected by any other shader, I made a Video showing what I mean, the Yellow hud is what I need over top GTA5 Tank HUD Concept

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

  • Posts: 790
5 years 2 months ago #2 by Ganossa
Can you post that .png?

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

  • Posts: 17
5 years 2 months ago #3 by TrophiHunter
Here I posted it to my flickr, if you can help Lucifer, that would be a huge step forward.
Tank Hud

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

  • Posts: 790
5 years 2 months ago #4 by Ganossa
Its very quick and simple as a custom shader with the framework but I will have to find a quiet minute between the Configurator implementation :)
The following user(s) said Thank You: TrophiHunter

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

  • Posts: 17
5 years 2 months ago #5 by TrophiHunter
Thanks, take your time, im very new to this sort of thing but I feel that Rockstar didnt do the tanks hud justice. I plan on making the hz part on the right grab the frame rate in game, also the cannon's fire how it goes from READY to WAIT, most likely on a timer as its the same every time, I also want to make a compass that displays Rotational Degrees North Being 0', and last a display that show the turret orientation, however im not sure if the tank has a bone that is in line with the turret I can Call for rotation, hope so anyway.

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

  • Posts: 790
5 years 2 months ago #6 by Ganossa
So this is how it looks with very little code::


This is the code::
NAMESPACE_ENTER(CFX)

#include CFX_SETTINGS_DEF

texture HudTex	< string source = "ReShade/CustomFX/Textures/CFX_hud.png"; > {Width = 2560; Height = 1440; Format = RGBA8;};
sampler	HudColor 	{ Texture = HudTex; };

float4 PS_Hud(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
	float4 hud = tex2D(HudColor, texcoord);
	return lerp(hud,tex2D(RFX_backbufferColor, texcoord),min(1,2.25f*pow(abs(hud.r+hud.b+hud.g)/3f,50)));
}

technique Hud_Tech <bool enabled = RFX_Start_Enabled; int toggle = RFX_ToggleKey; >
{
	pass HudPass
	{
		VertexShader = RFX_VS_PostProcess;
		PixelShader = PS_Hud;
	}
}

#include CFX_SETTINGS_UNDEF

NAMESPACE_LEAVE()
Create a Hud.h file in /ReShade/CustomFX with that code.
Then open ReShade.fx and add after...
#include EFFECT(CustomFX, Gr8mmFilm)
...the new line...
#include EFFECT(CustomFX, Hud)

I have no photoshop anymore and you alpha is blowing up the .png to 14MB which is way to huge. Therefore, I dropped the alpha and used this .png instead::

It is only 62KB big. Drop it as CFX_hud.png in your /ReShade/CustomFX/Textures folder.

After that you should be able to run the game with that hud :) Its only a few lines so if you can create a smaller .png with alpha it should be easy to adjust :side:
The following user(s) said Thank You: SLAMNDAN, Ederer

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

  • Posts: 17
5 years 2 months ago #7 by TrophiHunter
Wow thank you so much, I can easily use compression, the one I gave was uncompressed, if I compress then I should be ok. thanks again

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

  • Posts: 790
5 years 2 months ago #8 by Ganossa
Can you post that compressed .png, you would need to change a little line in that code :side:

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

  • Posts: 17
5 years 2 months ago #9 by TrophiHunter
Ok just let me know what line of code to change

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

  • Posts: 790
5 years 2 months ago - 5 years 2 months ago #10 by Ganossa
To use alpha, change
return lerp(hud,tex2D(RFX_backbufferColor, texcoord),min(1,2.25f*pow(abs(hud.r+hud.b+hud.g)/3f,50)));
to
return lerp(tex2D(RFX_backbufferColor, texcoord),hud,hud.a);

It is much more accurate but make sure to compress that huge .png file :lol:
The following user(s) said Thank You: SLAMNDAN

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

  • Posts: 17
5 years 2 months ago #11 by TrophiHunter
Here's what I got so far, no post production Tank HUD Beta

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