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.

make loaders to create indexed geometry

See original GitHub issue

You guys aim to deprecate Geometry, and to that end remove it from stuff like OBJLoader. Unfortunately, BufferGeometry you create is flat. If I want to have smooth normals with OBJ model, I am forced to bloat my file and export them. Before I could do

mesh.geometry.computeVertexNormals ();

which was good CPU-vs-file size trade-off. Now, I would have to do

var geometry = new THREE.Geometry ();
geometry.fromBufferGeometry (mesh.geometry);
geometry.mergeVertices ();
geometry.computeVertexNormals ();
mesh.geometry = geometry;

which wastes way more CPU just because you guys destroy index information in the parser, and moreover it will break once you succeed in deprecating Geometry. BufferGeometry can keep this information, so why do you have to choose for me that I do not want it?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
kaisalmencommented, Nov 5, 2017

@mrdoob and @makc I promised an answer and did not provide it, yet. Here it is.

The answer is simple: WebGL 2.0 only allows a single index.

Regarding OpenGL I found this: AMD_interleaved_elements is an extension for OpenGL 4.3 Core Profile. If I understand the specs correctly understand the maximum index length is rather short and therefore not suited for large meshes:

This extension allows OpenGL to process multi-component packed element data. The maximum size of a vertex’s index data is not increased, but the facility to store 2 16-bit or 2 or 4 8-bit indices per vertex is introduced.

Another idea is to write a custom shader that access the different indices from a buffer texture in the vertex shader, but this will decrease rendering performance (see this stackoverflow post).

1reaction
mrdoobcommented, Sep 6, 2017

I will check whether independent buffers for vertex, normals and uvs are possible with WebGL 2. That’s what you meant, right?

Yep!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating an indexed buffergeometry with OBJ Loader messes ...
Creating an indexed buffergeometry with OBJ Loader messes up texture. Hello people of reddit, hope you're having a wonderful time.
Read more >
How to get indices from three.js OBJLoader - Stack Overflow
THREE.OBJLoader always creates non-indexed geometries. Meaning the index property of the geometry is null . If you need an index for some ...
Read more >
The Buffer Geometry loader in three.js
In this post I will be writing about the BufferGeometryLoader in three.js the popular javaScript library for working with 3D objects.
Read more >
I3SLoader | loaders.gl
A loader for loading an Indexed 3d Scene (I3S) layer, and its geometries and textures data. Loader, Characteristic. File Format, I3S Layer. File...
Read more >
BufferGeometry#setIndex – three.js docs
BufferGeometry (); // create a simple square shape. We duplicate the top left and ... For indexed BufferGeometry, count is the number of...
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