From 3e3d777642e3aa5c638cb355b03bfa7f8a67a1e5 Mon Sep 17 00:00:00 2001 From: Maxkang Date: Mon, 27 Apr 2026 20:03:59 +0800 Subject: [PATCH 1/2] Material: Fixed setValues() to honor Euler and Vector2 types. (#33476) Co-authored-by: Copilot Co-authored-by: Michael Herzog --- src/materials/Material.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/materials/Material.js b/src/materials/Material.js index c08a70e4f115ea..7ba34cd4777865 100644 --- a/src/materials/Material.js +++ b/src/materials/Material.js @@ -580,7 +580,11 @@ class Material extends EventDispatcher { currentValue.set( newValue ); - } else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) { + } else if ( + ( ( currentValue && currentValue.isVector2 ) && ( newValue && newValue.isVector2 ) ) || + ( ( currentValue && currentValue.isEuler ) && ( newValue && newValue.isEuler ) ) || + ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) + ) { currentValue.copy( newValue ); From b3aee86bbcbd5e1accc1226e1a384744c68957e5 Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Mon, 27 Apr 2026 15:56:21 +0200 Subject: [PATCH 2/2] WebGPURenderer: Support all BPTC formats. (#33482) --- src/nodes/pmrem/PMREMNode.js | 10 ++++++++-- src/renderers/webgl-fallback/utils/WebGLUtils.js | 6 ++++-- src/renderers/webgpu/utils/WebGPUTextureUtils.js | 12 ++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/nodes/pmrem/PMREMNode.js b/src/nodes/pmrem/PMREMNode.js index 1ff22170a64cb9..44b35fb104079a 100644 --- a/src/nodes/pmrem/PMREMNode.js +++ b/src/nodes/pmrem/PMREMNode.js @@ -5,6 +5,7 @@ import { uniform } from '../core/UniformNode.js'; import { NodeUpdateType } from '../core/constants.js'; import { nodeProxy, vec3 } from '../tsl/TSLBase.js'; +import { CubeUVReflectionMapping } from '../../constants.js'; import { Texture } from '../../textures/Texture.js'; import PMREMGenerator from '../../renderers/common/extras/PMREMGenerator.js'; import { materialEnvRotation } from '../accessors/MaterialProperties.js'; @@ -270,7 +271,7 @@ class PMREMNode extends TempNode { if ( pmremVersion !== texture.pmremVersion ) { - if ( texture.isPMREMTexture === true ) { + if ( texture.isPMREMTexture === true || texture.mapping === CubeUVReflectionMapping ) { pmrem = texture; @@ -314,7 +315,12 @@ class PMREMNode extends TempNode { // - uvNode = materialEnvRotation.mul( vec3( uvNode.x, uvNode.y.negate(), uvNode.z ) ); + // PMREMGenerator renders into a render target with inverted Y, so its output needs the Y + // flip on sampling. Externally authored PMREMs follow the standard convention and don't. + + uvNode = this._pmrem.isRenderTargetTexture + ? materialEnvRotation.mul( vec3( uvNode.x, uvNode.y.negate(), uvNode.z ) ) + : materialEnvRotation.mul( uvNode ); // diff --git a/src/renderers/webgl-fallback/utils/WebGLUtils.js b/src/renderers/webgl-fallback/utils/WebGLUtils.js index 1cf05bc93de85e..36798b0a20c1a8 100644 --- a/src/renderers/webgl-fallback/utils/WebGLUtils.js +++ b/src/renderers/webgl-fallback/utils/WebGLUtils.js @@ -1,4 +1,4 @@ -import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, SRGBTransfer, NoColorSpace, UnsignedInt101111Type } from '../../../constants.js'; +import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, SRGBTransfer, NoColorSpace, UnsignedInt101111Type } from '../../../constants.js'; import { ColorManagement } from '../../../math/ColorManagement.js'; /** @@ -212,13 +212,15 @@ class WebGLUtils { // BPTC - if ( p === RGBA_BPTC_Format ) { + if ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) { extension = extensions.get( 'EXT_texture_compression_bptc' ); if ( extension !== null ) { if ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT; + if ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT; + if ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT; } else { diff --git a/src/renderers/webgpu/utils/WebGPUTextureUtils.js b/src/renderers/webgpu/utils/WebGPUTextureUtils.js index e977ff186bac2e..3ef860a62f851b 100644 --- a/src/renderers/webgpu/utils/WebGPUTextureUtils.js +++ b/src/renderers/webgpu/utils/WebGPUTextureUtils.js @@ -14,8 +14,8 @@ import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, UnsignedIntType, UnsignedShortType, UnsignedInt248Type, UnsignedInt5999Type, NeverCompare, AlwaysCompare, LessCompare, LessEqualCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, IntType, RedIntegerFormat, RGIntegerFormat, RGBAIntegerFormat, - UnsignedInt101111Type, RGBA_BPTC_Format, RGB_ETC1_Format, RGB_S3TC_DXT1_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, - R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, + UnsignedInt101111Type, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_S3TC_DXT1_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, + SIGNED_RED_GREEN_RGTC2_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, Compatibility } from '../../../constants.js'; import { CubeTexture } from '../../../textures/CubeTexture.js'; @@ -1343,6 +1343,14 @@ export function getFormat( texture, device ) { formatGPU = ( transfer === SRGBTransfer ) ? GPUTextureFormat.BC7RGBAUnormSRGB : GPUTextureFormat.BC7RGBAUnorm; break; + case RGB_BPTC_SIGNED_Format: + formatGPU = GPUTextureFormat.BC6HRGBFloat; + break; + + case RGB_BPTC_UNSIGNED_Format: + formatGPU = GPUTextureFormat.BC6HRGBUFloat; + break; + case RGB_ETC2_Format: case RGB_ETC1_Format: formatGPU = ( transfer === SRGBTransfer ) ? GPUTextureFormat.ETC2RGB8UnormSRGB : GPUTextureFormat.ETC2RGB8Unorm;