Scripting Moderators sacr1ficez Posted March 21, 2019 Scripting Moderators Share Posted March 21, 2019 Hey, i need some shader for modify player screen colors (more or less faded). Link to comment
Scripting Moderators sacr1ficez Posted March 25, 2019 Author Scripting Moderators Share Posted March 25, 2019 bump Link to comment
Scripting Moderators sacr1ficez Posted March 28, 2019 Author Scripting Moderators Share Posted March 28, 2019 I have found this, it's called grayscale, probably this is what i'm looking for, but i don't know how can i use it. And probably there's no possibility to change intensity of it by script. texture GrayscaleTexture; sampler screenSampler = sampler_state { Texture = <GrayscaleTexture>; }; float4 main(float2 uv : TEXCOORD0) : COLOR0 { float4 Color; Color = tex2D( screenSampler , uv); Color.rgb = round((Color.r+Color.g+Color.b)*10.0f)/30.0f; Color.r=Color.rgb; Color.g=Color.rgb; Color.b=Color.rgb; return Color; }; technique Grayscale { pass P1 { PixelShader = compile ps_2_0 main(); } } Link to comment
XaskeL Posted March 28, 2019 Share Posted March 28, 2019 change color in Color.rgb = round((Color.r+Color.g+Color.b)*10.0f)/30.0f; // gray Color.r=Color.rgb; // here Color.g=Color.rgb; // here Color.b=Color.rgb; // here // example Color.r *= 1.10; // here Color.g *= 1.10; // here Color.b *= 1.10; // here 1 Link to comment
Scripting Moderators sacr1ficez Posted March 28, 2019 Author Scripting Moderators Share Posted March 28, 2019 4 hours ago, XaskeL said: change color in Color.rgb = round((Color.r+Color.g+Color.b)*10.0f)/30.0f; // gray Color.r=Color.rgb; // here Color.g=Color.rgb; // here Color.b=Color.rgb; // here // example Color.r *= 1.10; // here Color.g *= 1.10; // here Color.b *= 1.10; // here Hey, i'm gonna try do it soon, if i could figure out how to use this shader Link to comment
XaskeL Posted March 29, 2019 Share Posted March 29, 2019 (edited) 18 hours ago, majqq said: Эй, я постараюсь сделать это в ближайшее время, если бы я мог понять, как использовать этот шейдер test it client.lua: SHADER_CODE = [[ texture GrayscaleTexture; sampler screenSampler = sampler_state { Texture = <GrayscaleTexture>; }; float4 main(float2 uv : TEXCOORD0) : COLOR0 { float4 Color; Color = tex2D( screenSampler , uv); Color.rgb = round((Color.r+Color.g+Color.b)*10.0f)/30.0f; Color.r=Color.rgb; Color.g=Color.rgb; Color.b=Color.rgb; return Color; }; technique Grayscale { pass P1 { PixelShader = compile ps_2_0 main(); } } ]] local scx,scy = guiGetScreenSize() local screenSource = dxCreateScreenSource(scx,scy) local shader = dxCreateShader(SHADER_CODE) addEventHandler('onClientHUDRender', root, function() dxUpdateScreenSource(screenSource, true) dxSetShaderValue(shader, 'GrayscaleTexture', screenSource) end ); addEventHandler('onClientRender', root, function() dxDrawImage(0,0,scx,scy,screenSource) end ); Edited March 29, 2019 by XaskeL 1 Link to comment
Scripting Moderators sacr1ficez Posted March 30, 2019 Author Scripting Moderators Share Posted March 30, 2019 Solved. 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