DarkStalker30 Posted September 21, 2024 Share Posted September 21, 2024 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
Shady1 Posted September 22, 2024 Share Posted September 22, 2024 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 Link to comment
DarkStalker30 Posted September 22, 2024 Author Share Posted September 22, 2024 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 "*" 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
DarkStalker30 Posted September 26, 2024 Author Share Posted September 26, 2024 Solution: local shader = dxCreateShader("texture.fx", 0, 0, false, "ped") Thanks @IIYAMA for help! 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now