Skip to content

Conversation

@sunag
Copy link
Collaborator

@sunag sunag commented May 27, 2023

Description

This update is a continuation of this PR ( #26140 ) which includes the coordinate system for WebGPU. This approach allows CubeCamera to get the .coordinateSystem from the Renderer and update the settings if necessary. The update also makes some improvements to RTT regarding cache usage in case the application need to change many times the Tone Mapping and Color Space.

three.js.webgpu.-.dynamic.cube.reflection.-.Google.Chrome.2023-05-27.06-27-14.1.mp4

@github-actions
Copy link

github-actions bot commented May 27, 2023

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
643.4 kB (159.4 kB) 644.1 kB (159.5 kB) +645 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
433.5 kB (105 kB) 434.1 kB (105.1 kB) +643 B

@sunag
Copy link
Collaborator Author

sunag commented May 30, 2023

@mrdoob I'm already very close to the IBL expected result in WebGPU for Equirectangular Textures.

WebGPU WebGL
image image

Textures

One thing has been bugging me for a while, it seems we have a texture configuration policy in three.js. Texture settings are often tweaked overriding the defined settings automatically. I'll give you an example:

new RGBELoader()
.setPath( 'textures/equirectangular/' )
.load( 'royal_esplanade_1k.hdr', function ( texture ) {
texture.mapping = THREE.EquirectangularReflectionMapping;
scene.background = texture;
scene.environment = texture;

image

The settings are:

texture.minFilter = THREE.LinearFilter;
texture.generateMipmaps = false;
//texture.needsPMREMUpdate = false;

Texture settings are converted to

texture.minFilter = THREE.LinearMipmapLinearFilter;
texture.generateMipmaps = true;
//texture.needsPMREMUpdate = true;

This is something I'm going to implement it texture configuration policy in the WebGPU to maintain backwards compatibility I think... I don't know if we can change that at this point, or if there is one description to this somewhere that I haven't noticed.

/cc @mrdoob @Mugen87 @LeviPesin

@mrdoob mrdoob added this to the r153 milestone May 30, 2023
@mrdoob
Copy link
Owner

mrdoob commented May 30, 2023

Is this the line you're referring to?

if ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;

@sunag
Copy link
Collaborator Author

sunag commented May 30, 2023

I think that would be it:

if ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {

Both Equirectangular*Mapping and Cube*Mapping are converted to PMREM, as normally IBL relies on mipmaps whether prefiltered or not, the descriptions I wrote in the previous post about replace the settings automatically I think it's closer to the original intention or expectation since the user would not have access to the PMREM texture. I think that we could say that Equirectangular*Mapping and Cube*Mapping are the predominant settings.

@sunag sunag merged commit 517ce63 into mrdoob:dev May 30, 2023
@sunag sunag deleted the dev-cube-rtt branch May 31, 2023 17:17
@Methuselah96 Methuselah96 mentioned this pull request Jun 4, 2023
45 tasks
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.

3 participants