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.

Add to .drawRange the possibility to store multiple entries

See original GitHub issue

It would be great if the .drawRange function could be an array storing multiple entries ( like the .groups array from .geometry) or even better, to be able to set a visibility value to each positions/vertex of a mesh.

https://threejs.org/docs/#api/core/BufferGeometry.drawRange

As for now, .drawRange work like this :

geometry.drawRange { start: a, count: b }

Instead, we could have this :

geometry.drawRange[0] { start: a1, count: b1 }
geometry.drawRange[1] { start: a2, count: b2 }
geometry.drawRange[2] { start: a3, count: b3 }

etc…

The reason behind this request is because I use a big mesh that I can’t split in different part ( ratio between drawcalls, numbers of triangles and loading time, where loading one big mesh is the best option in that situation), while at the same time, I can’t really use .drawRange because of the multiple intersection that the mesh must provide ( player map ).

Here’s an example :

map

Reaching the 2nd part (brown one with 30,60), the intersection will lead to either blue ( 90, 30 ) or ( ?, ? ), why " ?, ? " simply because If I set let’s say ( 300, 30 ), then, how could I render ( 30, 60 ) ( 300, 30 ) at the same time (without having to render a huge part like ( 0,330 ) ? this will mean that one part of the map will disappear / pop only when the player is inside.

Of course, there is a lot of alternative, but all of them add more complexity, performance and compatibility issue (knowing that I render all the texture by one shadermaterial + texture atlas).

In the end, I think making .drawRange not linear at it is right now would make it more powerful and versatile.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
WestLangleycommented, Jun 24, 2018

@zaykho Why can’t you use groups in your app, instead of drawRange?

var mesh = new THREE.Mesh( geometry, [ material ] );
0reactions
Mugen87commented, Jul 3, 2018

Closing for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Efficient way to store multiple ranges of numbers for future ...
However, I'm looking for an efficient way to store these ranges and then search to see if an IP address exists within any...
Read more >
How to update things – three.js docs
We'll allocate space in the buffer for 500 vertices but draw only two at first, using BufferGeometry.drawRange. const MAX_POINTS = 500; // geometry ......
Read more >
Those things in the centerline of ThreeJS - SegmentFault
The idea of the realization of the growing line is very simple. First calculate and define a series of points, that is, the...
Read more >
three.js - Documentation & Help
[page:Animation Animation Constants for possible values. Default is. [page:Animation InterpolateLinear. Свойства. Для ознакомления с унаследованными ...
Read more >
Three js lines
Next one shows how to display several groups, and how to use small ... and LineSegments constructors in three.js, so to help keep...
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