Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render differences between Milkdrop and projectM. #509

Closed
chaosophy opened this issue Jun 25, 2021 · 9 comments · Fixed by #716
Closed

Render differences between Milkdrop and projectM. #509

chaosophy opened this issue Jun 25, 2021 · 9 comments · Fixed by #716

Comments

@chaosophy
Copy link

Hi, the more I use projectM the more I've been noticing presets that look 'bad' or that don't seem to do much other than a full colour backdrop with a few pixels here and there.

So I've checked a few presets both in projectM and using Milkdrop 2 via MediaMonkey (also tried BeatDrop, which basically gives the same results as MD2 via MM) and there seems to be major rendering differences between the two.

Wondering if this is down to the move from DirectX for Milkdrop to OpenGL for projectM?
And possibly me using an AMD gfx card? As I know AMD's OGL drivers aren't the greatest, at least under Windows.

Here's an example.
Both running at the same time, pointed to the same .milk preset file.

Win10 x64, AMD Vega 64.

MM4-MD2

PM

@revmischa
Copy link
Collaborator

There are some bugs and compatible issues. Usually this issue is caused by a failure to compile the shader as projectM must convert the windows-specific HLSL shaders to the more cross-platform GLSL. If you look in the console it will likely say what the compilation error is.
Some issues have been fixed in master but not released yet, but many remain. If you'd like to help debug them the shader compilation error message would be the place to start.

@chaosophy
Copy link
Author

Hi, thanks for the reply.

I ran projectm.exe from the cmd line and didn't see anything obvious...

