From f5c4671bfbad96bf346bd7e9a21fc4317b4959df Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Sat, 3 Dec 2022 17:00:20 +0530 Subject: Adds most of the tools --- .../plugins/Milkdrop2/data/blur1_ps.fx | 59 ++++++++ .../plugins/Milkdrop2/data/blur2_ps.fx | 61 ++++++++ .../plugins/Milkdrop2/data/blur_vs.fx | 10 ++ .../plugins/Milkdrop2/data/comp_ps.fx | 14 ++ .../plugins/Milkdrop2/data/comp_vs.fx | 14 ++ .../plugins/Milkdrop2/data/include.fx | 155 +++++++++++++++++++++ .../plugins/Milkdrop2/data/warp_ps.fx | 18 +++ .../plugins/Milkdrop2/data/warp_vs.fx | 14 ++ 8 files changed, 345 insertions(+) create mode 100644 musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur1_ps.fx create mode 100644 musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur2_ps.fx create mode 100644 musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur_vs.fx create mode 100644 musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/comp_ps.fx create mode 100644 musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/comp_vs.fx create mode 100644 musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/include.fx create mode 100644 musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/warp_ps.fx create mode 100644 musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/warp_vs.fx (limited to 'musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data') diff --git a/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur1_ps.fx b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur1_ps.fx new file mode 100644 index 0000000..9ab02c9 --- /dev/null +++ b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur1_ps.fx @@ -0,0 +1,59 @@ +//texture PrevFrameImage; +//sampler2D sampler_main = sampler_state { Texture = ; }; +//float4 _c0; // source texsize (.xy), and inverse (.zw) +//float4 _c1; // w1..w4 +//float4 _c2; // d1..d4 +//float4 _c3; // scale, bias, w_div + + + + +void PS( float2 uv : TEXCOORD, + out float4 ret : COLOR0 ) +{ + // LONG HORIZ. PASS 1: + //const float w[8] = { 4.0, 3.8, 3.5, 2.9, 1.9, 1.2, 0.7, 0.3 }; <- user can specify these + //const float w1 = w[0] + w[1]; + //const float w2 = w[2] + w[3]; + //const float w3 = w[4] + w[5]; + //const float w4 = w[6] + w[7]; + //const float d1 = 0 + 2*w[1]/w1; + //const float d2 = 2 + 2*w[3]/w2; + //const float d3 = 4 + 2*w[5]/w3; + //const float d4 = 6 + 2*w[7]/w4; + //const float w_div = 0.5/(w1+w2+w3+w4); + #define srctexsize _c0 + #define w1 _c1.x + #define w2 _c1.y + #define w3 _c1.z + #define w4 _c1.w + #define d1 _c2.x + #define d2 _c2.y + #define d3 _c2.z + #define d4 _c2.w + #define fscale _c3.x + #define fbias _c3.y + #define w_div _c3.z + + // note: if you just take one sample at exactly uv.xy, you get an avg of 4 pixels. + //float2 uv2 = uv.xy;// + srctexsize.zw*float2(0.5,0.5); + float2 uv2 = uv.xy + srctexsize.zw*float2(1,1); // + moves blur UP, LEFT by 1-pixel increments + + float3 blur = + ( tex2D( sampler_main, uv2 + float2( d1*srctexsize.z,0) ).xyz + + tex2D( sampler_main, uv2 + float2(-d1*srctexsize.z,0) ).xyz)*w1 + + ( tex2D( sampler_main, uv2 + float2( d2*srctexsize.z,0) ).xyz + + tex2D( sampler_main, uv2 + float2(-d2*srctexsize.z,0) ).xyz)*w2 + + ( tex2D( sampler_main, uv2 + float2( d3*srctexsize.z,0) ).xyz + + tex2D( sampler_main, uv2 + float2(-d3*srctexsize.z,0) ).xyz)*w3 + + ( tex2D( sampler_main, uv2 + float2( d4*srctexsize.z,0) ).xyz + + tex2D( sampler_main, uv2 + float2(-d4*srctexsize.z,0) ).xyz)*w4 + ; + blur.xyz *= w_div; + + blur.xyz = blur.xyz*fscale + fbias; + + ret.xyz = blur; + ret.w = 1; + //ret.xyzw = tex2D(sampler_main, uv + 0*srctexsize.zw); +} diff --git a/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur2_ps.fx b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur2_ps.fx new file mode 100644 index 0000000..c212e06 --- /dev/null +++ b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur2_ps.fx @@ -0,0 +1,61 @@ +//texture PrevFrameImage; +//sampler2D sampler_main = sampler_state { Texture = ; }; +//float4 _c0; // source texsize (.xy), and inverse (.zw) + + + + +//float4 _c5; // w1,w2,d1,d2 +//float4 _c6; // w_div, edge_darken_c1, edge_darken_c2, edge_darken_c3 + +void PS( float2 uv : TEXCOORD, + out float4 ret : COLOR0 ) +{ + //SHORT VERTICAL PASS 2: + //const float w1 = w[0]+w[1] + w[2]+w[3]; + //const float w2 = w[4]+w[5] + w[6]+w[7]; + //const float d1 = 0 + 2*((w[2]+w[3])/w1); + //const float d2 = 2 + 2*((w[6]+w[7])/w2); + //const float w_div = 1.0/((w1+w2)*2); + + + + + + #define srctexsize _c0 + #define w1 _c5.x + #define w2 _c5.y + + + #define d1 _c5.z + #define d2 _c5.w + + + #define edge_darken_c1 _c6.y + #define edge_darken_c2 _c6.z + #define edge_darken_c3 _c6.w + + #define w_div _c6.x + + // note: if you just take one sample at exactly uv.xy, you get an avg of 4 pixels. + //float2 uv2 = uv.xy;// + srctexsize.zw*float2(-0.5,-0.5); + float2 uv2 = uv.xy + srctexsize.zw*float2(1,0); // + moves blur UP, LEFT by TWO-pixel increments! (since texture is 1/2 the size of blur1_ps) + + float3 blur = + ( tex2D( sampler_main, uv2 + float2(0, d1*srctexsize.w) ).xyz + + tex2D( sampler_main, uv2 + float2(0,-d1*srctexsize.w) ).xyz)*w1 + + ( tex2D( sampler_main, uv2 + float2(0, d2*srctexsize.w) ).xyz + + tex2D( sampler_main, uv2 + float2(0,-d2*srctexsize.w) ).xyz)*w2 + ; + blur.xyz *= w_div; + + // tone it down at the edges: (only happens on 1st X pass!) + float t = min( min(uv.x, uv.y), 1-max(uv.x,uv.y) ); + t = sqrt(t); + t = edge_darken_c1 + edge_darken_c2*saturate(t*edge_darken_c3); + blur.xyz *= t; + + ret.xyz = blur; + ret.w = 1; + //ret.xyzw = tex2D(sampler_main, uv + 0*srctexsize.zw); +} diff --git a/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur_vs.fx b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur_vs.fx new file mode 100644 index 0000000..490ad54 --- /dev/null +++ b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/blur_vs.fx @@ -0,0 +1,10 @@ +void VS( float3 vPosIn : POSITION, + float4 vDiffuseIn : COLOR, + float4 uv1 : TEXCOORD0, // .xy = warped UVs, .zw = orig UVs + float2 uv2 : TEXCOORD1, // .x = rad, .y = ang + out float4 vPosProj : POSITION, + out float2 uv : TEXCOORD0 ) +{ + vPosProj = float4(vPosIn.xy,1,1); + uv = uv1.xy; +} diff --git a/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/comp_ps.fx b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/comp_ps.fx new file mode 100644 index 0000000..a4020ea --- /dev/null +++ b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/comp_ps.fx @@ -0,0 +1,14 @@ +shader_body +{ + //************************************************************ + // NOTE: the body of this shader will be replaced by MilkDrop + // whenever a pre-MilkDrop-2 preset is loaded! + //************************************************************ + + ret = tex2D(sampler_main, uv).xyz; + + //************************************************************ + // NOTE: the body of this shader will be replaced by MilkDrop + // whenever a pre-MilkDrop-2 preset is loaded! + //************************************************************ +} \ No newline at end of file diff --git a/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/comp_vs.fx b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/comp_vs.fx new file mode 100644 index 0000000..4dab267 --- /dev/null +++ b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/comp_vs.fx @@ -0,0 +1,14 @@ +void VS( float3 vPosIn : POSITION, + float4 vDiffuseIn : COLOR, + float4 uv_in : TEXCOORD0, // .xy = UVs to use (unwarped), .zw = IGNORE + float2 rad_ang_in : TEXCOORD1, // .x = rad, .y = ang + out float4 vPosProj : POSITION, + out float4 _vDiffuse : COLOR, + out float2 _uv : TEXCOORD0, + out float2 _rad_ang : TEXCOORD1 ) +{ + vPosProj = float4(vPosIn.x, vPosIn.y, vPosIn.z, 1); + _vDiffuse = vDiffuseIn; + _uv = uv_in.xy; + _rad_ang = rad_ang_in.xy; +} \ No newline at end of file diff --git a/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/include.fx b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/include.fx new file mode 100644 index 0000000..480421c --- /dev/null +++ b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/include.fx @@ -0,0 +1,155 @@ +#define M_PI 3.14159265359 +#define M_PI_2 6.28318530718 +#define M_INV_PI_2 0.159154943091895 + +float4 rand_frame; // random float4, updated each frame +float4 rand_preset; // random float4, updated once per *preset* +float4 _c0; // .xy: multiplier to use on UV's to paste an image fullscreen, *aspect-aware*; .zw = inverse. +float4 _c1, _c2, _c3, _c4; +float4 _c5; //.xy = scale,bias for reading blur1; .zw = scale,bias for reading blur2; +float4 _c6; //.xy = scale,bias for reading blur3; .zw = blur1_min,blur1_max +float4 _c7; // .xy ~= float2(1024,768); .zw ~= float2(1/1024.0, 1/768.0) +float4 _c8; // .xyzw ~= 0.5 + 0.5*cos(time * float4(~0.3, ~1.3, ~5, ~20)) +float4 _c9; // .xyzw ~= same, but using sin() +float4 _c10; // .xyzw ~= 0.5 + 0.5*cos(time * float4(~0.005, ~0.008, ~0.013, ~0.022)) +float4 _c11; // .xyzw ~= same, but using sin() +float4 _c12; // .xyz = mip info for main image (.x=#across, .y=#down, .z=avg); .w = unused +float4 _c13; //.xy = blur2_min,blur2_max; .zw = blur3_min, blur3_max. +float4 _qa; // q vars bank 1 [q1-q4] +float4 _qb; // q vars bank 2 [q5-q8] +float4 _qc; // q vars ... +float4 _qd; // q vars +float4 _qe; // q vars +float4 _qf; // q vars +float4 _qg; // q vars +float4 _qh; // q vars bank 8 [q29-q32] + +// note: in general, don't use the current time w/the *dynamic* rotations! +float4x3 rot_s1; // four random, static rotations. randomized @ preset load time. +float4x3 rot_s2; // minor translation component (<1). +float4x3 rot_s3; +float4x3 rot_s4; + +float4x3 rot_d1; // four random, slowly changing rotations. +float4x3 rot_d2; +float4x3 rot_d3; +float4x3 rot_d4; +float4x3 rot_f1; // faster-changing. +float4x3 rot_f2; +float4x3 rot_f3; +float4x3 rot_f4; +float4x3 rot_vf1; // very-fast-changing. +float4x3 rot_vf2; +float4x3 rot_vf3; +float4x3 rot_vf4; +float4x3 rot_uf1; // ultra-fast-changing. +float4x3 rot_uf2; +float4x3 rot_uf3; +float4x3 rot_uf4; + +float4x3 rot_rand1; // random every frame +float4x3 rot_rand2; +float4x3 rot_rand3; +float4x3 rot_rand4; + +#define time _c2.x +#define fps _c2.y +#define frame _c2.z +#define progress _c2.w +#define bass _c3.x +#define mid _c3.y +#define treb _c3.z +#define vol _c3.w +#define bass_att _c4.x +#define mid_att _c4.y +#define treb_att _c4.z +#define vol_att _c4.w +#define q1 _qa.x +#define q2 _qa.y +#define q3 _qa.z +#define q4 _qa.w +#define q5 _qb.x +#define q6 _qb.y +#define q7 _qb.z +#define q8 _qb.w +#define q9 _qc.x +#define q10 _qc.y +#define q11 _qc.z +#define q12 _qc.w +#define q13 _qd.x +#define q14 _qd.y +#define q15 _qd.z +#define q16 _qd.w +#define q17 _qe.x +#define q18 _qe.y +#define q19 _qe.z +#define q20 _qe.w +#define q21 _qf.x +#define q22 _qf.y +#define q23 _qf.z +#define q24 _qf.w +#define q25 _qg.x +#define q26 _qg.y +#define q27 _qg.z +#define q28 _qg.w +#define q29 _qh.x +#define q30 _qh.y +#define q31 _qh.z +#define q32 _qh.w + +#define aspect _c0 +#define texsize _c7 // .xy = (w,h); .zw = (1/(float)w, 1/(float)h) +#define roam_cos _c8 +#define roam_sin _c9 +#define slow_roam_cos _c10 +#define slow_roam_sin _c11 +#define mip_x _c12.x +#define mip_y _c12.y +#define mip_xy _c12.xy +#define mip_avg _c12.z +#define blur1_min _c6.z +#define blur1_max _c6.w +#define blur2_min _c13.x +#define blur2_max _c13.y +#define blur3_min _c13.z +#define blur3_max _c13.w +#define GetMain(uv) (tex2D(sampler_main,uv).xyz) +#define GetPixel(uv) (tex2D(sampler_main,uv).xyz) +#define GetBlur1(uv) (tex2D(sampler_blur1,uv).xyz*_c5.x + _c5.y) +#define GetBlur2(uv) (tex2D(sampler_blur2,uv).xyz*_c5.z + _c5.w) +#define GetBlur3(uv) (tex2D(sampler_blur3,uv).xyz*_c6.x + _c6.y) + +#define lum(x) (dot(x,float3(0.32,0.49,0.29))) +#define tex2d tex2D +#define tex3d tex3D + +// previous-frame-image samplers: +texture PrevFrameImage; +sampler2D sampler_main = sampler_state { Texture = ; }; +sampler2D sampler_fc_main = sampler_state { Texture = ; }; +sampler2D sampler_pc_main = sampler_state { Texture = ; }; +sampler2D sampler_fw_main = sampler_state { Texture = ; }; +sampler2D sampler_pw_main = sampler_state { Texture = ; }; +#define sampler_FC_main sampler_fc_main +#define sampler_PC_main sampler_pc_main +#define sampler_FW_main sampler_fw_main +#define sampler_PW_main sampler_pw_main + +// built-in noise textures: +sampler2D sampler_noise_lq; +sampler2D sampler_noise_lq_lite; +sampler2D sampler_noise_mq; +sampler2D sampler_noise_hq; +sampler3D sampler_noisevol_lq; +sampler3D sampler_noisevol_hq; +float4 texsize_noise_lq; +float4 texsize_noise_lq_lite; +float4 texsize_noise_mq; +float4 texsize_noise_hq; +float4 texsize_noisevol_lq; +float4 texsize_noisevol_hq; + +// procedural blur textures: +sampler2D sampler_blur1; +sampler2D sampler_blur2; +sampler2D sampler_blur3; diff --git a/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/warp_ps.fx b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/warp_ps.fx new file mode 100644 index 0000000..27b4b27 --- /dev/null +++ b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/warp_ps.fx @@ -0,0 +1,18 @@ +shader_body +{ + //************************************************************ + // NOTE: the body of this shader will be replaced by MilkDrop + // whenever a pre-MilkDrop-2 preset is loaded! + //************************************************************ + + // sample previous frame + ret = tex2D( sampler_main, uv ).xyz; + + // darken over time + ret -= 0.004; + + //************************************************************ + // NOTE: the body of this shader will be replaced by MilkDrop + // whenever a pre-MilkDrop-2 preset is loaded! + //************************************************************ +} diff --git a/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/warp_vs.fx b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/warp_vs.fx new file mode 100644 index 0000000..79d269e --- /dev/null +++ b/musikcube_win32_with_milkdrop2_0.98.1/plugins/Milkdrop2/data/warp_vs.fx @@ -0,0 +1,14 @@ +void VS( float3 vPosIn : POSITION, + float4 vDiffuseIn : COLOR, + float4 uv_in : TEXCOORD0, // .xy = warped UVs, .zw = orig UVs + float2 rad_ang_in : TEXCOORD1, // .x = rad, .y = ang + out float4 vPosProj : POSITION, + out float4 _vDiffuse : COLOR, + out float4 _uv : TEXCOORD0, + out float2 _rad_ang : TEXCOORD1 ) +{ + vPosProj = float4(vPosIn.x, vPosIn.y, vPosIn.z, 1); + _vDiffuse = vDiffuseIn; + _uv = uv_in.xyzw; + _rad_ang = rad_ang_in.xy; +} -- cgit v1.2.3