diff --git a/docs/api/en/materials/MeshPhysicalMaterial.html b/docs/api/en/materials/MeshPhysicalMaterial.html
index f840341e8049d2..8d45d51975e27d 100644
--- a/docs/api/en/materials/MeshPhysicalMaterial.html
+++ b/docs/api/en/materials/MeshPhysicalMaterial.html
@@ -188,7 +188,9 @@
[property:Float transmission]
The transmission property can be used to model these materials.
- When transmission is non-zero, [page:Material.opacity opacity] should be set to *1*.
+ When transmission is non-zero, [page:Material.opacity opacity] should be set to *1*.
+
+ This feature can only be used with a WebGL 2 rendering context.
[property:Texture transmissionMap]
diff --git a/docs/api/zh/materials/MeshPhysicalMaterial.html b/docs/api/zh/materials/MeshPhysicalMaterial.html
index 46ea81744ae8dc..de6a952535affe 100644
--- a/docs/api/zh/materials/MeshPhysicalMaterial.html
+++ b/docs/api/zh/materials/MeshPhysicalMaterial.html
@@ -184,7 +184,9 @@ [property:Float transmission]
The transmission property can be used to model these materials.
- When transmission is non-zero, [page:Material.opacity opacity] should be set to *1*.
+ When transmission is non-zero, [page:Material.opacity opacity] should be set to *1*.
+
+ This feature can only be used with a WebGL 2 rendering context.
[property:Texture transmissionMap]
diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js
index 6f18ef683b68c5..9472e1a53bbfef 100644
--- a/src/renderers/WebGLRenderer.js
+++ b/src/renderers/WebGLRenderer.js
@@ -9,12 +9,11 @@ import {
UnsignedByteType,
LinearEncoding,
NoToneMapping,
- LinearMipmapLinearFilter,
- NearestFilter,
- ClampToEdgeWrapping
+ LinearMipmapLinearFilter
} from '../constants.js';
import { Frustum } from '../math/Frustum.js';
import { Matrix4 } from '../math/Matrix4.js';
+import { Vector2 } from '../math/Vector2.js';
import { Vector3 } from '../math/Vector3.js';
import { Vector4 } from '../math/Vector4.js';
import { WebGLAnimation } from './webgl/WebGLAnimation.js';
@@ -170,6 +169,7 @@ function WebGLRenderer( parameters = {} ) {
const _projScreenMatrix = new Matrix4();
+ const _vector2 = new Vector2();
const _vector3 = new Vector3();
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
@@ -1184,23 +1184,33 @@ function WebGLRenderer( parameters = {} ) {
function renderTransmissionPass( opaqueObjects, scene, camera ) {
+ if ( capabilities.isWebGL2 === false ) {
+
+ console.error( 'THREE.WebGLRenderer: Transmission can only be used with WebGL 2.' );
+ return;
+
+ }
+
if ( _transmissionRenderTarget === null ) {
- const needsAntialias = _antialias === true && capabilities.isWebGL2 === true;
- const renderTargetType = needsAntialias ? WebGLMultisampleRenderTarget : WebGLRenderTarget;
+ const renderTargetType = ( _antialias === true ) ? WebGLMultisampleRenderTarget : WebGLRenderTarget;
- _transmissionRenderTarget = new renderTargetType( 1024, 1024, {
+ _transmissionRenderTarget = new renderTargetType( 1, 1, {
generateMipmaps: true,
- type: utils.convert( HalfFloatType ) !== null ? HalfFloatType : UnsignedByteType,
+ type: HalfFloatType,
minFilter: LinearMipmapLinearFilter,
- magFilter: NearestFilter,
- wrapS: ClampToEdgeWrapping,
- wrapT: ClampToEdgeWrapping,
useRenderToTexture: extensions.has( 'WEBGL_multisampled_render_to_texture' )
} );
}
+ // set size of transmission render target to half size of drawing buffer
+
+ _this.getDrawingBufferSize( _vector2 ).multiplyScalar( 0.5 ).floor();
+ _transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
+
+ //
+
const currentRenderTarget = _this.getRenderTarget();
_this.setRenderTarget( _transmissionRenderTarget );
_this.clear();
@@ -1786,7 +1796,7 @@ function WebGLRenderer( parameters = {} ) {
// are midframe flushes and an external depth buffer. Disable use of the extension.
if ( renderTarget.useRenderToTexture ) {
- console.warn( 'render-to-texture extension was disabled because an external texture was provided' );
+ console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
renderTarget.useRenderToTexture = false;
renderTarget.useRenderbuffer = true;