Search Unity

Using compute shaders to replicate interactive charts behaviour

Discussion in 'Shaders' started by FinalBoss69, Feb 27, 2017.

  1. FinalBoss69

    FinalBoss69

    Joined:
    Feb 12, 2016
    Posts:
    32
    Hey,

    I'm making interactive charts in Unity using compute shaders.

    The thing is I want to give the user the ability to drag and swipe the chart so it can move back and forth on the time axis. When the user drags and the points move , the visible part of the chart on the screen should zoom to match the current min and max rates of the chart. Or at least make it look like the points expand according to the min/max points without losing data.

    For example:

    compute_shaders01.png

    here's what I have now when I scroll the chart. The chart stays in the middle and the min/max are far from the edges (purple arrows) the min/max can change rapidly and I need the chart to react to that.

    I am using two shaders.
    1. compute shader is only responsible on moving the points on the X/time axis.
    2. vertex/frag shader that is responsible on drawing the vertices as points on the screen.

    A very good example of the behavior I'm trying to achieve is found at https://iqoption.com/en

    What's the best way to tackle this ?