shader.fx:
//-- Declare the texture. These are set using dxSetShaderValue( shader, "Tex0", texture )
texture Tex0;
technique simple
{
pass P0
{
//-- Set up texture stage 0
Texture[0] = Tex0;
//-- Leave the rest of the states to the default settings
}
}
some client LUA code:
function applyShader ( )
local shader = dxCreateShader ( "shader.fx" ); -- creating shader
local texture = dxCreateTexture ( "someimage.png" ); -- creating texture from image
if ( shader and texture ) then -- checking if everything is okay
dxSetShaderValue ( shader, "Tex0", texture ); -- applying texture to shader
setElementModel ( localPlayer, 0 ); -- setting CJ skin to player
engineApplyShaderToWorldTexture ( shader, "cj_ped_torso", localPlayer ); -- applying shader to CJ's torse for player who used command
end
end
addCommandHandler ( "applyshader", applyShader ); -- creating command /applyshader to applyShader function.