Jump to content

help Texture


Mr.DeViLsS

Recommended Posts

function skins ( commandName )
    -- cj_ped_head


    local textSkin = dxCreateTexture ( "img.png" )

    local skin = dxCreateShader( "tex_names.fx", 0, 0, true, "ped" ) 
    
    engineApplyShaderToWorldTexture ( skin, "cj_ped_head", localPlayer ); 

    dxSetShaderValue ( skin, "texure0", textSkin )


end    
addCommandHandler ( "cSkin", skins )

 

 

Shader:

//
// tex_names.fx
//

float Time : TIME;

// Make everything all flashy!
float4 GetColor()
{
    return float4( cos(Time*10), cos(Time*7), cos(Time*4), 1 );
}

//-----------------------------------------------------------------------------
// Techniques
//-----------------------------------------------------------------------------
technique tec0
{
    pass P0
    {
        MaterialAmbient = GetColor();
        MaterialDiffuse = GetColor();
        MaterialEmissive = GetColor();
        MaterialSpecular = GetColor();

        AmbientMaterialSource = Material;
        DiffuseMaterialSource = Material;
        EmissiveMaterialSource = Material;
        SpecularMaterialSource = Material;

        ColorOp[0] = SELECTARG1;
        ColorArg1[0] = Diffuse;

        AlphaOp[0] = SELECTARG1;
        AlphaArg1[0] = Diffuse;

        Lighting = true;
    }
}



Please tell me, why not replace the texture?

Result: https://imgur.com/a/vciyC

Texture: https://imgur.com/a/VCcbO

Edited by Mr.DeViLsS
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...