GenerateShader ignoring given Alpha

DavidRO99

Active member
Joined
Nov 5, 2017
Messages
60
Reaction score
8
Hello.

I have another problem in my adventure to creating Chams. So, I want to make the chams using shaders, but I want to make them a bit transparent, so I can still see the original actor texture behind the drawn chams.

Here is my GenerateShader function (pretty much pasted from mod_sa):
Code:
HRESULT GenerateShader(IDirect3DDevice9 *Device, IDirect3DPixelShader9 **pShader, float alpha, float red, float green,
	float blue)
{
	char		szShader[256];
	ID3DXBuffer *pShaderBuffer = NULL;
	sprintf_s(szShader, sizeof(szShader), "ps.1.1\ndef c0, %f, %f, %f, %f\nmov r0,c0", red, green, blue, alpha);
	if (FAILED(D3DXAssembleShader(szShader, sizeof(szShader), NULL, NULL, 0, &pShaderBuffer, NULL)))
	{
		return E_FAIL;
	}

	if (FAILED(Device->CreatePixelShader((const DWORD *)pShaderBuffer->GetBufferPointer(), pShader)))
	{
		return E_FAIL;
	}

	return S_OK;
}
I, as last time, am sure that my DIP hook works perfectly, as the colors do actually get set, its just that the transparency is ignored. Here is the way I set the shaders:
Code:
GenerateShader(Device, &chams_green, 0.0001f, 0.f, 1.f, 0.f);
And then I set the pixel shader using
Code:
Device->SetPixelShader(chams_green);
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
https://msdn.microsoft.com/ru-ru/library/windows/desktop/bb172252(v=vs.85).aspx
https://msdn.microsoft.com/ru-ru/library/windows/desktop/bb172255(v=vs.85).aspx

This is probably what you are looking for
 

DavidRO99

Active member
Joined
Nov 5, 2017
Messages
60
Reaction score
8
I forgot to update, I got transparency working by using "Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);", but I now cant see anything behind the transparency, for example any cars behind the ped disappear. @supahdupahnubah
 

user88

Well-known member
Joined
Jun 29, 2017
Messages
426
Reaction score
165
Location
LINK CLEO DICE HACK HERE!
ZHFY7gJmT0aOi2anXwkQqA.png

like this?
 

user88

Well-known member
Joined
Jun 29, 2017
Messages
426
Reaction score
165
Location
LINK CLEO DICE HACK HERE!
i upgraded to a csgo style like this:

https://i.imgur.com/x15iq1p.png

and my gta thing looks like this
https://imgur.com/XYPIG0B
 

Bombic

Member
Joined
Jun 11, 2018
Messages
9
Reaction score
0
user88 said:
i upgraded to a csgo style like this:

https://i.imgur.com/x15iq1p.png

and my gta thing looks like this
https://imgur.com/XYPIG0B

Give us too. :motherofgod:
 
Top