- Home /
Drawing 2d line for different resolutions in unity
Hi, I am trying to develop a stock chart application with lots of charts like candles, indicators, graphs and grid view. I'm having trouble to find an efficient way drawing lines and shapes and updating them real time efficiently. For now I am using Unity UI and for drawing lines and simple shapes like candles and bars I am using Frament shader. Is it efficient to use fragment shader ? specially when there can be thousands of points floating on the screen and updating real time ? And I'm also having issue maintaining line thickness in different resolutions. Here is my line shader function for example:
float4 line3(in float2 p, in float2 a, in float2 b, in float t, in float4 c)
{
float2 pa = p - a;
float2 ba = b - a;
float h = clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0);
float d = length(pa - ba * h);
return smoothstep(t / _ScreenParams.y), 0., d) * c;
}
The code above is actually from here
Your answer
Follow this Question
Related Questions
How can i draw pie-charts in Unity? 0 Answers
customize line renderer from middle 0 Answers
How to make smoother lines - LineRenderer 1 Answer
How to shrink a line renderer 1 Answer
Collision of linerenderer unity2d 1 Answer