FranklinRoosevelt Posted March 21, 2015 Share Posted March 21, 2015 (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 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 March 22, 2015 by Guest Link to comment
Gallardo9944 Posted March 21, 2015 Share Posted March 21, 2015 At least you made an amazing ghost shader Link to comment
Ren_712 Posted March 22, 2015 Share Posted March 22, 2015 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) Link to comment
FranklinRoosevelt Posted March 22, 2015 Author Share Posted March 22, 2015 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! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now