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

Add BasisTextureLoader #16522

Merged
merged 1 commit into from
May 22, 2019
Merged

Conversation

donmccurdy
Copy link
Collaborator

Basis Universal announcement. 🎉

Thanks to @shrekshao and @austinEng for their help with the WASM transcoder and WebGL integration, and to Binomial for the Basis universal format and tooling (GitHub).

The loader in this PR is similar to the one used in the Basis demos, with some enhancements. Transcoding is handled in a Web Worker, and multiple textures can be transcoded in parallel with multiple workers. Several TODOs remain in the code. I plan to fix them, but the loader is functional in the meantime.

Basis will be the foundation for compressed texture support in glTF, per Khronos blog post.

@takahirox
Copy link
Collaborator

Nice work. Will an example (examples/webgl_texture_basis.html or something) be in another PR?

@donmccurdy
Copy link
Collaborator Author

Probably another PR, yeah. In the meantime:

const loader = new THREE.BasisTextureLoader();

// Order doesn't matter. Detecting supported formats requires
// a WebGL context. The transcoder path should contain a
// JS wrapper and WASM binary with predetermined names. The
// maxWorkers option is used to avoid conflicts with other
// application services that may need workers.
loader.detectSupport( renderer );
loader.setTranscoderPath( './basis/' );
loader.setMaxWorkers( 4 );

loader.load( './assets/diffuse.basis', ( texture ) => {

	material.map = texture;
	
	render();

} );

Just realized I didn't add the setMaxWorkers method yet.

@takahirox
Copy link
Collaborator

OK, looking forward to seeing an example. And thanks for sharing API.

@titansoftime
Copy link
Contributor

I'm excited to try this!

@donmccurdy donmccurdy changed the title Add BasisTextureLoader. Add BasisTextureLoader May 22, 2019
@mrdoob mrdoob added this to the r105 milestone May 22, 2019
@mrdoob mrdoob merged commit 93abece into mrdoob:dev May 22, 2019
@mrdoob
Copy link
Owner

mrdoob commented May 22, 2019

Thanks!

@donmccurdy donmccurdy deleted the feat-basistextureloader branch May 22, 2019 21:09
@donmccurdy donmccurdy mentioned this pull request May 22, 2019
12 tasks
@donmccurdy
Copy link
Collaborator Author

Opened #16524 to track next steps on this loader.

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