Jump to content

Shader apply to texture. [HELP]


xScatta

Recommended Posts

Posted

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.

It's fine to celebrate success but it is more important to heed the lessons of failure.

  • MTA Team
Posted

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.

Posted

No no. I wan't to apply an image .png to a texture in MTA:SA but not completely replace it, just apply it so two textures will be visible. Like that:

applying image texture = :

actual ingame texture = I

:I

It's fine to celebrate success but it is more important to heed the lessons of failure.

Posted

I want to lay a .png so it will be applied to the MTA texture, So the mta texture will be visible UNDER the transparent places of the image applied :)

It's fine to celebrate success but it is more important to heed the lessons of failure.

Posted

Are you looking to make something like a dynamic texture? Similar to this?

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

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

I make shaders .. mainly. My community resources

I'll do some custom stuff, I'm open for cooperation.

Posted

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

It's fine to celebrate success but it is more important to heed the lessons of failure.

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

I make shaders .. mainly. My community resources

I'll do some custom stuff, I'm open for cooperation.

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