Skip to content

WebGLRenderer: Enable half float attributes. #20587

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

Merged
merged 1 commit into from
Nov 2, 2020
Merged

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Oct 30, 2020

Related issues:

Fixed #15480.

Description

The PR introduces Float16BufferAttribute so the renderer can detect half float buffer attribute data and correctly set the gl.HALF_FLOAT type. The change does not contain automatic data conversion for now. I've realized this would cause more changes in WebGLAttributes since you have to support the initial buffer upload as well as buffer updates. So the app has to perform the conversion via DataUtils.toHalfFloat() for now. Support for automatic conversion can be added later if it turns out to be a dev pain.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Oct 30, 2020

Um, webgl_loader_texture_lottie is failing for some reasons. Locally, it looks good.

@mrdoob
Copy link
Owner

mrdoob commented Oct 31, 2020

Hmm, so Float16BufferAttribute expects a Uint16Array?

@mrdoob mrdoob added this to the r123 milestone Oct 31, 2020
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Oct 31, 2020

Yes. But I was hoping that at some point Float16Array is available so we could use it in Float16BufferAttribute.

@mrdoob
Copy link
Owner

mrdoob commented Oct 31, 2020

Indeed...
https://esdiscuss.org/topic/float16array

@mrdoob mrdoob merged commit 8e3b6b8 into mrdoob:dev Nov 2, 2020
@mrdoob
Copy link
Owner

mrdoob commented Nov 2, 2020

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented May 25, 2025

@Mugen87

Yes. But I was hoping that at some point Float16Array is available so we could use it in Float16BufferAttribute.

We can now!

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float16Array

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.

Half-float attribute support
2 participants