question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Performance with drawing lines

See original GitHub issue

I am using this very basic code to draw lines:

for (var i = 0; i < Lines.length; ++i)
{
    material = new THREE.LineBasicMaterial( { color: 0xff7700, opacity: 1, linewidth: 3.0});
    line = new THREE.Line( Lines[i], material);
    scene.add( line );
}

The problem is that is very inefficent: I am displaying 3D model with edges and in some cases, when I get almost 800 “lines” I see a big performance hit.

So I tried to merge geometry client side with this:

var combined = new THREE.Geometry();
for (var i = 0; i < Lines.length; ++i)
{
    THREE.GeometryUtils.merge( combined, Lines[i] );
}
line = new THREE.Line( combined, new THREE.LineBasicMaterial( { color: 0xff7700, opacity: 1, linewidth: 3.0}));
scene.add( line );

but doesn’t work because I have a huge single continuos line and not many disjoint ones (also it takes a lot to merge them into one).

So I was wondering if you could give some tips to efficiently render many edges in a scene? Should I draw lines as real meshes with an almost degenerate triangle for a single edge?

Thanks

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alteredqcommented, Feb 21, 2012

If you use LinePieces type of Line then lines are assumed to be individually separated line chunks and you can do whatever you want with them.

Check webgl_lines_sphere example.

0reactions
mrdoobcommented, Jun 17, 2013

As stated in the guidelines, help requests should be done in stackoverflow. This board is for bugs or feature requests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

performance art, drawings, art inspiration - Pinterest
Oct 19, 2021 - Explore Sidney Pink's board "Drawing Performance", followed by 124 people on Pinterest. See more ideas about performance art, drawings, ......
Read more >
Performative Drawing Day - London, 8 March 2020 - YouTube
Mark making in drawing performance is often a result of powerful physical gesture and body movement connects elements of line, movement, ...
Read more >
HTML canvas performance when drawing lots of lines
When I start getting to the performance limit, there is a noticeable delay between the end of the draw calls and the update...
Read more >
Association of stability of line drawing and drawing performance
The study presents a simple method to predict the drawing performance of designers or artists by measuring the stability of their line drawings....
Read more >
Performance Drawing - Bloomsbury Publishing
The authors draw a picture of the changing boundaries between art forms, showing how the blurred lines between artistic disciplines are the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found