Doffy Posted March 12, 2020 Share Posted March 12, 2020 Hello , How i can make an a normal image to rounded image in Dx ? From Normal Image Like this : To Link to comment
Simple. Posted March 12, 2020 Share Posted March 12, 2020 On 12/03/2020 at 12:34, Doffy said: Hello , How i can make an a normal image to rounded image in Dx ? From Normal Image Like this : To Expand Check this script There is an example nightly.multitheftauto.com/files/shaders/shader_hud_mask.zip Link to comment
The_GTA Posted March 12, 2020 Share Posted March 12, 2020 I created this shader to create a HUE color circle a few years ago: static const float PI = 3.14159265f; uniform float brightness = 1; // Docu: http://chilliant.blogspot.de/2010/11/rgbhsv-in-hlsl.html float3 HUEtoRGB(in float H) { float R = abs(H * 6 - 3) - 1; float G = 2 - abs(H * 6 - 2); float B = 2 - abs(H * 6 - 4); return saturate(float3(R,G,B)); } float4 circleMain( float2 coord : TEXCOORD0 ) : COLOR0 { float2 off = float2(0.5, 0.5) - coord; // Draw a circle clip(0.25 - (off.x * off.x + off.y * off.y)); float angle = atan2(off.y, off.x) / PI / 2; return float4(brightness - HUEtoRGB(angle < 0 ? angle + 1 : angle) * length(off) * 2 * brightness, 1); } technique colorCircle { pass main { PixelShader = compile ps_2_0 circleMain(); } } You can use the dxDrawImage function in combination with a modified HLSL pixel-shader like above and the dxSetShaderValue function to draw a circle-cropped image. The advantage above masking is that the mask has infinite resolution instead of a fixed PNG file. But you need more knowledge about math for this method. 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