INFO: - GL_VERSION: 4.6.14739 Compatibility Profile Context 21.6.2 27.20.22001.16006
INFO: - GL_SHADING_LANGUAGE_VERSION: 4.60
INFO: - GL_VENDOR: ATI Technologies Inc.
INFO: Using data directory: /usr/local/share/projectM
INFO: Read ~/.projectM/config.inp
INFO: Using config from C:\Users\chaosophy/.projectM/config.inp
INFO: Opened audio capture loopback.
INFO: Displaying preset: ---ar()mo-- - Spirit of East v2.milk
INFO: Displaying preset: Geiss - 3D - Shockwaves.milk
INFO: Displaying preset: Anandmide _ Shifter - Fractical_Dancer_MTM_mix (Stahlregen's Geiss Chaos Tile edit + random color).milk
INFO: Displaying preset: Anandmide _ Shifter - Fractical_Dancer_MTM_mix (Stahlregen's Geiss Chaos Tile edit + random color).milk
INFO: Displaying preset: Anandmide _ Shifter - Fractical_Dancer_MTM_mix (Stahlregen's Geiss Chaos Tile edit + random color).milk
INFO: Displaying preset: Anandmide _ Shifter - Fractical_Dancer_MTM_mix (Stahlregen's Geiss Chaos Tile edit + random color).milk
INFO: Displaying preset: Anandmide _ Shifter - Fractical_Dancer_MTM_mix (Stahlregen's Geiss Chaos Tile edit + random color).milk
INFO: Displaying preset: Anandmide _ Shifter - Fractical_Dancer_MTM_mix (Stahlregen's Geiss Chaos Tile edit + random color).milk
INFO: Displaying preset: Anandmide _ Shifter - Fractical_Dancer_MTM_mix (Stahlregen's Geiss Chaos Tile edit + random color).milk
INFO: Displaying preset: Anandmide _ Shifter - Fractical_Dancer_MTM_mix (Stahlregen's Geiss Chaos Tile edit + random color).milk
INFO: Displaying preset: shifter - robotopia.milk
INFO: Displaying preset: shifter - robotopia.milk

@kblaschke
Copy link
Member

According to RenderDoc, all waveform meshes generated by the "robotopia" preset have only vertices with 0.50/0.50 coordinates, thus rendering nothing as all vertices are exactly in the center of the screen.

So this doesn't look like an actual rendering issue, but something going wrong interpreting the preset's waveform math.

@kblaschke
Copy link
Member

Looking deeper into projectM's waveform math, one prominent issue that caught my eye is that projectM has an off-by-one error between the nWaveMode parameter and the enumeration declaring the waveform types, which means that for mode 0, no waveform is calculated and all points remain at the screen center and all other waveforms are also one index off, thus it's not that visible. This matches what I've seen in RenderDoc.

Milkdrop also supports a waveform mode 8, which is identical to 6 but renders a spectrum line instead of a waveform line. This is currently unimplemented in projectM.

If I have some time on hand over the coming days I'll try to look into it and try to fix the waveform math using the original Milkdrop code as a reference. This should get rid of many rendering differences as presets use waveforms as the central drawing element.

@kblaschke
Copy link
Member

kblaschke commented Aug 23, 2021

Another major part missing from projectM is providing a few noise textures presets can sample from in shader code. These lookups just fail, breaking the shader:

    NOISE TEXTURES
    --------------
    There are also "noise" (random value) textures built in to MilkDrop.  
    They are generated when MilkDrop starts, but only so the large amount
    of (random) data wouldn't bloat the size of the MilkDrop download.
    They vary in the quality (smoothness) of the noise, as well as
    how often the pattern repeats itself.  Always use the smallest
    possible noise texture (_lite or _lq versions) when possible.
    
    Here are the details on the six textures:
    
    NAME           DIMS  PIXELS    QUALITY
    ----           ----  ------    ---------
    noise_lq       2D    256x256   low
    noise_lq_lite  2D    32x32     low
    noise_mq       2D    64x64     medium
    noise_hq       2D    32x32     high
    noisevol_lq    3D    32x32x32  low
    noisevol_hq    3D    8x8x8     high

...

    To sample a color value from a noise texture, add code like this:
    
        float4 noiseVal = tex2D(sampler_noise_lq, uv_orig );

Opened another issue #532 for the shader-related stuff that's missing.

Edit: Noise textures are now fixed in master.

@kblaschke
Copy link
Member

Another smaller issue affecting a few presets:

Shader translation does not support sampler state structs like this:

sampler sampler_grad2 = sampler_state {
 AddressU = WRAP; 
 AddressV = WRAP;
};

The first line will be replaced with the GLSL pendant, but the next three lines are kept as-is, which breaks the shader code.
Workaround would look for =and {} brackets before the ; and remove the whole block, as this is not required (default sampler uses x/y wrap AKA repeat anyway).

@chaosophy
Copy link
Author

Hi, I don't post much, partly as not having a lot to say but mainly as not being able to contribute to the code.
I do though keep an eye on the project from time to time and so just wanted to say thanks for all the work you (and others) have been doing.
Looks like lots of great work being done.

Thanks!

@kblaschke
Copy link
Member

kblaschke commented Apr 25, 2022

You're welcome! Helping with testing is surely a thing that's highly appreciated.

I'm more or less using this issue to collect all the things that come up while testing and can't be fixed easily or immediately. If anyone else finds specific things that don't work, please just add a note here as well.

BTW, the robotopia issue is still not fixed, but I've got some idea why it might happen - some variable not being reset properly between frames or per-point waveform equation runs. Currently focusing on the API so we can get the 4.0 release out, finish the new SDL UI, then back to bug fixing.

@kblaschke kblaschke added this to the 4.1 milestone Feb 22, 2023
@kblaschke kblaschke self-assigned this Feb 22, 2023
@kblaschke
Copy link
Member

The preset renderer has been mostly rewritten, with a focus on making it as compatible as possible with Milkdrop. Some issues remain, a few we can't fix because of HLSL/GLSL incompatibilities. But for the majority of the presets out there, the rendering output should now match Milkdrop, or at least be very close to the original. All in all, projectM is now closer to the original than it probably was ever before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment