-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Example: Update GPU picking to use integer Ids, target #25983
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
Conversation
| const position = geometry.attributes.position; | ||
| const array = new Int32Array( position.count ); | ||
| array.fill( id ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once #21606 is merged I would like to change this to an Int16 array and use the new "integer" declaration field here.
| clearColor.setRGB( - 1, - 1, - 1 ); | ||
| renderer.setClearColor( clearColor ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge deal but setting the clear color to something not representable with a hex value is a bit inconvenient here since it requires creating an intermediate color object.
Related issue: #25952 (comment)
Description
Updates the GPU picking example to use an integer vertex attribute, 32 bit integer target for rendering rather than the color-based approach that required using bit shifts on color values to reconstitute the id.
Note - I realized that no changes were needed to ShaderMaterial in order to enable rendering to an integer target since using GLSL3 enables control over the output type.
edit: also addresses and issue that was causing the 0th box to be selected when hovering over the background