Jump to content

bover

Members
  • Posts

    17
  • Joined

  • Last visited

Details

  • Gang
    Grove Street
  • Location
    Olsztyn
  • Occupation
    street fighter

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

bover's Achievements

Square

Square (6/54)

1

Reputation

  1. image.png

     

    3 days to 1 month from appeal and still no respond

  2. bover

    dxImage

    Oh, my bad. Didn't think about this
  3. bover

    dxImage

    Better to remove event handler while not using. Also watch out for a pyramids if and else local isRendering function renderImage() dxDrawImage(...) end function bindKey() isRendering = not isRendering if (isRendering) then addEventHandler('onClientRender', root, renderImage) return true end removeEventHandler('onClientRender', root, renderImage) end bindKey('o', 'down', bindKey)
  4. Hi, im using hudmask shader from https://wiki.multitheftauto.com/wiki/Shader_examples, also have a blur shader that i found somewhere on internet. I want to join those both shaders to make a shader that blurs screen source and clamp that on mask that i provide. Already connected both shaders, blur works but mask not. I were trying a lot of things but I'm not specialist of HLSL. Anyone can help? Shader: #include "tex_matrix.fx" texture screenSource; texture maskTexture; float factor; float2 gUVPrePosition = float2( 0, 0 ); float2 gUVScale = float( 1 ); float2 gUVScaleCenter = float2( 0.5, 0.5 ); float gUVRotAngle = float( 0 ); float2 gUVRotCenter = float2( 0.5, 0.5 ); float2 gUVPosition = float2( 0, 0 ); float3x3 getTextureTransform() { return makeTextureTransform(gUVPrePosition, gUVScale, gUVScaleCenter, gUVRotAngle, gUVRotCenter, gUVPosition); }; sampler Sampler0 = sampler_state { Texture = screenSource; AddressU = Clamp; AddressV = Clamp; }; struct PSInput { float2 TexCoord : TEXCOORD0; }; float4 PixelShader_Background(PSInput PS) : COLOR0 { float4 sum = tex2D(Sampler0, PS.TexCoord); for (float i = 1; i < 3; i++) { sum += tex2D(Sampler0, float2(PS.TexCoord.x, PS.TexCoord.y + (i * factor))); sum += tex2D(Sampler0, float2(PS.TexCoord.x, PS.TexCoord.y - (i * factor))); sum += tex2D(Sampler0, float2(PS.TexCoord.x - (i * factor), PS.TexCoord.y)); sum += tex2D(Sampler0, float2(PS.TexCoord.x + (i * factor), PS.TexCoord.y)); } sum /= 9; sum.a = 1.0; return sum; } technique complercated { pass P0 { PixelShader = compile ps_2_0 PixelShader_Background(); } } technique simple { pass P0 { Texture[0] = screenSource; TextureTransform[0] = getTextureTransform(); TextureTransformFlags[0] = Count2; AddressU[0] = Clamp; AddressV[0] = Clamp; ColorOp[0] = Modulate; ColorArg1[0] = Texture; ColorArg2[0] = Diffuse; AlphaOp[0] = Modulate; AlphaArg1[0] = Texture; AlphaArg2[0] = Diffuse; Texture[1] = maskTexture; TexCoordIndex[1] = 0; AddressU[1] = Clamp; AddressV[1] = Clamp; ColorOp[1] = SelectArg1; ColorArg1[1] = Current; AlphaOp[1] = Modulate; AlphaArg1[1] = Current; AlphaArg2[1] = Texture; ColorOp[2] = Disable; AlphaOp[2] = Disable; } } tex_matrix.fx: // // tex_matrix.fx // //------------------------------------------- // Returns a translation matrix //------------------------------------------- float3x3 makeTranslationMatrix ( float2 pos ) { return float3x3( 1, 0, 0, 0, 1, 0, pos.x, pos.y, 1 ); } //------------------------------------------- // Returns a rotation matrix //------------------------------------------- float3x3 makeRotationMatrix ( float angle ) { float s = sin(angle); float c = cos(angle); return float3x3( c, s, 0, -s, c, 0, 0, 0, 1 ); } //------------------------------------------- // Returns a scale matrix //------------------------------------------- float3x3 makeScaleMatrix ( float2 scale ) { return float3x3( scale.x, 0, 0, 0, scale.y, 0, 0, 0, 1 ); } //------------------------------------------- // Returns a combined matrix of doom //------------------------------------------- float3x3 makeTextureTransform ( float2 prePosition, float2 scale, float2 scaleCenter, float rotAngle, float2 rotCenter, float2 postPosition ) { float3x3 matPrePosition = makeTranslationMatrix( prePosition ); float3x3 matToScaleCen = makeTranslationMatrix( -scaleCenter ); float3x3 matScale = makeScaleMatrix( scale ); float3x3 matFromScaleCen = makeTranslationMatrix( scaleCenter ); float3x3 matToRotCen = makeTranslationMatrix( -rotCenter ); float3x3 matRot = makeRotationMatrix( rotAngle ); float3x3 matFromRotCen = makeTranslationMatrix( rotCenter ); float3x3 matPostPosition = makeTranslationMatrix( postPosition ); float3x3 result = mul( mul( mul( mul( mul( mul( mul( matPrePosition ,matToScaleCen) ,matScale) ,matFromScaleCen) ,matToRotCen) ,matRot) ,matFromRotCen) ,matPostPosition) ; return result; } Shader usage: local screenSource = dxCreateScreenSource(1920, 1080) local shader = dxCreateShader("blurMask.fx") local texture = dxCreateTexture("panel.png") local renderTarget = dxCreateRenderTarget(539, 539, true) dxSetShaderValue(shader, 'screenSource', screenSource) dxSetShaderValue(shader, 'factor', 0.007) dxSetShaderValue(shader, 'maskTexture', texture) function renderScreen() dxUpdateScreenSource(screenSource) dxSetRenderTarget(renderTarget, true) dxDrawImage(-(1920/2-(539/2)), -(1080/2-(539/2)), 1920, 1080, screenSource) dxSetRenderTarget() dxDrawImage(0, 0, 539, 539, texture) dxSetShaderValue(shader, 'screenSource', renderTarget) for intensity = 0, 4 do dxSetShaderValue(shader, 'factor', 0.0080 * 1 + (intensity / 4 * 0.001 * 1)); end dxDrawImage(1920/2-(539/2), 1080/2-(539/2), 539, 539, shader) end addEventHandler('onClientRender', root, renderScreen) Effect I've got: Expected effect should mask the blur for a texture i provide (this circle that is rendered on the left top side of screen)
  5. bover

    ripple effect

    okay i did it, topic can be closed
  6. bover

    ripple effect

    i don't use cegui, i want to do it on dx functions
  7. bover

    ripple effect

    question is still active
  8. bover

    ripple effect

    hi, how can i do a ripple effect on buttons? i have seen resource for it but its deleted ;/
×
×
  • Create New...