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

A question about [[vertex_id]] #1

Open
zhrit opened this issue Sep 17, 2021 · 2 comments
Open

A question about [[vertex_id]] #1

zhrit opened this issue Sep 17, 2021 · 2 comments

Comments

@zhrit
Copy link

zhrit commented Sep 17, 2021

In voxelization.metal, vid [[ vertex_id ]] is used to get face id (via vid / 3).
I have a question about the range of the 'vid.
For example, if the vertex count is 4, and the indices count is 12, then what the range of vid ? [0-3] or [0-11]?
If the range of vid is [0-3], face_id=vid/3 would be wrong.
I have tried on OpenGL, the range of vid is [0-3] actually, so how about Metal?

@kakashidinho
Copy link
Owner

[[vertex_id]] would return the index value from index buffer if you use drawElements style similar to GL.
But in this demo, I don't use drawElements , I use drawArrays and read the index buffer directly inside vertex shader myself.
So in my case with drawArrays(100), [[vertex_id]] would refer to an id from [0-99]

@zhrit
Copy link
Author

zhrit commented Sep 17, 2021

I see, thanks for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants