|
|
#1 |
|
Member
Join Date: Sep 2001
Location: Chicago
Posts: 81
|
Scrolling Spectrogram
Hey all. This is my first attempt at making a MilkDrop preset. Wanted to implement a basic scrolling spectrogram, since XBMC doesn't seem to have one.
I'd hugely appreciate any feedback as to how to get around some minor issues I was having: 1. Making a continuous wave over the scrolling: I get small gaps in the spectrogram between each frame due to the scrolling. Any idea how to eliminate these? 2. Eliminating scrolling trails: A side-effect of the scrolling was that colors seemed to bleed as they approach the left-side of the screen. Any idea how to prevent all blurring, just a perfect non-destructive scrolling, like a ticker? 3. Clear the screen at preset load: Currently, any color on screen prior to the preset loading will stay there. I'd like to start with a black screen. Many thanks! |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2008
Location: Germany
Posts: 149
|
Welcome to the boards
![]() 1. I think there's no simple way to get rid of this, other than slowing down the scroll rate. It's a fundamental problem with scrolling, since the wave is drawn only once per frame then the frame is scrolled. That'll always leave a gap between successive drawings of the wave. 2. This can be done very simply with pixel shaders. Check out the warp shader in the attached preset, basically all it's doing is the same as the dx equation in the per frame code (which is commented out now because it's not needed anymore). The important part is the sampler type. The four types are fw, fc, pw and pc, milkdrop uses the fw type as default. The w's are the same as setting texture wrap to 'on' in the post-processing menu, the c's are the same as setting it to 'off'. The f's sample each point as an average of the points around it, and this is where the bleeding comes from. The p's on the other hand sample the nearest point directly, so you get no bleeding. Which you use depends entirely on the preset, some look really ugly with point sampling and others look ugly with averaged sampling. Setting zoom=1 in the per frame code also helps, since (like warp) zoom isn't completely 'off' until it's set to 1 in the per frame code. You can see this by commenting out zoom=1 in the attached preset. 3. There's a few ways to do this. Since the colors are 'stuck' on the border of the preset (a side-effect of using no texture wrap) you can simply add a small outer border set to black. I've set this up in the preset. That's the long and short of it Always nice to see some new people working on presets, I'm pretty new here myself.
Murphey's fighting Occam, and I'm in the stands. |
|
|
|
|
|
#3 |
|
Member
Join Date: Sep 2001
Location: Chicago
Posts: 81
|
Beautiful. Thanks muchly! I made a couple more minor tweaks, mainly to get better color response from quiet sounds and to minimize the gaps. Update is attached.
One more question: When I tried loading the preset to XBMC, it didn't seem to know how to react to the shader code. Same with my laptop. I suspect these are probably hardware limitations that are fundamentally unresolvable, but is anyone aware of any workarounds I could try? In particular, is it possible to disable averaged sampling without using pixel shaders? |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Jul 2008
Location: Germany
Posts: 149
|
Well the laptop's graphics chip probably doesn't support pixel shaders, no way around that. I'm not sure about XBMC, never used it. I'd assume it supports pixel shaders in some way, but maybe they have to be formatted differently than in milkdrop.
I don't think there's a way to disable averaged sampling without the shaders, unless somebody here knows of a hack. Looks good though Murphey's fighting Occam, and I'm in the stands. |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Apr 2008
Location: Somewhere in Southern Indiana
Posts: 184
|
If I remember correctly, XMBC only runs Pixel Shader 1.4.
What graphics chip is in your laptop? I am the purple heathen. |
|
|
|
|
|
#6 |
|
Member
Join Date: Sep 2001
Location: Chicago
Posts: 81
|
It's an NVIDIA GeForce4 440 Go. So, yeah, it only supports Pixel Shader 1.3.
I assume there's no way to write a MilkDrop preset using v1.3/1.4 pixel shaders? |
|
|
|
|
|
#7 | |
|
wellspring of milk
Major Dude |
uh ... what ... wait ... ProjectM2.0 ... Pixelshader2.0 ... opensource ... I'm shitting bricks
![]() http://projectm.sourceforge.net/ Quote:
btw: here's one more pixel-accurate scrolling code http://www.youtube.com/watch?v=p1dqQtBw-fo http://www.youtube.com/watch?v=6OZJGpKluVM |
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|