Skip to content

Commit d58f3e9

Browse files
committed
Revert "WebGLRenderer: Remove RGBEEncoding and RGBEFormat. (mrdoob#23060)"
This reverts commit cee9706.
1 parent 73b9411 commit d58f3e9

24 files changed

+127
-15
lines changed

docs/api/en/constants/Textures.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ <h2>Formats</h2>
151151
THREE.RGBAIntegerFormat
152152
THREE.LuminanceFormat
153153
THREE.LuminanceAlphaFormat
154+
THREE.RGBEFormat
154155
THREE.DepthFormat
155156
THREE.DepthStencilFormat
156157
</code>
@@ -198,6 +199,8 @@ <h2>Formats</h2>
198199
The same process occurs as for the [page:constant LuminanceFormat], except that the
199200
alpha channel may have values other than *1.0*.<br /><br />
200201

202+
[page:constant RGBEFormat] is identical to [page:constant RGBAFormat].<br /><br />
203+
201204
[page:constant DepthFormat] reads each element as a single depth value, converts it to floating point, and clamps to the range [0,1].
202205
This is the default for [page:DepthTexture DepthTexture].<br /><br />
203206

@@ -556,6 +559,7 @@ <h2>Encoding</h2>
556559
<code>
557560
THREE.LinearEncoding
558561
THREE.sRGBEncoding
562+
THREE.RGBEEncoding
559563
THREE.BasicDepthPacking
560564
THREE.RGBADepthPacking
561565
</code>

