Jump to content

Can't apply shader to local player


DarkStalker30

Recommended Posts

Hello everyone, I'm trying to work with shaders. For now it just simple texture replace, but I can't apply it on local player. Other textures change OK.

texture.fx code (simplest):

texture myTexture;

technique ClothesShader
{
    pass P0
    {
        Texture[0] = myTexture;	
	}
}

Client code:

local shader = dxCreateShader("texture.fx")
local texturesTable = {
    [1] = dxCreateTexture("1.png"),
    [2] = dxCreateTexture("2.png"),
    [3] = dxCreateTexture("3.png")
}

addCommandHandler("testclothe", function(_, variant)
    variant = tonumber(variant)
    if variant > 0 and variant < 4 then
        dxSetShaderValue(shader, "myTexture", texturesTable[variant])
        engineApplyShaderToWorldTexture(shader, "*", localPlayer)
    end
end)

No any errors, all files added in meta.xml. As I said before, this code can apply shader to all textures, if delete "localPlayer" from arguments, but it can't apply on player, and I can't understand, why. I readed on wiki "engineApplyShaderToWorldTexture", and saw the recommend of using argument "elementTypes" as "ped" or "all", but if it's the problem, then I don't know, what to put in other arguments (and I think that default value of this argument include "all"). 

If need, can add screenshots, but it only duplicates that text message.

Link to comment
13 hours ago, Shady1 said:

hello, I wanted to send a message related to your problem, first of all, to do this engineApplyShaderToWorldTexture(shader, "elegy1body256")
where it says elegy1body256 you should write the name of the texture to replace,

I will show a screenshot as an example

XuVCVLj.png

"*" applies shader to all textures.

And I already tried this, found name of texture in skin page and wrote it. Didn't work.

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...