- Home /
Question by
mcqueen · Jun 16, 2015 at 06:46 AM ·
line rendererlinesspeed up
Rendering streamline data
I want to use unity to visualize streamline data from CAE analysis software and use GL in OnPostRender() to link the points one by one in a single streamline by drawing segments.
void OnPostRender()
{
calcolor m_color = new calcolor(max_v, min_v);
CreateLineMaterial();
// set the current material
GL.PushMatrix();
lineMaterial.SetPass(0);
GL.Begin(GL.LINES);
for (int i = 0; i < m_stream.v_stream.Count; i++)
{
for (int j = 0; j < m_stream.v_stream[i].v_node.Count - 1; j++)
{
GL.Color(m_color.getcolor(m_stream.v_stream[i].v_node[j].v));
GL.Vertex3(m_stream.v_stream[i].v_node[j].x, m_stream.v_stream[i].v_node[j].y, m_stream.v_stream[i].v_node[j].z);
GL.Color(m_color.getcolor(m_stream.v_stream[i].v_node[j + 1].v));
GL.Vertex3(m_stream.v_stream[i].v_node[j + 1].x, m_stream.v_stream[i].v_node[j + 1].y, m_stream.v_stream[i].v_node[j + 1].z);
}
}
GL.End();
GL.PopMatrix();
}
The effect looks like this:
However, the data is too large and even after pre-processing it still contains more than 180,000 points. So the rendering speed is less than 10 FPS.
How to speed up rendering of a large amount of lines? Does unity have any mechanism like double buffering in OpenGL?
qq截图20150616141133.png
(288.2 kB)
Comment
Your answer

Follow this Question
Related Questions
Issue drawing lines between buttons - Lines overlap the buttons 2 Answers
Is there anyway to draw smooth 2d lines? 0 Answers
Please help me achieve this 1 Answer
Drawing Pixelated Lines 0 Answers
inconsistent lines errors?! 2 Answers