Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add indices #60

Closed
pjcozzi opened this issue Apr 10, 2013 · 35 comments
Closed

Add indices #60

pjcozzi opened this issue Apr 10, 2013 · 35 comments

Comments

@pjcozzi
Copy link
Member

pjcozzi commented Apr 10, 2013

Since glTF requires indices (CC #14), the converter needs to add indices for non-indexed:

  • lines
  • linestrips
  • triangles
  • trifans
  • tristrips

See the Geometry section of the COLLADA spec

@fabrobinet
Copy link
Contributor

These are actually types for mesh, and I must say I wasn't aware they can have 0 or 1 <p> i.e have indices or not.
My input in CC #14 was because I assumed that indices were required within COLLADA assets.
@RemiArnaud can you confirm this is not a bug in the spec ? are you aware of any exporter producing assets without <p> ?

@pjcozzi
Copy link
Member Author

pjcozzi commented Apr 17, 2013

@fabrobinet are you saying that you believe that all primitive types in COLLADA require indices so that we might not have to do anything? (Except fix a COLLADA spec bug?)

@RemiArnaud
Copy link
Contributor

do we really need the 'strips' anymore? that's old school no?

On Wed, Apr 17, 2013 at 11:00 AM, Patrick Cozzi notifications@git.luolix.topwrote:

@fabrobinet https://github.com/fabrobinet are you saying that you
believe that all primitive types in COLLADA require indices so that we
might not have to do anything? (Except fix a COLLADA spec bug?)


Reply to this email directly or view it on GitHubhttps://github.com//issues/60#issuecomment-16522120
.

@fabrobinet
Copy link
Contributor

@RemiArnaud IMO, no not old school...why should we "unstrip" ? Stripped assets can be the result of long computation to squeeze indices size and make the walktrough indices more efficient, we should just pass through strips and preserve them. And..we are driven by WebGL/OpenGL specs, not our call to deprecate that.

@fabrobinet
Copy link
Contributor

@pjcozzi Our plan was to have indices mandatory and wait for community feedback to see if we should relax this constraint for the ones willing to invoke drawArrays. But... I wasn't aware that COLLADA allowed non indexed primitives, and this surprises me a lot ! I was just wondering if that's a SPEC bug, anyhow I believe it is really a edge case. We should probably check other format like FBX, obj... before taking a decision

@pjcozzi
Copy link
Member Author

pjcozzi commented Apr 18, 2013

@RemiArnaud IMO, no not old school...why should we "unstrip" ? Stripped assets can be the result of long computation to squeeze indices size and make the walktrough indices more efficient, we should just pass through strips and preserve them. And..we are driven by WebGL/OpenGL specs, not our call to deprecate that.

+1 since these don't add any real burden to the client. This is just an enum passed to drawElements.

However, I don't want to get too caught up in matching WebGL exactly; for example, I am really thinking about dropping dither from the render state since I've never seen a WebGL or OpenGL app that uses it. Perhaps I am too young? :)

@fabrobinet
Copy link
Contributor

:)..

Agreed, I will not push for dither...

@RemiArnaud
Copy link
Contributor

yes, both spec and schema says that

is optional.
the spec implies that if you have at least one in a primitive you need a

if you have no in a primitive, that means that all the are in the element

in other words, non indexed primitives would have an empty primitive element:

@fabrobinet
Copy link
Contributor

@RemiArnaud Thanks for confirming that Remi.

Are you aware of any exporter no using indexed primitive ?
Our call with @pjcozzi was to just start with indexed primitive and wait community feedback to open up to non-indexed primitive ? What do you think ?

@RemiArnaud
Copy link
Contributor

I have never seen a non indexed primitive out of an exporter so far.
But, I have seen a geometry without a primitive. This only defines vertices, which maps to points that can be used by the application for particles for example

@fabrobinet
Copy link
Contributor

Yes, we thought about points too, but we can still work around with indices.
@RemiArnaud are you OK that we potentially support non indexed primitives post glTF 1.0 ?

@fabrobinet
Copy link
Contributor

(and consider all community feedback in the meantime, between feature complete and 1.0..)

@RemiArnaud
Copy link
Contributor

not sure why points should have indices, but also not sure glTF 1.0 need to
support points.

Note: linked to the other discussion about removing 'indices' and using an
attribute instead. If you have an 'INDEX' semantic, then the geometry is
indexed, if you don't then it is not indexed. Simple no?

On Tue, Apr 23, 2013 at 11:34 AM, Fabrice Robinet
notifications@git.luolix.topwrote:

(and consider all community feedback in the meantime, between feature
complete and 1.0..)


Reply to this email directly or view it on GitHubhttps://github.com//issues/60#issuecomment-16877400
.

@fabrobinet
Copy link
Contributor

IMO not having an indices property for non indexed is equally simple :).

@RemiArnaud
Copy link
Contributor

