projectM-visualizer / projectm

projectM - Cross-platform Music Visualization Library. Open-source and Milkdrop-compatible.
https://discord.gg/mMrxAqaa3W
GNU Lesser General Public License v2.1
3.28k stars 371 forks source link

projectM does not provide all documented textures for preset shaders. #532

Closed kblaschke closed 2 years ago

kblaschke commented 3 years ago

Currently, projectM supports a subset of the officially documented set of shader features Milkdrop provides for presets. This leads to huge rendering differences between the two implementations, generally breaking preset rendering using the missing features completely. Here's a (probably incomplete) list of issues:

Also the already implemented shader inputs should be reviewed against the Milkdrop code to make sure the inputs are set to expected values. Some presets are highly tuned to certain parameters and might look broken even if the values are just a tiny bit off.

The original preset authoring documentation can be found here: http://www.geisswerks.com/milkdrop/milkdrop_preset_authoring.html

BoAC-Tech commented 3 years ago

failed_shader_presets.zip

Got these errors with these presets: 1: the whole screenbuffer is black instead of only the texture and framebuffer I supply to draw to in OpenGL The projectM output has to be rendered to a specific texture but the whole screen becomes black. 2: shader error: Failed to compile shader 'Fragment: Comp'. Error: 0:95(26): error: could not implicitly convert operands to arithmetic operator 0:95(15): error: operands to arithmetic operators must be numeric 0:95(9): error: cannot construct `vec2' from a non-numeric data type

Compilation error (step3) of Comp

kblaschke commented 3 years ago

These presets use some undocumented functionality I've never seen anywhere. There's a per_frame_init section, which has an additional function loop and uses variables like reg00 and megabuf.

Do these presets actually work in Milkdrop? Neither the authoring guide nor the released source code gives any hints on that syntax. Any sources where this is defined would be helpful. Adding additional functions to the parser isn't a big thing, but we need to know how it's supposed to work and what the additional variables contain and where they are used.

Edit: Found it. It's additional syntax supported by Nullsoft's Advanced Visualization Studio, AVS. They seem to have adopted and added features to Milkdrop's preset syntax, but it's not compatible anymore and projectM doesn't support such presets.

OfficialIncubo commented 2 years ago

I think the random texture selection is almost implemented.Screenshot_20210828_194702_com.psperl.projectM.jpg By the way, I am using an Android Version of projectM.

Edit: If the preset are using sampler_rand00_smalltiled, it still chooses one of all the textures. It still happens with sampler_rand00_pano too.

OfficialIncubo commented 2 years ago

One more... I have collected some presets from martin and some preset authors that is unsupported or crashed using projectM for Android, Windows, Kodi and other OS. (Including the newer presets)

Here is your download: Unsupported or Crashing Presets for projectM (contains textures and presets, even my presets)

Features:

!!!!!!!!!butterbeaster can now have wobbly frames thanks to Nitorami!!!!!!!!!.milk
!!!!!!!!!butterbeaster has received help from Nitorami!!!!!!!!!.milk
!!!!!!!!!butterbeaster has those coghearts beating thanks to Nitorami!!!!!!!!!.milk
!!!!!!!!!butterbeaster needs help!!!!!!!!!.milk
!!!!!!!!!butterbeaster should now have wobbly frames thanks to Nitorami!!!!!!!!!.milk
!!!!!!!!!butterbeaster would also like coghearts on each side of the frame!!!!!!!!!.milk
amandio c - a boid's life.milk
amandio c - log tower 5.milk
amandio c - monitor wave - MD Beta.milk
clock.milk
flexi - 3d mosaic glass test.milk
flexi - cell tissue.milk
flexi - fiddling twists in the fabric of random textures.milk
flexi - lorenz chaser + sky sphere.milk
martin - (unfinished) simple planet study.milk
martin - a flexi caleidoscope mix test [unfinished].milk
martin - adrift on a dead planet.milk
martin - amandio c - Se7enSlasher - a different view of the green machine (random textured).milk
martin - attack of the beast.milk
martin - autumn leaves.milk
martin - baby one more time.milk
martin - badlands [Flexi's wave edit].milk
martin - badlands.milk
martin - butterflies.milk
martin - carpet weaver.milk
martin - cascade.milk
martin - castle in the air.milk
martin - chain breaker.milk
martin - char test.milk
martin - cherry brain wall mod.milk
martin - cherry brain.milk
martin - city lights v2.milk
martin - city lights.milk
martin - city of shadows.milk
martin - colorwall.milk
martin - double chase.milk
martin - elusive impressions mix1.milk
martin - elusive impressions mix2.milk
martin - extreme heat.milk
martin - frosty caves 2.milk
martin - frosty caves.milk
martin - fulldome (flexis fractal distortion).milk
martin - funky illusions.milk
martin - glassworks 2.milk
martin - glassworks 3.milk
martin - glassworks.milk
Martin - Hades' Disquotheqe - headache edition.milk
martin - hardcore mix 1.milk
martin - inferno.milk
martin - interstellar tunnel.milk
martin - jewelry.milk
martin - juggernaut.milk
martin - mandelbox explorer - wreck diver.milk
martin - massif central.milk
martin - on silent paths_Anandamide_Remix.milk
martin - open machinery hazard.milk
martin - pixies party - searchlight.milk
martin - pixies party minimal techno remix.milk
martin - polar lights.milk
martin - pulsar 1.milk
Martin - QBikal - Surface Turbulence II [Flexi - bipolar mix].milk
Martin - QBikal - Surface Turbulence II.milk
martin - resonant twister - steel spring.milk
martin - resonant twister.milk
martin - ring dance mod1.milk
martin - ring dance.milk
martin - rogue wave -ps2.milk
martin - rogue wave -ps3.milk
martin - martin - shader pimped caleidoscope.milk
martin - shine on me.milk
martin - smooth spectrum analyser - mono 16 channels.milk
martin - space debris.milk
martin - sphery tales.milk
martin - stormy sea.milk
martin - stratospheric turbulences.milk
martin - the bridge of khazad-dum.milk
martin - the forge of Isengard.milk
martin - the sewers.milk
martin - troubled water.milk
martin - warming up the house.milk
martin - witchcraft reloaded.milk
martin - X Portal.milk
martin - Zen walk.milk
ORB - Lava Lamp.milk
Se7enSlasher - Fluid Maelstronom.milk
Se7enSlasher - Grizelda's Pirouette (Jelly V4.5).milk
Se7enSlasher - Texture Distortion 2000 nz.milk
Zylot - Bitwise.milk
Zylot - Bog Standard Music Visualizer.milk
Zylot - Snake 2 Hypersnake.milk
Zylot - Snake Game.milk

More unstable presets coming soon...

kblaschke commented 2 years ago

Went a bit deeper into the code and most of the functionality is indeed there. I think the most problematic part with presets is the lack of proper random noise. projectM uses Perlin noise and generates a greyscale noise image which has an opaque alpha channel and the RGB values are set to identical values for each pixel.

Milkdrop generates pseudo-random values instead, with different values for all four color channels. The "zoom factor" value then uses bicubic interpolation to zoom into a smaller area of the noise, creating a smoothened image.

Here are the four 2D noise textures as generated by Milkdrop. Order is noise_lq, noise_lq_lite, noise_mq and noise_hq. Note these are PNGs with alpha channel, so transparency will show up as the site's background color:

noise_lq noise_lq_lite noise_mq noise_hq

kblaschke commented 2 years ago

I'd like to round up this issue for now, as all "missing" textures are now there:

From the opening post, lazy texture loading and better random texture selection are still open, but these affect mostly performance, and don't break presets completely. That said, I'm closing this ticket and continue work on the remaining problems in other issues.

OfficialIncubo commented 1 year ago

Sadly, the "worms" texture is nowhere to be found. If anyone know how it looked like and can provide a replacement, please open a PR!

There is no worms texture. Nitorami accidentally sampled the worms as texture that cannot be found. Ex: "martin - glassball dance". This preset uses no texture.

I added ret = tex2D(sampler_worms, uv).xyz; in the last line of the warp shader code and the error said: Could not load texture: w.j.

kblaschke commented 1 year ago

It's being used (without obvious negative consequences when not found) in a large number of presets.

At some point, the texture might have been around, but I've tried many times and couldn't find it anywhere. If someone knows more about it or still has a copy, please feel free to add it to the presets-milkdrop-texture-pack repository.