Skip to content

Conversation

@takahirox
Copy link
Collaborator

This PR adds BasisTextureLoader example.

Live demo: https://raw.githack.com/takahirox/three.js/BasisTextureLoaderExample/examples/index.html#webgl_loader_texture_basis

kodim20.basis is from https://github.com/BinomialLLC/basis_universal/tree/master/webgl/texture/assets

I think this example may be too simple. But better than no example. Users can see the loader works and know the API from the example. Please feel free to replace with a cool and/or interesting one later.

#16524

@takahirox takahirox mentioned this pull request May 24, 2019
12 tasks
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BasisTextureLoader currently marks all textures as sRGB:

texture.minFilter = THREE.LinearMipMapLinearFilter;
texture.magFilter = THREE.LinearFilter;
texture.encoding = THREE.sRGBEncoding;
texture.generateMipmaps = false;
texture.flipY = false;
texture.needsUpdate = true;
return texture;

We should probably remove that, and the flipY=false preset, which both made sense in the original Basis example but not so much in a general-purpose texture loader.

My suggestion for this PR would be:

  • Remove flipY=false and encoding=sRGBEncoding from the loader
  • Add encoding=sRGBEncoding after loading the texture (in the example itself)
  • set renderer.gammaOutput=true, renderer.gammaFactor=2.2 as best practice.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove flipY = false from the loader

flipY = true doesn't seem to work for compressed texture and default CompressedTexture.flipY is false. Removing from the loader looks right direction. Updated.

Move encoding = sRGBEncoding into example

Updated.

renderer.gammaOutput = true, renderer.gammaFactor=2.2

Thanks, I missed them. Updated.

@donmccurdy
Copy link
Collaborator

Good to have simple examples, I think!

@WestLangley
Copy link
Collaborator

Personally, I would just copy the other webgl_loader_texture_xxx examples.

https://raw.githack.com/takahirox/three.js/BasisTextureLoaderExample/examples/index.html?q=hdr#webgl_loader_texture_hdr

@takahirox
Copy link
Collaborator Author

takahirox commented May 24, 2019

Thanks for the reviews.

Personally, I would just copy the other webgl_loader_texture_xxx examples.

The reason why I didn't copy but made a new example rotating cube is I wanted to show transcode doesn't block main thread.

Replying to the other comments will be tomorrow (or later).

@mrdoob
Copy link
Owner

mrdoob commented May 28, 2019

Screen Shot 2019-05-27 at 7 37 46 PM

Is this expected?

@takahirox
Copy link
Collaborator Author

No. And I can't reproduce here... The root issue seems the server 504 error? Does it still happen even if you reload?

@mrdoob
Copy link
Owner

mrdoob commented May 28, 2019

Weird, I can no longer reproduce...

@mrdoob mrdoob added this to the r105 milestone May 28, 2019
@mrdoob mrdoob merged commit 553e379 into mrdoob:dev May 28, 2019
@mrdoob
Copy link
Owner

mrdoob commented May 28, 2019

Thanks!

@takahirox takahirox deleted the BasisTextureLoaderExample branch May 28, 2019 07:14
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