no as simple - instead of having to deal with all the glBindBuffers.. in the same loop (for all attributes), you have to do a special case in the code for the indices.

@fabrobinet
Copy link
Contributor

it's a different target for VBO, so indices have to be a special case anyway.

@RemiArnaud
Copy link
Contributor

can you explain the VBO case please?

@pjcozzi
Copy link
Member Author

pjcozzi commented May 9, 2013

For this issue, it sounds like we will need to add support to the converter to add indices even though we expect just about all COLLADA models to have indices in practice. Anything else?

@fabrobinet
Copy link
Contributor

no that's about it, let's continue to track this on the converter side.

@pjcozzi
Copy link
Member Author

pjcozzi commented May 15, 2013

OK 👍

@pjcozzi pjcozzi modified the milestones: Draft 1.0 spec, converter v1.0 Apr 30, 2014
@pjcozzi
Copy link
Member Author

pjcozzi commented Aug 27, 2015

@tfili how hard is this to add to the converter? Or perhaps we just not require indices in glTF, which would be trivial for the client, and better for point and line primitives.

@tfili
Copy link

tfili commented Aug 27, 2015

I'd have to look at the code but I don't think it would be that hard. But if it's easy for the client to support and had a benefit, why not allow it?

@pjcozzi pjcozzi removed this from the Converter 1.0 milestone Aug 27, 2015
@pjcozzi
Copy link
Member Author

pjcozzi commented Sep 1, 2015

I am OK with not requiring indices in glTF. @tparisi?

@tparisi
Copy link
Contributor

tparisi commented Sep 1, 2015

Requiring indices for non-indexed is wasteful; remember we're also trying to be efficient for transmission.

Do we have a clear proposal for non-indexed types?

@pjcozzi
Copy link
Member Author

pjcozzi commented Sep 1, 2015

Do we have a clear proposal for non-indexed types?

mesh.primitive.indices (see here in the schema) would not be required in which case, the runtime would use drawArrays, not drawElements. I have to take a closer look to see where we would get the offset and count properties for drawArrays (probably as optional properties on mesh.primitive) since they would no longer come from the accessor. I'll follow-up with an example.

@pjcozzi pjcozzi mentioned this issue Sep 1, 2015
8 tasks
@mlimper
Copy link
Contributor

mlimper commented Sep 16, 2015

Within our SRC Paper, we used count for all accessors, but we didn't consider offset at that point (see the example JSON at the end of the paper).

@pjcozzi
Copy link
Member Author

pjcozzi commented Sep 16, 2015

@mlimper are you suggesting that we simply make mesh.primitive.indices optional, and when it is not provided, then the count from any accessor referenced from the primitive's attributes (which is the same for all of them) can be used in a call to drawArrays with offset = 0.

I think that would work just fine. Please confirm.

@mlimper
Copy link
Contributor

mlimper commented Sep 16, 2015

I think that would work just fine. Please confirm.

Yes, confirmed! Thanks for the clarification.

@pjcozzi
Copy link
Member Author

pjcozzi commented Sep 16, 2015

I updated the draft 1.0 schema in 740ac80.

@tfili I'm leaving this issue open and labeled as converter so you can update the converter (and Cesium loader).

@tparisi here's some text for the draft 1.0 spec (perhaps as an Implementation Note):


Primitive

Each primitive in mesh.primitives corresponds to one WebGL draw call (engines are, of course, free to batch draw calls). When primitive.indices is defined, it references the accessor to use for index data, and GL's drawElements function should be used. When primitive.indices is not defined, GL's drawArrays function should be used with a count equal to the count property of any of the accessors referenced by primitive.attributes (they are all equal for a given primitive).

@tparisi tparisi closed this as completed Sep 16, 2015
@pjcozzi
Copy link
Member Author

pjcozzi commented Sep 16, 2015

@tparisi I'm leaving this open and labeled converter for the converter changes.

@pjcozzi pjcozzi reopened this Sep 16, 2015
@pjcozzi
Copy link
Member Author

pjcozzi commented Oct 1, 2015

Discussed this with @tfili. It could be a few days due to an OpenCOLLADA issue so the converter work here may get pushed post 1.0 since these models are not common in the wild.

@RemiArnaud
Copy link
Contributor

Is there an OpenCOLLADA Pull Request ?

@pjcozzi
Copy link
Member Author

pjcozzi commented Oct 28, 2015

@tfili I am fine with dropping the post 1.0 label from this, updating the limitations wiki, and just doing it when it becomes priority.

If you agree, please remove the label and update the wiki.

@pjcozzi
Copy link
Member Author

pjcozzi commented Oct 12, 2016

@tfili can you confirm that we can close this now since indices are not required?

@pjcozzi
Copy link
Member Author

pjcozzi commented Dec 23, 2017

@pjcozzi pjcozzi closed this as completed Dec 23, 2017
javagl added a commit to javagl/glTF that referenced this issue Mar 8, 2022
Change featureIds dictionary back to array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants