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

Use number of indices instead of vertices when setting draw range #23435

Merged
merged 2 commits into from
Feb 6, 2022

Conversation

jure
Copy link
Contributor

@jure jure commented Feb 6, 2022

Description

The GPGPU examples with GLTF birds uses vertices per bird as a way to set the draw range. Since this is indexed geometry this results in a rather sad looking flamingo (in fact even if the count is set to 2, it barely draws one bird):

Screenshot 2022-02-06 at 00 58 22

Using the number of indices instead fixes this. Look at this pretty bird:

Screenshot 2022-02-06 at 01 01 16

A side result is that there are now a lot more birds, before we were simulating them all but drawing only a part of their flock. :)

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 6, 2022

https://raw.githack.com/jure/three.js/fix_gpgpu_birds_draw_range/examples/webgl_gpgpu_birds_gltf.html

A side result is that there are now a lot more birds

Indeed, the example looks now a bit crowded. It's probably best to lower number of maximum birds from 4096 to 1024.

@jure
Copy link
Contributor Author

jure commented Feb 6, 2022

I've set the default number of birds to be 1/4th of the total number of birds, but still keep that maximum of 4096 as an option in the controls. The sizes of those textures seem appropriate and perform well and simulating 4096 of something shows the capabilities well. Does that sound reasonable?

@mrdoob mrdoob added this to the r138 milestone Feb 6, 2022
@mrdoob mrdoob merged commit e9be5a8 into mrdoob:dev Feb 6, 2022
@mrdoob
Copy link
Owner

mrdoob commented Feb 6, 2022

Thanks!

donmccurdy pushed a commit to donmccurdy/three.js that referenced this pull request Mar 10, 2022
…doob#23435)

* Use number of indices instead of vertices when setting draw range

* Set default number of birds to 1024
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

Successfully merging this pull request may close these issues.

3 participants