Kodi Community Forum
Release 2D Spectrum, visualization - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222)
+--- Forum: Feature Requests (https://forum.kodi.tv/forumdisplay.php?fid=9)
+--- Thread: Release 2D Spectrum, visualization (/showthread.php?tid=204991)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: 2D Spectrum, visualization - un1versal - 2015-05-23

Doesnt kodi-platform already exist in current kodi? Why do you need to compile libplatform, isnt that already compiled when you compile kodi and binary addons?

Edit

https://github.com/xbmc/xbmc/tree/master/tools/depends/target/platform

mmm make -C tools/depends/target/platform doesnt seem to work either

This really shouldn't be this complicated


RE: 2D Spectrum, visualization - un1versal - 2015-05-23

(2015-05-23, 18:02)wsnipex Wrote: 1. build and install kodi master
2. build and install (lib)platform: https://github.com/Pulse-Eight/platform/
3. build shadertoy

steps for 2. and 3.:
Code:
cmake -DCMAKE_INSTALL_PREFIX=<kodi-prefix> -Dkodi_DIR=<kodi-prefix/lib>
make -j4
make install

Note: -Dkodi_DIR=<kodi-prefix/lib> is only needed if kodi is not installed in a standard prefix(/usr,/usr/local)

edit: or use the nightly ppa: kodi-visualization-shadertoy (for ubuntu >=14.10. 12.04 doesn't build atm)

That works but the resulting shadertoy does not

settings.xml for instance is

Code:
<?xml version="1.0" encoding="UTF-8"?>
<settings>
    <setting id="lastpresetidx" type="integer" default="0" visible="false" />
</settings>

And nothing happens when selecting it as a visualization and cant change presets, essentially does not work.


RE: 2D Spectrum, visualization - wsnipex - 2015-05-24

works fine for me.


RE: 2D Spectrum, visualization - un1versal - 2015-05-24

(2015-05-24, 09:14)wsnipex Wrote: works fine for me.

Well current nightly compiled from yesterday does not.

Even the Waveform visualization crashes kodi immediately,So clearly something is really wrong with current Master tree.


RE: 2D Spectrum, visualization - Kib - 2015-05-24

@wsnipex, thanks for that package in nightlies - testing it right now Smile


RE: 2D Spectrum, visualization - un1versal - 2015-05-24

Also wsnipex

this shows up in logs

Code:
14:51:07 T:140617296975808   DEBUG: ADDON: Dll Initializing - Shadertoy
14:51:07 T:140617296975808   ERROR: ADDON: Could not locate visualization.shadertoy.so

Looking further shardertoy .so installs to

-- Installing: /usr/lib/x86_64-linux-gnu/kodi/addons/visualization.shadertoy/visualization.shadertoy.so.0.0.1
-- Installing: /usr/lib/x86_64-linux-gnu/kodi/addons/visualization.shadertoy/visualization.shadertoy.so.15.0
-- Installing: /usr/lib/x86_64-linux-gnu/kodi/addons/visualization.shadertoy/visualization.shadertoy.so

However regular binary addons (like audio encoders) are also installed to /usr/lib/kodi/addons/ and shadertoy atm is not. Even though kodi is installed to /usr and cmake -DCMAKE_INSTALL_PREFIX=/usr was used in shadertoy config

So I can confirm that after copying the directory /usr/lib/x86_64-linux-gnu/kodi/addons/visualization.shadertoy to /usr/lib/kodi/addons/visualization.shadertoy then shadertoy start to work.

Also the presets

Polar Beats by sauj123
Revision 2015 Livecoding Round 1 by mu6kl

Both kill/restart/crash kodi when selected


RE: 2D Spectrum, visualization - wsnipex - 2015-05-24

yes, seems there is something wrong with addon install paths


RE: 2D Spectrum, visualization - un1versal - 2015-05-24

OK so back to main request (not quite that image but close enough for now)

I took https://www.shadertoy.com/view/Msl3zr and modified it to remove that fugly second wave and the crazy distort which both seem to ruin this otherwise great visualization.

Code:
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    // create pixel coordinates
    vec2 uv = fragCoord.xy / iResolution.xy;
        
    // quantize coordinates
    const float bands = 20.0;
    const float segs = 20.0;
    vec2 p;
    p.x = floor(uv.x*bands)/bands;
    p.y = floor(uv.y*segs)/segs;
    
    // read frequency data from first row of texture
    float fft  = texture2D( iChannel0, vec2(p.x,0.0) ).x;    

    // led color
    vec3 color = mix(vec3(0.0, 2.0, 0.0), vec3(2.0, 0.0, 0.0), sqrt(uv.y));
    
    // mask for bar graph
    float mask = (p.y < fft) ? 1.0 : 0.0;
    
    // led shape
    vec2 d = fract((uv - p)*vec2(bands, segs)) - 0.5;
    float led = smoothstep(0.5, 0.3, abs(d.x)) *
                smoothstep(0.5, 0.3, abs(d.y));
    vec3 ledColor = led*color*mask;

    // second texture row is the sound wave
    float wave = texture2D( iChannel0, vec2(uv.x, 0.75) ).x;
        
    // output final color
    //fragColor = vec4(vec3(fft),1.0);
    //fragColor = vec4(d, 0.0, 1.0);
    //fragColor = vec4(ledColor, 1.0);
    //fragColor = vec4(waveColor, 1.0);
    fragColor = vec4(ledColor, 1.0);
}

Result Image

I haven't tried adding oit to visualization.shadertoy yet and Im pretty sure my hacking around isnt complete or correct but on shadertoy website looks exactly like what I was looking for. So assist would be good if somone who kew more took and fixed it up.

EDIT
OK seems to work in shadertoy in kodi

Image

So I guess Ill submit a PR and see how that goes from there.

Edit 2

https://github.com/topfs2/visualization.shadertoy/pull/3


RE: 2D Spectrum, visualization - wsnipex - 2015-05-25

(2015-05-24, 16:34)wsnipex Wrote: yes, seems there is something wrong with addon install paths

https://github.com/xbmc/xbmc/pull/7192 should fix that.


RE: 2D Spectrum, visualization - un1versal - 2015-05-25

notspiff said something to the effect kodi hasn't been patched to look in multiarch install paths. but if that fixes that I shall try it out for sure. see https://github.com/notspiff/visualization.shadertoy/pull/5#issuecomment-105037368


RE: 2D Spectrum, visualization - wsnipex - 2015-05-26

yes correct. Kodi doesn't use multi arch yet. Since we're already way into beta stage, this won't change for Isengard.


RE: 2D Spectrum, visualization - un1versal - 2015-05-28

Ive tried implementing (see it in action there -> https://www.shadertoy.com/view/4lS3W3) a variation of audioCube as well, and I managed to get it working in kodi.

Problem is that performance?! Is awful despite CPU being at 10% and Ram 400MB, so hardly being used and with a nvidia GT610. (not the only visualisation do act like this on this machine haven't tested others dont have others to test)

Screenshots (looks great but its really slow)

watch gallery


This should have enough humpf for these things and yet they grind to a halt.

Also there's no support for cube maps (yet is it planned?) in the shadertoy addon this visualization particular looks great with a texturecube mapped to it.

But there you are maybe soon enough.

I also realized that shortage of better screensavers or even live wallpapers can also be remedied by a similar addon one for audio visualisations and one for screensavers and so on, So the same code visualisation.shadertoy and screensaver.shadertoy etc, Im sure content wouldn't be a problem.

EDIT
Well this is odd, most of these visualisations are around 60fps on my HTPC this particula one barely hits 4fps on a lucky moment, So I went and truned off Dirty regions, thinking this could be the cause, but turns out thats not even close, so Barking up the wrong tree there., What's is odd that on a browser on same machine the very same code runs perfectly well.


RE: 2D Spectrum, visualization - OurJermain - 2015-05-31

Will shadertoy be included into Kodi? It's really good imo.


RE: 2D Spectrum, visualization - un1versal - 2015-05-31

(2015-05-31, 01:19)OurJermain Wrote: Will shadertoy be included into Kodi? It's really good imo.

I think thats the general idea, mostly works though its missing a few things and you can install it already from ppa

The same codebase would eventually work for screensavers and live wallpapers which is extra exciting, but after giving this a try myself some shaders currently perform poorly so lets see if this addon which is probably still being developed makes it into kodi officially real soon.


RE: 2D Spectrum, visualization - da-anda - 2015-05-31

a screensaver add-on for shadertoy has already been created and is part of nightly RPI builds by Milhouse Smile