docs/api/en/extras/PMREMGenerator.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ <h3>[method:WebGLRenderTarget fromEquirectangular]( [param:Texture equirectangul
4242
<p>
4343
[page:Texture equirectangular] - The equirectangular texture.<br /><br />
4444

45-
Generates a PMREM from an equirectangular texture, which can be either LDR or HDR.
45+
Generates a PMREM from an equirectangular texture, which can be either LDR (RGBFormat) or HDR (RGBEFormat).
4646
The ideal input image size is 1k (1024 x 512), as this matches best with the 256 x 256 cubemap output.
4747
</p>
4848

4949
<h3>[method:WebGLRenderTarget fromCubemap]( [param:CubeTexture cubemap] )</h3>
5050
<p>
5151
[page:CubeTexture cubemap] - The cubemap texture.<br /><br />
5252

53-
Generates a PMREM from an cubemap texture, which can be either LDR or HDR.
53+
Generates a PMREM from an cubemap texture, which can be either LDR (RGBFormat) or HDR (RGBEFormat).
5454
The ideal input cube size is 256 x 256, as this matches best with the 256 x 256 cubemap output.
5555
</p>
5656

docs/api/ko/constants/Textures.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ <h2>포맷</h2>
148148
THREE.RGBAIntegerFormat
149149
THREE.LuminanceFormat
150150
THREE.LuminanceAlphaFormat
151+
THREE.RGBEFormat
151152
THREE.DepthFormat
152153
THREE.DepthStencilFormat
153154
</code>
@@ -194,6 +195,8 @@ <h2>포맷</h2>
194195
The same process occurs as for the [page:constant LuminanceFormat]와 같은 절차가 이루어지며, 알파 채널에 *1.0* 이외의 값이 들어갈 수 있다는 점만 다릅니다.
195196
<br /><br />
196197

198+
[page:constant RGBEFormat]은 [page:constant RGBAFormat]과 동일합니다..<br /><br />
199+
197200
[page:constant DepthFormat]은 각 요소를 단일 깊이 값으로 일거들이며 부동 소수점으로 변환하고, [0,1]범위에 고정합니다.
198201
[page:DepthTexture DepthTexture]의 기본값이기도 합니다.<br /><br />
199202

@@ -550,6 +553,7 @@ <h2>인코딩</h2>
550553
<code>
551554
THREE.LinearEncoding
552555
THREE.sRGBEncoding
556+
THREE.RGBEEncoding
553557
THREE.BasicDepthPacking
554558
THREE.RGBADepthPacking
555559
</code>

docs/api/ko/extras/PMREMGenerator.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h1>[name]</h1>
1111

1212
<p class="desc">
1313
이 클래스는 큐브맵 환경 텍스처로부터 사전 필터링된 Mipmap Radiance Environment Map(PMREM)을 생성합니다.
14-
이를 통해 재질의 거칠기에 따라 다양한 수준의 블러를 빠르게 적용할 수 있습니다. RGBE와 같은 비선형 형식을 지원할 수 있도록 사용자 지정 보간을 수행할 수 있는 특수 CubeUV 형식으로 포장되어 있습니다.
14+
이를 통해 재질의 거칠기에 따라 다양한 수준의 블러를 빠르게 적용할 수 있습니다. RGBE와 같은 비선형 형식을 지원할 수 있도록 사용자 지정 보간을 수행할 수 있는 특수 CubeUV 형식으로 포장되어 있습니다.
1515
기존의 mipmap 체인과는 달리, LOD_MIN 수준까지만 내려가며(위), 더 높은 거칠기 수준과 연관된 동일한 LOD_MIN 해상도에서 훨씬 더 많은 필터링된 'mips'를 생성합니다.
1616
이러한 방법으로 샘플링 계산을 제한하면서 확산 조명을 부드럽게 보간하기 위한 해상도를 유지합니다.
1717
</p>
@@ -40,15 +40,15 @@ <h3>[method:WebGLRenderTarget fromEquirectangular]( [param:Texture equirectangul
4040
<p>
4141
[page:Texture equirectangular] - 등장방형 텍스쳐입니다.<br /><br />
4242

43-
LDR 또는 HDR일 수 있는 등장방형 텍스처로부터 PMREM을 생성합니다.
43+
LDR(RGBFormat) 또는 HDR(RGBEFormat)일 수 있는 등장방형 텍스처로부터 PMREM을 생성합니다.
4444
이상적인 입력 이미지 크기는 1k(1024 x 512)로, 256 x 256 큐브 맵 출력과 가장 잘 일치합니다.
4545
</p>
4646

4747
<h3>[method:WebGLRenderTarget fromCubemap]( [param:CubeTexture cubemap] )</h3>
4848
<p>
4949
[page:CubeTexture cubemap] - 큐브맵 텍스쳐입니다.<br /><br />
5050

51-
LDR 또는 HDR일 수 있는 큐브맵 텍스처로부터 PMREM을 생성합니다.
51+
LDR(RGBFormat) 또는 HDR(RGBEFormat)일 수 있는 큐브맵 텍스처로부터 PMREM을 생성합니다.
5252
이상적인 입력 이미지 크기는 1k(1024 x 512)로, 256 x 256 큐브 맵 출력과 가장 잘 일치합니다.
5353
</p>
5454

@@ -64,8 +64,8 @@ <h3>[method:undefined compileEquirectangularShader]()</h3>
6464

6565
<h3>[method:undefined dispose]()</h3>
6666
<p>
67-
PMREM 제너레이터의 내장 메모리를 폐기합니다.
68-
PMREMGenerator는 정적 클래스이므로 두 개 이상의 PMREMGenerator 개체가 필요하지 않습니다.
67+
PMREM 제너레이터의 내장 메모리를 폐기합니다.
68+
PMREMGenerator는 정적 클래스이므로 두 개 이상의 PMREMGenerator 개체가 필요하지 않습니다.
6969
이 경우 둘 중 하나에 대해 dispose()를 호출하면 다른 항목도 사용할 수 없게 됩니다.
7070
</p>
7171

docs/api/zh/constants/Textures.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ <h2>格式</h2>
141141
THREE.RGBAIntegerFormat
142142
THREE.LuminanceFormat
143143
THREE.LuminanceAlphaFormat
144+
THREE.RGBEFormat
144145
THREE.DepthFormat
145146
THREE.DepthStencilFormat
146147
</code>
@@ -184,6 +185,8 @@ <h2>格式</h2>
184185
[page:constant LuminanceAlphaFormat] 将每个元素同时作为亮度分量和Alpha分量来读取。
185186
和上面[page:constant LuminanceFormat]的处理过程是一致的,除了Alpha分量具有除了*1.0*以外的值。<br /><br />
186187

188+
[page:constant RGBEFormat] 与 [page:constant RGBAFormat] 是相同的。<br /><br />
189+
187190
[page:constant DepthFormat]将每个元素作为单独的深度值来读取,将其转换为范围限制在[0,1]区间的浮点数。
188191
它是[page:DepthTexture DepthTexture]的默认值。<br /><br />
189192

@@ -545,6 +548,7 @@ <h2>编码</h2>
545548
<code>
546549
THREE.LinearEncoding
547550
THREE.sRGBEncoding
551+
THREE.RGBEEncoding
548552
THREE.BasicDepthPacking
549553
THREE.RGBADepthPacking
550554
</code>

docs/api/zh/extras/PMREMGenerator.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ <h3>[method:WebGLRenderTarget fromEquirectangular]( [param:Texture equirectangul
4242
<p>
4343
[page:Texture equirectangular] - The equirectangular texture.<br /><br />
4444

45-
Generates a PMREM from an equirectangular texture, which can be either LDR or HDR.
45+
Generates a PMREM from an equirectangular texture, which can be either LDR (RGBFormat) or HDR (RGBEFormat).
4646
The ideal input image size is 1k (1024 x 512), as this matches best with the 256 x 256 cubemap output.
4747
</p>
4848

4949
<h3>[method:WebGLRenderTarget fromCubemap]( [param:CubeTexture cubemap] )</h3>
5050
<p>
5151
[page:CubeTexture cubemap] - The cubemap texture.<br /><br />
5252

53-
Generates a PMREM from an cubemap texture, which can be either LDR or HDR.
53+
Generates a PMREM from an cubemap texture, which can be either LDR (RGBFormat) or HDR (RGBEFormat).
5454
The ideal input cube size is 256 x 256, as this matches best with the 256 x 256 cubemap output.
5555
</p>
5656

editor/js/libs/ui.three.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class UITexture extends UISpan {
5656

5757
// assuming RGBE/Radiance HDR iamge format
5858

59-
const loader = new RGBELoader();
59+
const loader = new RGBELoader().setDataType( THREE.FloatType );
6060
loader.load( event.target.result, function ( hdrTexture ) {
6161

6262
hdrTexture.sourceFile = file.name;

examples/jsm/loaders/HDRCubeTextureLoader.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import {
77
LinearEncoding,
88
LinearFilter,
99
Loader,
10-
RGBFormat
10+
NearestFilter,
11+
RGBAFormat,
12+
RGBEEncoding,
13+
RGBFormat,
14+
UnsignedByteType
1115
} from '../../../build/three.module.js';
1216
import { RGBELoader } from '../loaders/RGBELoader.js';
1317

@@ -43,6 +47,15 @@ class HDRCubeTextureLoader extends Loader {
4347

4448
switch ( texture.type ) {
4549

50+
case UnsignedByteType:
51+
52+
texture.encoding = RGBEEncoding;
53+
texture.format = RGBAFormat;
54+
texture.minFilter = NearestFilter;
55+
texture.magFilter = NearestFilter;
56+
texture.generateMipmaps = false;
57+
break;
58+
4659
case FloatType:
4760

4861
texture.encoding = LinearEncoding;

examples/jsm/loaders/RGBELoader.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import {
55
HalfFloatType,
66
LinearEncoding,
77
LinearFilter,
8+
NearestFilter,
9+
RGBEEncoding,
10+
RGBEFormat,
811
RGBFormat,
12+
UnsignedByteType
913
} from '../../../build/three.module.js';
1014

1115
// https://github.com/mrdoob/three.js/issues/5552
@@ -374,6 +378,13 @@ class RGBELoader extends DataTextureLoader {
374378

375379
switch ( this.type ) {
376380

381+
case UnsignedByteType:
382+
383+
data = image_rgba_data;
384+
format = RGBEFormat; // handled as THREE.RGBAFormat in shaders
385+
type = UnsignedByteType;
386+
break;
387+
377388
case FloatType:
378389

379390
numElements = image_rgba_data.length / 4;
@@ -444,6 +455,15 @@ class RGBELoader extends DataTextureLoader {
444455

445456
switch ( texture.type ) {
446457

458+
case UnsignedByteType:
459+
460+
texture.encoding = RGBEEncoding;
461+
texture.minFilter = NearestFilter;
462+
texture.magFilter = NearestFilter;
463+
texture.generateMipmaps = false;
464+
texture.flipY = true;
465+
break;
466+
447467
case FloatType:
448468

449469
texture.encoding = LinearEncoding;

examples/jsm/nodes/utils/ColorSpaceNode.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
LinearEncoding,
3+
RGBEEncoding,
34
sRGBEncoding
45
} from '../../../../build/three.module.js';
56

@@ -122,10 +123,31 @@ ColorSpaceNode.Nodes = ( function () {
122123
}`
123124
);
124125

126+
const RGBEToLinear = new FunctionNode( /* glsl */`
127+
vec4 RGBEToLinear( in vec4 value ) {
128+
129+
return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
130+
131+
}`
132+
);
133+
134+
const LinearToRGBE = new FunctionNode( /* glsl */`
135+
vec4 LinearToRGBE( in vec4 value ) {
136+
137+
float maxComponent = max( max( value.r, value.g ), value.b );
138+
float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
139+
return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
140+
141+
}`
142+
);
143+
144+
125145
return {
126146
LinearToLinear: LinearToLinear,
127147
sRGBToLinear: sRGBToLinear,
128-
LinearTosRGB: LinearTosRGB
148+
LinearTosRGB: LinearTosRGB,
149+
RGBEToLinear: RGBEToLinear,
150+
LinearToRGBE: LinearToRGBE
129151
};
130152

131153
} )();
@@ -135,6 +157,9 @@ ColorSpaceNode.LINEAR_TO_LINEAR = 'LinearToLinear';
135157
ColorSpaceNode.SRGB_TO_LINEAR = 'sRGBToLinear';
136158
ColorSpaceNode.LINEAR_TO_SRGB = 'LinearTosRGB';
137159

160+
ColorSpaceNode.RGBE_TO_LINEAR = 'RGBEToLinear';
161+
ColorSpaceNode.LINEAR_TO_RGBE = 'LinearToRGBE';
162+
138163
ColorSpaceNode.getEncodingComponents = function ( encoding ) {
139164

140165
switch ( encoding ) {
@@ -143,6 +168,13 @@ ColorSpaceNode.getEncodingComponents = function ( encoding ) {
143168
return [ 'Linear' ];
144169
case sRGBEncoding:
145170
return [ 'sRGB' ];
171+
<<<<<<< HEAD
172+
=======
173+
case RGBEEncoding:
174+
return [ 'RGBE' ];
175+
case GammaEncoding:
176+
return [ 'Gamma', new ExpressionNode( 'float( GAMMA_FACTOR )', 'f' ) ];
177+
>>>>>>> parent of cee9706c1c... WebGLRenderer: Remove RGBEEncoding and RGBEFormat. (#23060)
146178

147179
}
148180

0 commit comments

Comments
 (0)