No announcement yet.

Milkdrop 2 Sprite as background

  • Filter
  • Time
  • Show
Clear All
new posts

  • Milkdrop 2 Sprite as background

    I edit plugin Milkdrop 2 code "milkdrop2_v2.25c_OPEN_SOURCED_20130514_orig_code"

    I need to set image to background and above show the preset. But when I add sprite it overflow and hide the Preset.
    See "1.png"

    When in functions "void CPlugin::RenderFrame(int bRedraw)" I insert self function to draw background image before drawing the preset, the preset is showing. But color in background image is difused, see 2.png.

    I think this difuse color of background make Shaders functions. But do not khnow how fixid it.

    May be, use zBuffer for Backbufer?
    Attached Files

  • #2
    Would it not be simpler to edit the presets rather than the source code to do this ?


    • #3
      Originally Posted by Nitorami View Post
      Would it not be simpler to edit the presets rather than the source code to do this ?
      Functions of the presets, is it allow to show static background image? I saw examples only with dynamic sprites.


      • #4
        You cannot add a background on the fly; you would have to edit the presets, either manually or using a script. This could be done in the comp shader section. You would have to declare your background image first (outside shader_body {}):

        sampler sampler_mybackground;

        Within shader_body {}, the output of the comp shader is in float3 ret; this is what goes to the screen. So you would have to modify this like

        ret += tex2D (sampler_mybackground,uv);

        or, if adding is too bright, use

        ret = lerp (ret, tex2D (sampler_mybackground,uv), 1-lum(ret));

        In case you want a random background, you can use

        sampler sampler_rand00;

        to make milkdrop select a random image from the presets or \textures directory.


        • #5
          Maybe I should add another very important question.

          Which image file format and which pixel size as maximum is allowed (recommended) for the textures?

          I myself prefer the image file format .jpg, and I began with the 256x256 pixel versions of my Album Cover Experiments. Now I have added some images from my old YouTube Project Folder, for example in 800x600 pixel. I wanted to have some good random textures in my Winamp's on my PC & notebook, which are used by some presets, especially since I had to copy & paste also less beautiful textures, which are required by some presets.

          Recently I have checked again the codes with Notepad++ from some presets, which stayed black. I have found the neccessary textures, but 2 of them have 2500x1250 pixel.

          @ Jarikus: Editing the presets is a very good suggestion. If You save the new preset versions, You can add "(Jarikus Remix)" in the preset names, and You will always know, You have made these presets...
          Sabine Klare Aka Sternenmaschinebine
          Music, Art, Lyrics, Videos
          AMBIENT... AMBIENT music forever...


          • #6

            I agree that normally jpg format is the best option for natural images. For text or geometric shapes with fine lines and hard contrasts I would use png.

            I am not aware of a limit to image size, except that large images may take a while to load. I find this annoying, because it interrupts the smooth change of presets, even if it is just a quarter second.

            In any case, it hardly makes sense to use a higher resolution than your screen. I recommend to scale pictures down to screen resolution. IrfanView can do this in a batch job for all images in a directory automatically. It is a good idea to preprocess images anyway, because cameras tend to produce huge files, which can be shrunk considerably without noticeable loss of quality.

            If your images are not shown, this may also be a jpg incompatibility. Again, the best option will be to open and recompress the the picture with IrfanView. That is definitely compatible.


            • #7
              Thank You, Martin.

              The last time, when the presets stayed black, the images were not in the textures folder yet.

              Maybe I should really half-size both images, which are too large. I think, it doesn't matter, if I use changed images instead of the original images, which I have found at first. I made more radical changings with IrfanView, when I found a .dds-file, which is required by a preset. Also the .jpg-version does the job very fine for this preset.

              Good to know, that I can use also .png, one of the ORB presets requires such an image. Then it can come into the textures folder, too...

              I want to put the next presets into my Winamp's anyway. I will go over 10000 presets now...
              Sabine Klare Aka Sternenmaschinebine
              Music, Art, Lyrics, Videos
              AMBIENT... AMBIENT music forever...


              • #8
                Nitorami> I found a partial solution in file: "data/include.fx" replace:

                //#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 GetBlur1(uv) (0)
                #define GetBlur2(uv) (0)
                #define GetBlur3(uv) (0)

                This allows me to use the old functional of presets and my new functional. Thank you.