Jump to content

Shader apply to texture. [HELP]


xScatta

Recommended Posts

  • MTA Team

Do you want to fuse 2 pictures together?

Make a render target big enough to fit the images.

Get the pixels (result) with dxGetTexturePixels and convert them to a PNG with dxConvertPixels or use the render target to render both images at once.

You can also load an image as texture with the dxCreateTexture function and then also draw the image with the texture.

Link to comment
Hey guys. How can i apply image to texture? I don't mean replacing it cause i know how to do it. I want to apply image to an texture i wan't to choose the opacity or alpha of the texture applied. Thanks. :)

Or how to make rust shader so i can apply it to anything.

If it is a world texture then this might be enough:

http://pastebin.com/CP3Ujccx

This lerps between the original texture and an additional one (by the alpha channel of the additional texture). Use gColorMult to manipulate all the colors and alpha. Manipulating the alpha - sets whether you want to see the original or the additional. You can rescale the texture uv to make it fit.

Link to comment
@Ren_712 thanks that's that what i wanted but there's one problem. I'm not sure how to use it xD

addEventHandler( "onClientResourceStart", resourceRoot, 
    function() 
  
        -- Create shader 
        local myShader, tec = dxCreateShader ( "myshader.fx" ) 
  
        if not myShader then 
            outputChatBox( "Could not create shader. Please use debugscript 3" ) 
        else 
            outputChatBox( "Using technique " .. tec ) 
  
            -- get texture and set dxSetShaderValues 
            local additionalTexture = dxCreateTexture ( "texture.png" ); 
            dxSetShaderValue ( myShader, "gAdditionalTexture", additionalTexture ); 
            dxSetShaderValue ( myShader, "posAdd", 1,1 );  
  
            -- Apply to global txd 
            engineApplyShaderToWorldTexture ( myShader, "myWorldTextureName" ) 
        end 
    end 
) 
  

Like this. Dood - read some wiki, look at the examples. What i post above is supposed to give you some idea.

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