Jump to content

Search the Community

Showing results for tags 'shader'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

  1. There's a shader and a simple float4x4 array in it. I just want to set the array's values with dxSetShaderValue. How should I do this? float4x4 thisBoneMatrix[6] = { float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), float4x4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) };
  2. I need a function that calculates ped's bone matrices. (bone_attach functions doesn't work) I'm working on a shader that actually can move a ped's bone.
  3. Hello guys, i've seen in some servers that you can change the texture of the same vehicle many times, So you can seen other players having the same vehicle but another texture, I know that i have to use Shader functions but how to do it, And how to make all players able to see other player's vehicle texture ?
  4. --Client local shader = dxCreateShader("tex.fx",0, 0, true, 'ped') addEvent("broadcastEnableShader", true) -- allow remotely triggered (from server) addEventHandler("broadcastEnableShader", root, function(some_data) -- receive broadcast from the server local img = dxCreateTexture(""..math.random(1,3)..".png") dxSetShaderValue(shader, "tex", img) engineApplyShaderToWorldTexture(shader, "Hoodie_green_co",some_data) end ) addEventHandler( 'onClientResourceStart', resourceRoot, function() for _, p in ipairs(getElementsByType('ped')) do if isElementStreamedIn(p) then local clothing = getElementData(p, 'blood') if clothing then triggerServerEvent("announceEnableShader", localPlayer, p) end end end for _, p in ipairs(getElementsByType('player')) do if isElementStreamedIn(p) then local clothing = getElementData(p, 'blood') if clothing then triggerServerEvent("announceEnableShader", localPlayer, p) end end end end) addEventHandler( 'onClientElementStreamIn', root, function() if getElementType(source) == 'player' or getElementType(source) == 'ped' then local clothing = getElementData(source, 'blood') if clothing then triggerServerEvent("announceEnableShader", localPlayer, source) end end end) addEventHandler( 'onClientElementDataChange', root, function(name) if (getElementType(source) == 'player' or getElementType(source) == 'ped') and isElementStreamedIn(source) and name == 'blood' then if getElementData(source, 'blood') then triggerServerEvent("announceEnableShader", localPlayer, source) end end end) --SERVER addEvent("announceEnableShader", true) addEventHandler("announceEnableShader", root, function (some_data) -- triggerClientEvent(root, "broadcastEnableShader", source, some_data) end ) Ita not Synchronization((
  5. Подскажите пожалуйста из-за чего така ошибка со шейдерами
  6. Hello! I have small script that replaces texture with image using shader and scrolls it from left to right. But i would like that there would be more images scrolling, example: coca cola ad, mcdonalds ad, etc... Would it be possible? I'm quite bad with shaders.. Shader: // // Example shader - uv_scroll.fx // /////////////////////////////////////////////////////////////////////////////// //Global variables /////////////////////////////////////////////////////////////////////////////// float gTime : TIME; /////////////////////////////////////////////////////////////////////////////// // Functions /////////////////////////////////////////////////////////////////////////////// //------------------------------------------- // Returns UV anim transform //------------------------------------------- float3x3 getTextureTransform () { float posU = -fmod( gTime/8 ,1 ); // Scroll Right float posV = 0; return float3x3( 1, 0, 0, 0, 1, 0, posU, posV, 1 ); } /////////////////////////////////////////////////////////////////////////////// // Techniques /////////////////////////////////////////////////////////////////////////////// texture Tex0; technique simple { pass P0 { Texture[0] = Tex0; // Set the UV thingy TextureTransform[0] = getTextureTransform (); // Enable UV thingy TextureTransformFlags[0] = Count2; } } Client-sided script: shader = dxCreateShader("shader.fx") coce = dxCreateTexture("bobo_3.png") dxSetShaderValue(shader, "Tex0", coce) engineApplyShaderToWorldTexture( shader, "buymorejeans")
  7. Hello everyone, nothing to say so. LUA: function dxDrawCircle( x, y, width, height, color, angleStart, angleSweep, borderWidth ) height = height or width color = color or tocolor(255,255,255) borderWidth = borderWidth or 1e9 angleStart = angleStart or 0 angleSweep = angleSweep or 360 - angleStart if ( angleSweep < 360 ) then angleEnd = math.fmod( angleStart + angleSweep, 360 ) + 0 else angleStart = 0 angleEnd = 360 end x = x - width / 2 y = y - height / 2 if not circleShader then circleShader = dxCreateShader ( "circle.fx" ) end dxSetShaderValue ( circleShader, "sCircleWidthInPixel", width ); dxSetShaderValue ( circleShader, "sCircleHeightInPixel", height ); dxSetShaderValue ( circleShader, "sBorderWidthInPixel", borderWidth ); dxSetShaderValue ( circleShader, "sAngleStart", math.rad( angleStart ) - math.pi ); dxSetShaderValue ( circleShader, "sAngleEnd", math.rad( angleEnd ) - math.pi ); dxDrawImage( x, y, width, height, circleShader, 0, 0, 0, color, true ) end function dxDrawRoundedRectangle( x, y, width, height, radius, color ) if ( radius >= width ) or ( radius >= height ) then dxDrawCircle( x - ( radius / 2 ), y - ( radius / 2 ) ) end -- The radius is relative to the height and width of the rectangle, so to avoid rectangles if the radius is bigger than the width or height then a complete circle is being drawn. dxDrawCircle( x + ( radius / 2 ), y + ( radius / 2 ), radius, radius, color, 270, 90 ) dxDrawCircle( x + ( radius / 2 ), ( y + height ) - ( radius / 2 ), radius, radius, color, 180, 90 ) dxDrawCircle( ( x + width ) - ( radius / 2 ), y + ( radius / 2 ), radius, radius, color, 0, 90 ) dxDrawCircle( ( x + width ) - ( radius / 2 ), ( y + height ) - ( radius / 2 ), radius, radius, color, 90, 90 ) dxDrawRectangle( x, y + ( radius / 2 ), width, ( height ) - ( radius ), color, true ) dxDrawRectangle( x + ( radius / 2 ), y , ( width ) - ( radius ), ( radius / 2 ), color, true ) dxDrawRectangle( x + ( radius / 2 ), ( y + height ) - ( radius / 2 ), ( width ) - ( radius ), ( radius / 2 ), color, true ) end CIRCLE.FX ( The one from the MTA Wiki ) float sCircleHeightInPixel = 100; float sCircleWidthInPixel = 100; float sBorderWidthInPixel = 10; float sAngleStart = -3.14; float sAngleEnd = 3.14; //------------------------------------------------------------------------------------------ // PixelShaderFunction // 1. Read from PS structure // 2. Process // 3. Return pixel color //------------------------------------------------------------------------------------------ float4 PixelShaderFunction(float4 Diffuse : COLOR0, float2 TexCoord : TEXCOORD0) : COLOR0 { float2 uv = float2( TexCoord.x, TexCoord.y ) - float2( 0.5, 0.5 ); // Clip unwanted pixels from partial pie float angle = atan2( -uv.x, uv.y ); // -PI to +PI if ( sAngleStart > sAngleEnd ) { if ( angle < sAngleStart && angle > sAngleEnd ) return 0; } else { if ( angle < sAngleStart || angle > sAngleEnd ) return 0; } // Calc border width to use float2 vec = normalize( uv ); float CircleRadiusInPixel = lerp( sCircleWidthInPixel, sCircleHeightInPixel, vec.y * vec.y ); float borderWidth = sBorderWidthInPixel / CircleRadiusInPixel; // Check if pixel is inside circle float dist = sqrt( dot( uv, uv ) ); if ( ( dist > 0.5 ) || ( dist < 0.5 - borderWidth ) ) return 0; else return Diffuse; } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique tec0 { pass P0 { PixelShader = compile ps_2_0 PixelShaderFunction(); } }
  8. Добрый день, использую шейдер color.fx & mta-helper.fx для смены цвета текстуры, одежды персонажа. В шейдерах полный нуль, использовал урок от Kernel. Так вот, какая проблема. Мне необходимо помимо перекраски, накладывать ещё одну текстуру сверху (картинку), если я её накладываю, то в определённых местах мира (в интерьерах с заменами текстур) появляется мерцание этой самой картинки. Если я отключаю mta-helper - мерцания нет, однако тогда текстура слишком яркая, что мне тоже не подходит. Нужна помощь, как исправить мерцание? #include "mta-helper.fx" float4 color = 1; sampler Sampler0 : register( s0 ); struct VSInput { float4 Position : POSITION0; float3 Normal : NORMAL0; float4 Diffuse : COLOR0; float2 TexCoord : TEXCOORD0; }; struct PSInput { float4 Position : POSITION0; float2 TexCoord : TEXCOORD0; float4 Diffuse : COLOR0; }; 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 = MTACalcGTAVehicleDiffuse( VS.Normal, VS.Diffuse ); return PS; } float4 PixelShaderFunction( PSInput PS ) : COLOR0 { float4 texColor = tex2D( Sampler0, PS.TexCoord ); texColor *= PS.Diffuse * color; return texColor; } technique { pass P0 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } }
  9. so there is this server called Grafuroam and it has a specific hydra skin for specific clan and not the same one for all clans and also everyone can SEE the texture i just want to know how to do this
  10. Всем привет, мб кто нибудь шарит в шейдерах. Вопрос следующего характера, необходимо покрасить наложенные на автомобиль четыре обьекта (колёса кастомные). Название текстуры у меня "body_k", написал саму систему, шейдер и при этом шейдер не очень хорошо понимает RGBA палитру. Только радикальные цвета будь то: 0,255,255,255; 255,0,0,255; 255,0,255 и т.д. При цвете например 75,0,255,255 выдает оттенок максимальный по заданым критериям, т.е. 255,0,255,255... Вот скриншот того, что пытаюсь реализовать:http://www.fotolink.su/pic_b/c03627c7d8665128f9c5ec7ecaf65c60.png (Не могу прикрепить почему-то изображение) Код шейдера: float4 gColor = float4(1,1,1,1); bool bIsGTADiffuse = true; //--------------------------------------------------------------------- // Include some common stuff //--------------------------------------------------------------------- #include "mta-helper.fx" //--------------------------------------------------------------------- // Sampler for the main texture //--------------------------------------------------------------------- sampler Sampler0 = sampler_state { Texture = (gTexture0); }; //--------------------------------------------------------------------- // Structure of data sent to the vertex shader //--------------------------------------------------------------------- struct VSInput { float3 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoord : TEXCOORD0; }; //--------------------------------------------------------------------- // Structure of data sent to the pixel shader ( from the vertex shader ) //--------------------------------------------------------------------- struct PSInput { float4 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoord : TEXCOORD0; }; //------------------------------------------------------------------------------------------ // VertexShaderFunction // 1. Read from VS structure // 2. Process // 3. Write to PS structure //------------------------------------------------------------------------------------------ PSInput VertexShaderFunction(VSInput VS) { PSInput PS = (PSInput)0; // Calculate screen pos of vertex PS.Position = MTACalcScreenPosition ( VS.Position ); // Pass through tex coord PS.TexCoord = VS.TexCoord; // Calculate GTA lighting for buildings float4 Diffuse = MTACalcGTABuildingDiffuse( VS.Diffuse ); PS.Diffuse = 0; if (bIsGTADiffuse) PS.Diffuse = Diffuse; else PS.Diffuse = float4(1,1,1,Diffuse.a); PS.Diffuse *= gColor; return PS; } //------------------------------------------------------------------------------------------ // PixelShaderFunction // 1. Read from PS structure // 2. Process // 3. Return pixel color //------------------------------------------------------------------------------------------ float4 PixelShaderFunction(PSInput PS) : COLOR0 { // Get texture pixel float4 texel = tex2D(Sampler0, PS.TexCoord); // Apply diffuse lighting float4 finalColor = texel * PS.Diffuse; return finalColor; } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique colorize { pass P0 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } // Fallback technique fallback { pass P0 { // Just draw normally } } Код наложение цвета, через шейдерную обработку на одно из колёс транспортного средства: local colorShader = dxCreateShader("shader.fx") local _, _, _, wheelsColorR, wheelsColorG, wheelsColorB = getVehicleColor(source, true) outputChatBox("#FFFFFFColor: R"..wheelsColorR.." G"..wheelsColorG.." B"..wheelsColorB, 0, 0, 0, true) local wheelsColor = {wheelsColorR, wheelsColorG, wheelsColorB, 255} dxSetShaderValue(colorShader, "gColor", wheelsColor) engineApplyShaderToWorldTexture(colorShader, "body_k", car_wheels[carID][1]) Need help!
  11. Im trying to use ultra thing mod, but it doesn't work anymore, i think it worked before, but now it only works with normal GTA SA.exe i have the mod files in the GTA directory, and mta warns me about d3d9.dll file, but i press continue and no mod works... what could be the problem?
  12. Hi, MTA Community I searched for a few days a shader to make shadows in MTA but i didnt found it and now i want to pay for it (if someone have another graphics shader i can buy it too) just leave pictures and send me a pm Payment method: -Paypal -Bitcoin Thanks and have a good day
  13. Skin Shader from player can not see the other players, how to synchronize Shader Skin on the player saw the other players?
  14. problem, did Shader skin player, but it only sees the player who entered the command, or only those who have the same skin. other players who did not enter and command them not to be schöder How to make that it was visible Shader .
  15. Is there a way to morph a part of an object with a shader like pedmorph? So I don't want to morph the whole model, just a part of it. (Like a ped's head, or something)
  16. I just want to make shadows in MTA, like in this video: (at 2:33) There is a dynamic light shader with shadows, but it has so many bugs.
  17. How can i just apply the same shader to the same texture twice? I want to make a car vinyl system, but the last shader i've created overwrites the others. Any idea?
  18. Hi! I just searched for lighting effects, and i found a shader for XNA. Its an Ambient and Diffuse lighting shader with Shadow Maps: #define GENERATE_NORMALS #include "mta-helper.fx" //------------------------------------------------------------------------------ // File: BasicRender.fx // // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // Global variables //------------------------------------------------------------------------------ float4 g_MaterialAmbientColor = {0.05f, 0.05f, 0.05f, 0.05f}; // Material's ambient color float4 g_MaterialDiffuseColor = {0.75f, 0.75f, 0.75f, 0.75f}; // Material's diffuse color float3 g_LightPos = {1000, 2000, 1000}; // Position of light float3 g_LightDir = {0, 0, 0}; // Direction of light (temp) float4x4 g_mLightView; // View matrix of light float4x4 g_mLightProj; // Projection matrix of light float4 g_LightDiffuse = {0.75f, 0.75f, 0.75f, 0.75f}; // Light's diffuse color float4 g_LightAmbient = {0.05f, 0.05f, 0.05f, 0.05f}; // Light's ambient color texture g_MeshTexture; // Color texture for mesh texture g_ShadowMapTexture; // Shadow map texture for lighting float4x4 g_mWorld; // World matrix for object float3 g_CameraPos; // Camera position for scene View float4x4 g_mCameraView; // Camera's view matrix float4x4 g_mCameraProj; // Projection matrix //------------------------------------------------------------------------------ // Texture samplers //------------------------------------------------------------------------------ sampler MeshTextureSampler = sampler_state { Texture = (gTexture0); MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; }; sampler ShadowMapSampler = sampler_state { Texture = <g_ShadowMapTexture>; MinFilter = POINT; MagFilter = POINT; MipFilter = POINT; AddressU = Clamp; AddressV = Clamp; }; //------------------------------------------------------------------------------ // Vertex shader output structure //------------------------------------------------------------------------------ struct VS_OUTPUT { float4 Position : POSITION0; // vertex position float2 TextureUV : TEXCOORD0; // vertex texture coords float3 vNormal : TEXCOORD1; float4 vPos : TEXCOORD2; }; struct PS_INPUT { float2 TextureUV : TEXCOORD0; // vertex texture coords float3 vNormal : TEXCOORD1; float4 vPos : TEXCOORD2; }; struct VS_SHADOW_OUTPUT { float4 Position : POSITION; float Depth : TEXCOORD0; }; //------------------------------------------------------------------------------ // Utility function(s) //------------------------------------------------------------------------------ float4x4 CreateLookAt(float3 gView, float3 gProjection, float3 up) { float3 zaxis = normalize(gView - gProjection); float3 xaxis = normalize(cross(up, zaxis)); float3 yaxis = cross(zaxis, xaxis); float4x4 view = { xaxis.x, yaxis.x, zaxis.x, 0, xaxis.y, yaxis.y, zaxis.y, 0, xaxis.z, yaxis.z, zaxis.z, 0, -dot(xaxis, gView), -dot(yaxis, gView), -dot(zaxis, gView), 1 }; return view; } float4 GetPositionFromLight(float4 position) { float4x4 WorldViewProjection = mul(mul(gWorld, gLightDiffuse), gLightDirection); return mul(position, WorldViewProjection); } //------------------------------------------------------------------------------ // This shader computes rudimentary transform and lighting. // The XNA VertexDeclaration of our models is PositionNormalTexture. //------------------------------------------------------------------------------ VS_OUTPUT RenderShadowsVS( float3 position : POSITION, float3 normal : NORMAL, float2 vTexCoord0 : TEXCOORD0 ) { VS_OUTPUT Output; //generate the world-view-projection matrix float4x4 wvp = mul(mul(gWorld, gView), gProjection); //transform the input position to the output Output.Position = mul(float4(position, 1.0), wvp); //transform the normal to world space Output.vNormal = mul(normal, gWorld); //do not transform the position needed for the //shadow map determination Output.vPos = float4(position,1.0); //pass the texture coordinate as-is Output.TextureUV = vTexCoord0; //return the output structure return Output; } VS_SHADOW_OUTPUT RenderShadowMapVS(float4 vPos: POSITION) { VS_SHADOW_OUTPUT Out; Out.Position = GetPositionFromLight(vPos); // Depth is Z/W. This is returned by the pixel shader. // Subtracting from 1 gives us more precision in floating point. Out.Depth.x = 1-(Out.Position.z/Out.Position.w); return Out; } //------------------------------------------------------------------------------ // Pixel shader output structure //------------------------------------------------------------------------------ struct PS_OUTPUT { float4 RGBColor : COLOR0; // Pixel color }; //------------------------------------------------------------------------------ // This shader outputs the pixel's color by modulating the texture's // color with diffuse material color //------------------------------------------------------------------------------ PS_OUTPUT RenderShadowsPS( PS_INPUT In ) { PS_OUTPUT Output; // Standard lighting equation float4 vTotalLightDiffuse = float4(0.1f,0.1f,0.1f,0.1f); float3 lightDir = normalize(g_LightPos+In.vPos); // direction of light vTotalLightDiffuse += g_LightDiffuse * max(0,dot(In.vNormal, lightDir)); vTotalLightDiffuse.a = 0.5f; // Now, consult the ShadowMap to see if we're in shadow float4 lightingPosition = GetPositionFromLight(In.vPos);// Get our position on the shadow map // Get the shadow map depth value for this pixel float2 ShadowTexC = 0.5 * lightingPosition.xy / lightingPosition.w + float2( 0.5, 0.5 ); ShadowTexC.y = 1.0f - ShadowTexC.y; float shadowdepth = tex2D(ShadowMapSampler, ShadowTexC).r; // Check our value against the depth value float ourdepth = 1 + (lightingPosition.z / lightingPosition.w); // Check the shadowdepth against the depth of this pixel // a fudge factor is added to account for floating-point error if (shadowdepth-0.03 > ourdepth) { // we're in shadow, cut the light vTotalLightDiffuse = float4(0,0,0,1); }; Output.RGBColor = tex2D(MeshTextureSampler, In.TextureUV) * (vTotalLightDiffuse + g_LightAmbient); return Output; } PS_OUTPUT DiffuseOnlyPS(VS_OUTPUT In) : COLOR { PS_OUTPUT Output; //calculate per-pixel diffuse float3 directionToLight = normalize(g_LightPos - In.vPos); float diffuseIntensity = saturate( dot(directionToLight, In.vNormal)); float4 diffuse = g_LightDiffuse * diffuseIntensity; float4 color = diffuse + g_LightAmbient; color.a = 0.0; Output.RGBColor = tex2D(MeshTextureSampler, In.TextureUV) * color; return Output; } PS_OUTPUT TextureOnlyPS(float2 TextureUV : TEXCOORD0) : COLOR { PS_OUTPUT Output; Output.RGBColor = tex2D(MeshTextureSampler, TextureUV); return Output; } float4 RenderShadowMapPS( VS_SHADOW_OUTPUT In ) : COLOR { // The depth is Z divided by W. We return // this value entirely in a 32-bit red channel // using SurfaceFormat.Single. This preserves the // floating-point data for finer detail. return float4(In.Depth.x,0,0,1); } //------------------------------------------------------------------------------ // Renders scene to render target //------------------------------------------------------------------------------ technique TextureRender { pass P0 { VertexShader = compile vs_2_0 RenderShadowsVS(); PixelShader = compile ps_2_0 TextureOnlyPS(); } pass P1 { VertexShader = compile vs_2_0 RenderShadowsVS(); PixelShader = compile ps_2_0 RenderShadowsPS(); } pass P2 { // These render states are necessary to get a shadow map. // You should consider resetting CullMode and AlphaBlendEnable // before you render your main scene. CullMode = CW; ZEnable = TRUE; ZWriteEnable = TRUE; AlphaBlendEnable = TRUE; VertexShader = compile vs_2_0 RenderShadowMapVS(); PixelShader = compile ps_2_0 RenderShadowMapPS(); } } This is not the original .fx file, i configured it for MTA. The diffuse and the ambient light works correctly, but not generating shadows. Any Idea?
  19. Hey folks, i know i can change textures with a shader. But can i replace model? And dont say to use replace dff function, it has to be with a shader.
  20. Good afternoon. Sorry for my English. How to replace texture of skin at a certain player? Suppose there are two players with the same skins. But one light hair color, other dark.
×
×
  • Create New...