Skip to content

Commit a1fcf3f

Browse files
haxiomicmrdoob
andauthored
Support transmission roughness on WebGL1 (#23460)
* Support transmission roughness on WebGL1 * Update WebGLRenderer.js Co-authored-by: mrdoob <[email protected]>
1 parent a79cd86 commit a1fcf3f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/renderers/WebGLRenderer.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
UnsignedByteType,
1010
LinearEncoding,
1111
NoToneMapping,
12-
LinearFilter,
1312
LinearMipmapLinearFilter
1413
} from '../constants.js';
14+
import { floorPowerOfTwo } from '../math/MathUtils';
1515
import { Frustum } from '../math/Frustum.js';
1616
import { Matrix4 } from '../math/Matrix4.js';
1717
import { Vector2 } from '../math/Vector2.js';
@@ -1194,14 +1194,23 @@ function WebGLRenderer( parameters = {} ) {
11941194
_transmissionRenderTarget = new renderTargetType( 1, 1, {
11951195
generateMipmaps: true,
11961196
type: HalfFloatType,
1197-
minFilter: isWebGL2 ? LinearMipmapLinearFilter : LinearFilter,
1197+
minFilter: LinearMipmapLinearFilter,
11981198
useRenderToTexture: extensions.has( 'WEBGL_multisampled_render_to_texture' )
11991199
} );
12001200

12011201
}
12021202

12031203
_this.getDrawingBufferSize( _vector2 );
1204-
_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
1204+
1205+
if ( isWebGL2 ) {
1206+
1207+
_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
1208+
1209+
} else {
1210+
1211+
_transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );
1212+
1213+
}
12051214

12061215
//
12071216

0 commit comments

Comments
 (0)