Jump to content

Can't apply shader only to one specific effect


roDaN

Recommended Posts

Hello, as the title says I am not able to set a shader for the gunshot effect. Seems like this is impossible to replace because ant other effect I'm trying to replace works.

Lua code:

theTechnique = dxCreateShader("shader.fx")
explosionTexture = dxCreateTexture( "texture.png")

function replaceEffect()
	engineApplyShaderToWorldTexture(theTechnique, "muzzle_texture4") -- also tried "gunflash"
	dxSetShaderValue (theTechnique, "gTexture", explosionTexture)
end
addEventHandler("onClientResourceStart",resourceRoot,replaceEffect)

Shader code:

texture gTexture;

technique TexReplace
{
    pass P0
    {
        Texture[0] = gTexture;
    }
}

 

EDIT:

Actually seems like I am very wrong, the texture applied to the effect should be made for it.

But how can I do it ?

Edited by roDaN
Revelation, lmao
Link to comment
2 hours ago, Burak5312 said:

i tested now it uses texture named "sphere" but they use fxp files to create the effect I'm not sure you can do this in mta but you can find them in "effects.fxp" file

Thank you for your answer but there are a lot of examples/resources that work, seems like there might be some requirement for the texture applied with shader.

Link to comment
7 hours ago, Dzsozi (h03) said:

Try muzzle_texture* instead of muzzle_texture4

engineApplyShaderToWorldTexture(theTechnique, "muzzle_texture*")

Thanks for your response, but still no luck with your method. 

My final goal was reached, but I would still like to know what is the problem with replacing this texture.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...