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

Examples: Fix broken GPU picking demo. #25952

Merged
merged 2 commits into from
Apr 29, 2023
Merged

Examples: Fix broken GPU picking demo. #25952

merged 2 commits into from
Apr 29, 2023

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Apr 28, 2023

Related issue: https://discourse.threejs.org/t/how-can-i-render-400000-polygons-mesh/50957/12

Description

webgl_interactive_cubes_gpu is broken because the picking does not work anymore. The reason for this is the enabled color management and the fact that the render target holds sRGB values without specifying the right color space.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Apr 28, 2023

@Mugen87 Mugen87 marked this pull request as ready for review April 28, 2023 10:32
@WestLangley
Copy link
Collaborator

I would do this, instead:

// give the geometry's vertices a color corresponding to the "id"

applyVertexColors( geometry, color.setHex( i, THREE.NoColorSpace ) );

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Apr 28, 2023

Yep, that works as well. I'm open for all configurations...

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Apr 28, 2023

Updated the PR so the THREE.NoColorSpace option is used.

@donmccurdy
Copy link
Collaborator

Oops sorry, I missed @WestLangley's comment! I'm fine with this as it is too. :)

@Mugen87 Mugen87 added this to the r153 milestone Apr 29, 2023
@Mugen87 Mugen87 merged commit bbd1fda into mrdoob:dev Apr 29, 2023
@gkjohnson
Copy link
Collaborator

gkjohnson commented Apr 29, 2023

This is a larger change but imo with WebGL2 now broadly supported this is the kind of thing that should be rendering to an Red Integer buffer instead of using colors or even floats.

I'd be happy to make a PR to update and modernize this gpu picking example if people are supportive. It would require merging #22351 (or something similar), though, since it's currently not possible to clear integer targets in three.js. WebGPU will bring the ability for a lot more GPGPU capabilities so it would be nice to start considering APIs these types of targets that are useful for it.

cc @mrdoob

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.

4 participants