Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SHADER_CODE = [[
- #include "mta-helper.fx"
- #define TAU 6.28318530718
- #define MAX_ITER 6
- sampler Sampler0 : register( s0 );
- struct VSInput
- {
- float4 Position : POSITION0;
- float4 Diffuse : COLOR0;
- float2 TexCoord : TEXCOORD0;
- };
- struct PSInput
- {
- float4 Position : POSITION0;
- float2 TexCoord : TEXCOORD0;
- float4 Diffuse : COLOR0;
- };
- float3 vec3(float x,float y,float z) { return float3(x,y,z); }
- float3 vec3(float x) { return float3(x,x,x); }
- float3 vec3(float2 x,float y) { return float3(float2(x.x,x.y),y); }
- float2 vec2(float x,float y) { return float2(x,y); }
- float2 vec2(float x) { return float2(x,x); }
- PSInput VertexShaderFunction(VSInput VS)
- {
- PSInput PS = (PSInput)0;
- float4 worldPosition = mul(VS.Position, gWorld);
- float4 viewPosition = mul(worldPosition, gView);
- float4 position = mul(viewPosition, gProjection);
- PS.Position = position;
- PS.TexCoord = VS.TexCoord;
- PS.Diffuse = MTACalcGTABuildingDiffuse(VS.Diffuse);
- return PS;
- }
- float4 PixelShaderFunction( PSInput PS ) : COLOR0
- {
- float time = gTime*0.5+23.0;
- float2 uv = PS.TexCoord.xy / 1;
- float2 p = fmod(uv*TAU*2.0, TAU)-250.0;
- float2 i = vec2(p);
- float c = 1.0;
- float inten = 0.005;
- for (int n = 0; n < MAX_ITER; n++)
- {
- float t = time * (1.0 - (3.5 / float(n+1)));
- i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(t + i.x));
- c += 1.0/length(vec2(p.x / (sin(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));
- }
- c /= float(MAX_ITER);
- c = 1.17-pow(c, 1.4);
- float3 colour = vec3(pow(abs(c), 8.0));
- colour = clamp(colour + vec3(0.0, 0.35, 0.5), 0.0, 1.0);
- float4 maincolor = tex2D(Sampler0, PS.TexCoord) * PS.Diffuse;
- return float4(colour, 1.0) * maincolor;
- }
- technique
- {
- pass P0
- {
- AlphaBlendEnable = TRUE;
- VertexShader = compile vs_3_0 VertexShaderFunction();
- PixelShader = compile ps_3_0 PixelShaderFunction();
- }
- }
- ]]
- local shader = DxShader(SHADER_CODE, 0, 3, true, "world,object")
- shader:applyToWorldTexture("*")
- addEventHandler('onClientRender', root, function()
- dxDrawImage(300, 300, 300, 300, shader)
- end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement