Jump to content

Shader bug.


Recommended Posts

Posted (edited)

Hello guys, i experimented with shader and find incorrect work in skins.

I have transparent shader which makes texture invisible, it work in all texture except for skins.

I think problem is in model, because I replace standart object on skin and it doesn't work.

Screen: Screen1 Screen2

44c0a76c20ab32da8e9c256a3c9026f2.pngc20eb48cf9c928b2e6859a645470e42e.png

Shader:

struct PSInput 
{ 
    float4 Diffuse      : COLOR0; 
}; 
  
float4 PixelShaderFunction( PSInput PS ) : COLOR0 
{ 
    float4 color = PS.Diffuse; 
    
    color.a = 0; 
    
    return color; 
} 
  
technique 
{ 
    pass p0 
    { 
        AlphaBlendEnable    = TRUE; 
        DestBlend           = INVSRCALPHA; 
        SrcBlend            = SRCALPHA; 
        PixelShader         = compile ps_2_0 PixelShaderFunction(); 
    } 
} 

Script:

addEventHandler( "onClientResourceStart", resourceRoot, 
    function() 
        local myShader, tec = dxCreateShader ( "transparency.fx", 1, 0, false, "all" ) 
        if myShader then 
            engineApplyShaderToWorldTexture ( myShader, 'omokung' ) -- omokung - texture ped in screen 
        else 
            outputChatBox('Error with create shader') 
        end 
    end 
) 
  

Meta:

<meta> 
    <script src="shader.lua" type="client" /> 
    <file src="transparency.fx" type="client" /> 
</meta> 

Kernell suggests that the problem is in z-buffer. How to fix this? Thanks!

Edited by Guest
Posted

If you want to change ped alpha using shaders you'll have to change it's rendering order. To make it render after world objects - you'll need to lower it's alpha. The solution: setElementAlpha(localPlayer,254)

Posted
If you want to change ped alpha using shaders you'll have to change it's rendering order. To make it render after world objects - you'll need to lower it's alpha. The solution: setElementAlpha(localPlayer,254)

Thank you very much man!

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