Jelajahi Sumber

Examples: Removed webgl_shaders_tonemapping.

Mr.doob 2 tahun lalu
induk
melakukan
dc630b09c1

+ 0 - 1
docs/api/ar/cameras/OrthographicCamera.html

@@ -36,7 +36,6 @@
 			[example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
 			[example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
 			[example:webgl_rtt rtt ]<br />
-			[example:webgl_shaders_tonemapping shaders / tonemapping ]<br />
 			[example:webgl_shadowmap shadowmap ]
 		</p>
 

+ 0 - 1
docs/api/en/cameras/OrthographicCamera.html

@@ -36,7 +36,6 @@
 			[example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
 			[example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
 			[example:webgl_rtt rtt ]<br />
-			[example:webgl_shaders_tonemapping shaders / tonemapping ]<br />
 			[example:webgl_shadowmap shadowmap ]
 		</p>
 

+ 0 - 1
docs/api/fr/cameras/OrthographicCamera.html

@@ -37,7 +37,6 @@
 			[example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
 			[example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
 			[example:webgl_rtt rtt ]<br />
-			[example:webgl_shaders_tonemapping shaders / tonemapping ]<br />
 			[example:webgl_shadowmap shadowmap ]
 		</p>
 

+ 0 - 1
docs/api/it/cameras/OrthographicCamera.html

@@ -37,7 +37,6 @@
 			[example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
 			[example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
 			[example:webgl_rtt rtt ]<br />
-			[example:webgl_shaders_tonemapping shaders / tonemapping ]<br />
 			[example:webgl_shadowmap shadowmap ]
 		</p>
 

+ 0 - 1
docs/api/ko/cameras/OrthographicCamera.html

@@ -36,7 +36,6 @@
 			[example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
 			[example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
 			[example:webgl_rtt rtt ]<br />
-			[example:webgl_shaders_tonemapping shaders / tonemapping ]<br />
 			[example:webgl_shadowmap shadowmap ]
 		</p>
 

+ 0 - 1
docs/api/pt-br/cameras/OrthographicCamera.html

@@ -37,7 +37,6 @@
 			[example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
 			[example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
 			[example:webgl_rtt rtt ]<br />
-			[example:webgl_shaders_tonemapping shaders / tonemapping ]<br />
 			[example:webgl_shadowmap shadowmap ]
 		</p>
 

+ 0 - 1
docs/api/zh/cameras/OrthographicCamera.html

@@ -37,7 +37,6 @@
 			[example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
 			[example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
 			[example:webgl_rtt rtt ]<br />
-			[example:webgl_shaders_tonemapping shaders / tonemapping ]<br />
 			[example:webgl_shadowmap shadowmap ]
 		</p>
 

+ 0 - 1
examples/files.json

@@ -202,7 +202,6 @@
 		"webgl_shader_lava",
 		"webgl_shaders_ocean",
 		"webgl_shaders_sky",
-		"webgl_shaders_tonemapping",
 		"webgl_shadow_contact",
 		"webgl_shadowmap",
 		"webgl_shadowmap_performance",

+ 0 - 362
examples/jsm/postprocessing/AdaptiveToneMappingPass.js

@@ -1,362 +0,0 @@
-import {
-	HalfFloatType,
-	LinearMipmapLinearFilter,
-	MeshBasicMaterial,
-	NoBlending,
-	ShaderMaterial,
-	UniformsUtils,
-	WebGLRenderTarget
-} from 'three';
-import { Pass, FullScreenQuad } from './Pass.js';
-import { CopyShader } from '../shaders/CopyShader.js';
-import { LuminosityShader } from '../shaders/LuminosityShader.js';
-import { ToneMapShader } from '../shaders/ToneMapShader.js';
-
-/**
- * Generate a texture that represents the luminosity of the current scene, adapted over time
- * to simulate the optic nerve responding to the amount of light it is receiving.
- * Based on a GDC2007 presentation by Wolfgang Engel titled "Post-Processing Pipeline"
- *
- * Full-screen tone-mapping shader based on http://www.graphics.cornell.edu/~jaf/publications/sig02_paper.pdf
- */
-
-class AdaptiveToneMappingPass extends Pass {
-
-	constructor( adaptive, resolution ) {
-
-		super();
-
-		this.resolution = ( resolution !== undefined ) ? resolution : 256;
-		this.needsInit = true;
-		this.adaptive = adaptive !== undefined ? !! adaptive : true;
-
-		this.luminanceRT = null;
-		this.previousLuminanceRT = null;
-		this.currentLuminanceRT = null;
-
-		const copyShader = CopyShader;
-
-		this.copyUniforms = UniformsUtils.clone( copyShader.uniforms );
-
-		this.materialCopy = new ShaderMaterial( {
-
-			uniforms: this.copyUniforms,
-			vertexShader: copyShader.vertexShader,
-			fragmentShader: copyShader.fragmentShader,
-			blending: NoBlending,
-			depthTest: false
-
-		} );
-
-		this.materialLuminance = new ShaderMaterial( {
-
-			uniforms: UniformsUtils.clone( LuminosityShader.uniforms ),
-			vertexShader: LuminosityShader.vertexShader,
-			fragmentShader: LuminosityShader.fragmentShader,
-			blending: NoBlending
-		} );
-
-		this.adaptLuminanceShader = {
-			defines: {
-				'MIP_LEVEL_1X1': ( Math.log( this.resolution ) / Math.log( 2.0 ) ).toFixed( 1 )
-			},
-			uniforms: {
-				'lastLum': { value: null },
-				'currentLum': { value: null },
-				'minLuminance': { value: 0.01 },
-				'delta': { value: 0.016 },
-				'tau': { value: 1.0 }
-			},
-			vertexShader:
-				`varying vec2 vUv;
-
-				void main() {
-
-					vUv = uv;
-					gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
-
-				}`,
-
-			fragmentShader:
-				`varying vec2 vUv;
-
-				uniform sampler2D lastLum;
-				uniform sampler2D currentLum;
-				uniform float minLuminance;
-				uniform float delta;
-				uniform float tau;
-
-				void main() {
-
-					vec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );
-					vec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );
-
-					float fLastLum = max( minLuminance, lastLum.r );
-					float fCurrentLum = max( minLuminance, currentLum.r );
-
-					//The adaption seems to work better in extreme lighting differences
-					//if the input luminance is squared.
-					fCurrentLum *= fCurrentLum;
-
-					// Adapt the luminance using Pattanaik's technique
-					float fAdaptedLum = fLastLum + (fCurrentLum - fLastLum) * (1.0 - exp(-delta * tau));
-					// "fAdaptedLum = sqrt(fAdaptedLum);
-					gl_FragColor.r = fAdaptedLum;
-				}`
-
-		};
-
-		this.materialAdaptiveLum = new ShaderMaterial( {
-
-			uniforms: UniformsUtils.clone( this.adaptLuminanceShader.uniforms ),
-			vertexShader: this.adaptLuminanceShader.vertexShader,
-			fragmentShader: this.adaptLuminanceShader.fragmentShader,
-			defines: Object.assign( {}, this.adaptLuminanceShader.defines ),
-			blending: NoBlending
-		} );
-
-		this.materialToneMap = new ShaderMaterial( {
-
-			uniforms: UniformsUtils.clone( ToneMapShader.uniforms ),
-			vertexShader: ToneMapShader.vertexShader,
-			fragmentShader: ToneMapShader.fragmentShader,
-			blending: NoBlending
-		} );
-
-		this.fsQuad = new FullScreenQuad( null );
-
-	}
-
-	render( renderer, writeBuffer, readBuffer, deltaTime/*, maskActive*/ ) {
-
-		if ( this.needsInit ) {
-
-			this.reset( renderer );
-
-			this.luminanceRT.texture.type = readBuffer.texture.type;
-			this.previousLuminanceRT.texture.type = readBuffer.texture.type;
-			this.currentLuminanceRT.texture.type = readBuffer.texture.type;
-			this.needsInit = false;
-
-		}
-
-		if ( this.adaptive ) {
-
-			//Render the luminance of the current scene into a render target with mipmapping enabled
-			this.fsQuad.material = this.materialLuminance;
-			this.materialLuminance.uniforms.tDiffuse.value = readBuffer.texture;
-			renderer.setRenderTarget( this.currentLuminanceRT );
-			this.fsQuad.render( renderer );
-
-			//Use the new luminance values, the previous luminance and the frame delta to
-			//adapt the luminance over time.
-			this.fsQuad.material = this.materialAdaptiveLum;
-			this.materialAdaptiveLum.uniforms.delta.value = deltaTime;
-			this.materialAdaptiveLum.uniforms.lastLum.value = this.previousLuminanceRT.texture;
-			this.materialAdaptiveLum.uniforms.currentLum.value = this.currentLuminanceRT.texture;
-			renderer.setRenderTarget( this.luminanceRT );
-			this.fsQuad.render( renderer );
-
-			//Copy the new adapted luminance value so that it can be used by the next frame.
-			this.fsQuad.material = this.materialCopy;
-			this.copyUniforms.tDiffuse.value = this.luminanceRT.texture;
-			renderer.setRenderTarget( this.previousLuminanceRT );
-			this.fsQuad.render( renderer );
-
-		}
-
-		this.fsQuad.material = this.materialToneMap;
-		this.materialToneMap.uniforms.tDiffuse.value = readBuffer.texture;
-
-		if ( this.renderToScreen ) {
-
-			renderer.setRenderTarget( null );
-			this.fsQuad.render( renderer );
-
-		} else {
-
-			renderer.setRenderTarget( writeBuffer );
-
-			if ( this.clear ) renderer.clear();
-
-			this.fsQuad.render( renderer );
-
-		}
-
-	}
-
-	reset() {
-
-		// render targets
-		if ( this.luminanceRT ) {
-
-			this.luminanceRT.dispose();
-
-		}
-
-		if ( this.currentLuminanceRT ) {
-
-			this.currentLuminanceRT.dispose();
-
-		}
-
-		if ( this.previousLuminanceRT ) {
-
-			this.previousLuminanceRT.dispose();
-
-		}
-
-
-		this.luminanceRT = new WebGLRenderTarget( this.resolution, this.resolution, { type: HalfFloatType } );
-		this.luminanceRT.texture.name = 'AdaptiveToneMappingPass.l';
-		this.luminanceRT.texture.generateMipmaps = false;
-
-		this.previousLuminanceRT = new WebGLRenderTarget( this.resolution, this.resolution, { type: HalfFloatType } );
-		this.previousLuminanceRT.texture.name = 'AdaptiveToneMappingPass.pl';
-		this.previousLuminanceRT.texture.generateMipmaps = false;
-
-		// We only need mipmapping for the current luminosity because we want a down-sampled version to sample in our adaptive shader
-
-		const pars = { minFilter: LinearMipmapLinearFilter, generateMipmaps: true, type: HalfFloatType };
-
-		this.currentLuminanceRT = new WebGLRenderTarget( this.resolution, this.resolution, pars );
-		this.currentLuminanceRT.texture.name = 'AdaptiveToneMappingPass.cl';
-
-		if ( this.adaptive ) {
-
-			this.materialToneMap.defines[ 'ADAPTED_LUMINANCE' ] = '';
-			this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT.texture;
-
-		}
-
-		//Put something in the adaptive luminance texture so that the scene can render initially
-		this.fsQuad.material = new MeshBasicMaterial( { color: 0x777777 } );
-		this.materialLuminance.needsUpdate = true;
-		this.materialAdaptiveLum.needsUpdate = true;
-		this.materialToneMap.needsUpdate = true;
-		// renderer.render( this.scene, this.camera, this.luminanceRT );
-		// renderer.render( this.scene, this.camera, this.previousLuminanceRT );
-		// renderer.render( this.scene, this.camera, this.currentLuminanceRT );
-
-	}
-
-	setAdaptive( adaptive ) {
-
-		if ( adaptive ) {
-
-			this.adaptive = true;
-			this.materialToneMap.defines[ 'ADAPTED_LUMINANCE' ] = '';
-			this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT.texture;
-
-		} else {
-
-			this.adaptive = false;
-			delete this.materialToneMap.defines[ 'ADAPTED_LUMINANCE' ];
-			this.materialToneMap.uniforms.luminanceMap.value = null;
-
-		}
-
-		this.materialToneMap.needsUpdate = true;
-
-	}
-
-	setAdaptionRate( rate ) {
-
-		if ( rate ) {
-
-			this.materialAdaptiveLum.uniforms.tau.value = Math.abs( rate );
-
-		}
-
-	}
-
-	setMinLuminance( minLum ) {
-
-		if ( minLum ) {
-
-			this.materialToneMap.uniforms.minLuminance.value = minLum;
-			this.materialAdaptiveLum.uniforms.minLuminance.value = minLum;
-
-		}
-
-	}
-
-	setMaxLuminance( maxLum ) {
-
-		if ( maxLum ) {
-
-			this.materialToneMap.uniforms.maxLuminance.value = maxLum;
-
-		}
-
-	}
-
-	setAverageLuminance( avgLum ) {
-
-		if ( avgLum ) {
-
-			this.materialToneMap.uniforms.averageLuminance.value = avgLum;
-
-		}
-
-	}
-
-	setMiddleGrey( middleGrey ) {
-
-		if ( middleGrey ) {
-
-			this.materialToneMap.uniforms.middleGrey.value = middleGrey;
-
-		}
-
-	}
-
-	dispose() {
-
-		if ( this.luminanceRT ) {
-
-			this.luminanceRT.dispose();
-
-		}
-
-		if ( this.previousLuminanceRT ) {
-
-			this.previousLuminanceRT.dispose();
-
-		}
-
-		if ( this.currentLuminanceRT ) {
-
-			this.currentLuminanceRT.dispose();
-
-		}
-
-		if ( this.materialLuminance ) {
-
-			this.materialLuminance.dispose();
-
-		}
-
-		if ( this.materialAdaptiveLum ) {
-
-			this.materialAdaptiveLum.dispose();
-
-		}
-
-		if ( this.materialCopy ) {
-
-			this.materialCopy.dispose();
-
-		}
-
-		if ( this.materialToneMap ) {
-
-			this.materialToneMap.dispose();
-
-		}
-
-	}
-
-}
-
-export { AdaptiveToneMappingPass };

+ 0 - 73
examples/jsm/shaders/ToneMapShader.js

@@ -1,73 +0,0 @@
-/**
- * Full-screen tone-mapping shader based on http://www.cis.rit.edu/people/faculty/ferwerda/publications/sig02_paper.pdf
- */
-
-const ToneMapShader = {
-
-	uniforms: {
-
-		'tDiffuse': { value: null },
-		'averageLuminance': { value: 1.0 },
-		'luminanceMap': { value: null },
-		'maxLuminance': { value: 16.0 },
-		'minLuminance': { value: 0.01 },
-		'middleGrey': { value: 0.6 }
-	},
-
-	vertexShader: /* glsl */`
-
-		varying vec2 vUv;
-
-		void main() {
-
-			vUv = uv;
-			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
-
-		}`,
-
-	fragmentShader: /* glsl */`
-
-		#include <common>
-
-		uniform sampler2D tDiffuse;
-
-		varying vec2 vUv;
-
-		uniform float middleGrey;
-		uniform float minLuminance;
-		uniform float maxLuminance;
-		#ifdef ADAPTED_LUMINANCE
-			uniform sampler2D luminanceMap;
-		#else
-			uniform float averageLuminance;
-		#endif
-
-		vec3 ToneMap( vec3 vColor ) {
-			#ifdef ADAPTED_LUMINANCE
-				// Get the calculated average luminance
-				float fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;
-			#else
-				float fLumAvg = averageLuminance;
-			#endif
-
-			// Calculate the luminance of the current pixel
-			float fLumPixel = luminance( vColor );
-
-			// Apply the modified operator (Eq. 4)
-			float fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );
-
-			float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);
-			return fLumCompressed * vColor;
-		}
-
-		void main() {
-
-			vec4 texel = texture2D( tDiffuse, vUv );
-
-			gl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );
-
-		}`
-
-};
-
-export { ToneMapShader };

TEMPAT SAMPAH
examples/screenshots/webgl_shaders_tonemapping.jpg


+ 0 - 1
examples/tags.json

@@ -69,7 +69,6 @@
 	"webgl_rtt": [ "renderTarget", "texture" ],
 	"webgl_shaders_ocean": [ "water" ],
 	"webgl_shaders_sky": [ "sun" ],
-	"webgl_shaders_tonemapping": [ "hrd" ],
 	"webgl_shadow_contact": [ "onBeforeCompile", "soft" ],
 	"webgl_shadowmap_viewer": [ "directional", "spot" ],
 	"webgl_tonemapping": [ "gltf" ],

+ 0 - 506
examples/webgl_shaders_tonemapping.html

@@ -1,506 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - adaptive tone-mapping</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<link type="text/css" rel="stylesheet" href="main.css">
-		<style>
-			#labels {
-				position: absolute;
-				display: grid;
-				grid-template-columns: 1fr 1fr 1fr;
-				justify-items: center;
-				align-items: end;
-				height: 100%;
-				width: 100%;
-			}
-			#labels > div {
-				background-color: black;
-				padding: 6px;
-				margin-bottom: 20%;
-			}
-		</style>
-	</head>
-
-	<body>
-		<div id="d">
-			<div id="info">
-				<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> webgl demo :
-				Earth diffuse and city lights by <a href="http://seanward.org" target="_blank" rel="noopener">Sean Ward</a>
-			</div>
-			<div id="labels">
-				<div>
-					Low Dynamic Range<br/>
-					Static Tone Mapping
-				</div>
-				<div>
-					High Dynamic Range<br/>
-					Static Tone Mapping
-				</div>
-				<div>
-					High Dynamic Range<br/>
-					Adaptive Tone Mapping
-				</div>
-			</div>
-		</div>
-
-		<!-- Import maps polyfill -->
-		<!-- Remove this when import maps will be widely supported -->
-		<script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
-
-		<script type="importmap">
-			{
-				"imports": {
-					"three": "../build/three.module.js",
-					"three/addons/": "./jsm/"
-				}
-			}
-		</script>
-
-		<script type="module">
-
-			import * as THREE from 'three';
-
-			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
-			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
-			import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
-			import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
-			import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
-			import { AdaptiveToneMappingPass } from 'three/addons/postprocessing/AdaptiveToneMappingPass.js';
-			import { BloomPass } from 'three/addons/postprocessing/BloomPass.js';
-			import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js';
-
-			let bloomPass, adaptToneMappingPass, ldrToneMappingPass, hdrToneMappingPass;
-			let params;
-
-			let camera, scene, renderer, dynamicHdrEffectComposer, hdrEffectComposer, ldrEffectComposer;
-			let cameraCube, sceneCube;
-			let cameraBG, debugScene;
-			let adaptiveLuminanceMat, currentLuminanceMat;
-
-			let directionalLight;
-
-			let orbitControls;
-
-			let windowHalfX = window.innerWidth / 2;
-			let windowHalfY = window.innerHeight / 2;
-
-			let windowThirdX = window.innerWidth / 3;
-
-			init();
-			animate();
-
-			function init() {
-
-				params = {
-					bloomAmount: 1.0,
-					sunLight: 4.0,
-
-					enabled: true,
-					avgLuminance: 0.7,
-					middleGrey: 0.04,
-					maxLuminance: 16,
-
-					adaptionRate: 2.0
-				};
-
-				const container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				// CAMERAS
-
-				camera = new THREE.PerspectiveCamera( 70, windowThirdX / window.innerHeight, 0.1, 100000 );
-				camera.position.x = 700;
-				camera.position.y = 400;
-				camera.position.z = 800;
-				cameraCube = new THREE.PerspectiveCamera( 70, windowThirdX / window.innerHeight, 1, 100000 );
-
-				cameraBG = new THREE.OrthographicCamera( - windowHalfX, windowHalfX, windowHalfY, - windowHalfY, - 10000, 10000 );
-				cameraBG.position.z = 100;
-
-				orbitControls = new OrbitControls( camera, container );
-				orbitControls.autoRotate = true;
-				orbitControls.autoRotateSpeed = 1;
-
-				// SCENE
-
-				scene = new THREE.Scene();
-				sceneCube = new THREE.Scene();
-				debugScene = new THREE.Scene();
-
-				// LIGHTS
-
-				const ambient = new THREE.AmbientLight( 0x050505 );
-				scene.add( ambient );
-
-				directionalLight = new THREE.DirectionalLight( 0xffffff, params.sunLight );
-				directionalLight.position.set( 2, 0, 10 ).normalize();
-				scene.add( directionalLight );
-
-				const atmoShader = {
-					side: THREE.BackSide,
-					// blending: THREE.AdditiveBlending,
-					transparent: true,
-					lights: true,
-					uniforms: THREE.UniformsUtils.merge( [
-
-						THREE.UniformsLib[ 'common' ],
-						THREE.UniformsLib[ 'lights' ]
-
-					] ),
-					vertexShader: [
-						'varying vec3 vViewPosition;',
-						'varying vec3 vNormal;',
-						'void main() {',
-						THREE.ShaderChunk[ 'beginnormal_vertex' ],
-						THREE.ShaderChunk[ 'defaultnormal_vertex' ],
-
-						'	vNormal = normalize( transformedNormal );',
-						'vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',
-						'vViewPosition = -mvPosition.xyz;',
-						'gl_Position = projectionMatrix * mvPosition;',
-						'}'
-
-					].join( '\n' ),
-
-					fragmentShader: [
-
-						THREE.ShaderChunk[ 'common' ],
-						THREE.ShaderChunk[ 'bsdfs' ],
-						THREE.ShaderChunk[ 'lights_pars_begin' ],
-						THREE.ShaderChunk[ 'normal_pars_fragment' ],
-						THREE.ShaderChunk[ 'lights_phong_pars_fragment' ],
-
-						'void main() {',
-						'vec3 normal = normalize( -vNormal );',
-						'vec3 viewPosition = normalize( vViewPosition );',
-						'#if NUM_DIR_LIGHTS > 0',
-
-						'vec3 dirDiffuse = vec3( 0.0 );',
-
-						'for( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {',
-
-						'vec4 lDirection = viewMatrix * vec4( directionalLights[i].direction, 0.0 );',
-						'vec3 dirVector = normalize( lDirection.xyz );',
-						'float dotProduct = dot( viewPosition, dirVector );',
-						'dotProduct = 1.0 * max( dotProduct, 0.0 ) + (1.0 - max( -dot( normal, dirVector ), 0.0 ));',
-						'dotProduct *= dotProduct;',
-						'dirDiffuse += max( 0.5 * dotProduct, 0.0 ) * directionalLights[i].color;',
-						'}',
-						'#endif',
-
-						//Fade out atmosphere at edge
-						'float viewDot = abs(dot( normal, viewPosition ));',
-						'viewDot = clamp( pow( viewDot + 0.6, 10.0 ), 0.0, 1.0);',
-
-						'vec3 color = vec3( 0.05, 0.09, 0.13 ) * dirDiffuse;',
-						'gl_FragColor = vec4( color, viewDot );',
-
-						'}'
-
-					].join( '\n' )
-				};
-
-				const earthAtmoMat = new THREE.ShaderMaterial( atmoShader );
-
-				const earthMat = new THREE.MeshPhongMaterial( {
-					color: 0xffffff,
-					shininess: 200
-				} );
-
-				const textureLoader = new THREE.TextureLoader();
-
-				textureLoader.load( 'textures/planets/earth_atmos_4096.jpg', function ( tex ) {
-
-					earthMat.map = tex;
-					earthMat.map.colorSpace = THREE.SRGBColorSpace;
-					earthMat.needsUpdate = true;
-
-				} );
-				textureLoader.load( 'textures/planets/earth_specular_2048.jpg', function ( tex ) {
-
-					earthMat.specularMap = tex;
-					earthMat.specularMap.colorSpace = THREE.SRGBColorSpace;
-					earthMat.needsUpdate = true;
-
-				} );
-
-				// let earthNormal = textureLoader.load( 'textures/planets/earth-new-normal-2048.jpg', function( tex ) {
-				// 	earthMat.normalMap = tex;
-				// 	earthMat.needsUpdate = true;
-				// } );
-
-				const earthLights = textureLoader.load( 'textures/planets/earth_lights_2048.png' );
-				earthLights.colorSpace = THREE.SRGBColorSpace;
-
-				const earthLightsMat = new THREE.MeshBasicMaterial( {
-					color: 0xffffff,
-					blending: THREE.AdditiveBlending,
-					transparent: true,
-					depthTest: false,
-					map: earthLights,
-
-				} );
-
-				const clouds = textureLoader.load( 'textures/planets/earth_clouds_2048.png' );
-				clouds.colorSpace = THREE.SRGBColorSpace;
-
-				const earthCloudsMat = new THREE.MeshLambertMaterial( {
-					color: 0xffffff,
-					blending: THREE.NormalBlending,
-					transparent: true,
-					depthTest: false,
-					map: clouds
-				} );
-
-
-				const earthGeo = new THREE.SphereGeometry( 600, 24, 24 );
-				const sphereMesh = new THREE.Mesh( earthGeo, earthMat );
-				scene.add( sphereMesh );
-
-				const sphereLightsMesh = new THREE.Mesh( earthGeo, earthLightsMat );
-				scene.add( sphereLightsMesh );
-
-				const sphereCloudsMesh = new THREE.Mesh( earthGeo, earthCloudsMat );
-				scene.add( sphereCloudsMesh );
-
-				const sphereAtmoMesh = new THREE.Mesh( earthGeo, earthAtmoMat );
-				sphereAtmoMesh.scale.set( 1.05, 1.05, 1.05 );
-				scene.add( sphereAtmoMesh );
-
-				const vBGShader = [
-					// "attribute vec2 uv;",
-					'varying vec2 vUv;',
-					'void main() {',
-					'vUv = uv;',
-					'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
-					'}'
-
-				].join( '\n' );
-
-				const pBGShader = [
-
-					'uniform sampler2D map;',
-					'varying vec2 vUv;',
-
-					'void main() {',
-
-					'vec2 sampleUV = vUv;',
-					'vec4 color = texture2D( map, sampleUV, 0.0 );',
-
-					'gl_FragColor = vec4( color.xyz, 1.0 );',
-
-					'}'
-
-				].join( '\n' );
-
-				// Skybox
-				adaptiveLuminanceMat = new THREE.ShaderMaterial( {
-					uniforms: {
-						'map': { value: null }
-					},
-					vertexShader: vBGShader,
-					fragmentShader: pBGShader,
-					depthTest: false,
-					// color: 0xffffff
-					blending: THREE.NoBlending
-				} );
-
-				currentLuminanceMat = new THREE.ShaderMaterial( {
-					uniforms: {
-						'map': { value: null }
-					},
-					vertexShader: vBGShader,
-					fragmentShader: pBGShader,
-					depthTest: false
-					// color: 0xffffff
-					// blending: THREE.NoBlending
-				} );
-
-				let quadBG = new THREE.Mesh( new THREE.PlaneGeometry( 0.1, 0.1 ), currentLuminanceMat );
-				quadBG.position.z = - 500;
-				quadBG.position.x = - window.innerWidth * 0.5 + window.innerWidth * 0.05;
-				quadBG.scale.set( window.innerWidth, window.innerHeight, 1 );
-				debugScene.add( quadBG );
-
-				quadBG = new THREE.Mesh( new THREE.PlaneGeometry( 0.1, 0.1 ), adaptiveLuminanceMat );
-				quadBG.position.z = - 500;
-				quadBG.position.x = - window.innerWidth * 0.5 + window.innerWidth * 0.15;
-				quadBG.scale.set( window.innerWidth, window.innerHeight, 1 );
-				debugScene.add( quadBG );
-
-				const r = 'textures/cube/MilkyWay/';
-				const urls = [ r + 'dark-s_px.jpg', r + 'dark-s_nx.jpg',
-							 r + 'dark-s_py.jpg', r + 'dark-s_ny.jpg',
-							 r + 'dark-s_pz.jpg', r + 'dark-s_nz.jpg' ];
-
-				const textureCube = new THREE.CubeTextureLoader().load( urls );
-				textureCube.colorSpace = THREE.SRGBColorSpace;
-
-				sceneCube.background = textureCube;
-
-				renderer = new THREE.WebGLRenderer();
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( window.innerWidth, window.innerHeight );
-				renderer.autoClear = false;
-
-				container.appendChild( renderer.domElement );
-
-				// let width = window.innerWidth || 1;
-				const height = window.innerHeight || 1;
-
-				const parameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat };
-				const regularRenderTarget = new THREE.WebGLRenderTarget( windowThirdX, height, parameters );
-				ldrEffectComposer = new EffectComposer( renderer, regularRenderTarget );
-
-				parameters.type = THREE.FloatType;
-
-				if ( renderer.capabilities.isWebGL2 === false && renderer.extensions.has( 'OES_texture_half_float_linear' ) === false ) {
-
-					parameters.type = undefined; // avoid usage of floating point textures
-
-				}
-
-				const hdrRenderTarget = new THREE.WebGLRenderTarget( windowThirdX, height, parameters );
-				dynamicHdrEffectComposer = new EffectComposer( renderer, hdrRenderTarget );
-				dynamicHdrEffectComposer.setSize( window.innerWidth, window.innerHeight );
-				hdrEffectComposer = new EffectComposer( renderer, hdrRenderTarget );
-
-				const debugPass = new RenderPass( debugScene, cameraBG );
-				debugPass.clear = false;
-				const scenePass = new RenderPass( scene, camera, undefined, undefined, undefined );
-				const skyboxPass = new RenderPass( sceneCube, cameraCube );
-				scenePass.clear = false;
-
-				adaptToneMappingPass = new AdaptiveToneMappingPass( true, 256 );
-				adaptToneMappingPass.needsSwap = true;
-				ldrToneMappingPass = new AdaptiveToneMappingPass( false, 256 );
-				hdrToneMappingPass = new AdaptiveToneMappingPass( false, 256 );
-				bloomPass = new BloomPass();
-				const gammaCorrectionPass = new ShaderPass( GammaCorrectionShader );
-
-				dynamicHdrEffectComposer.addPass( skyboxPass );
-				dynamicHdrEffectComposer.addPass( scenePass );
-				dynamicHdrEffectComposer.addPass( adaptToneMappingPass );
-				dynamicHdrEffectComposer.addPass( bloomPass );
-				dynamicHdrEffectComposer.addPass( gammaCorrectionPass );
-
-				hdrEffectComposer.addPass( skyboxPass );
-				hdrEffectComposer.addPass( scenePass );
-				hdrEffectComposer.addPass( hdrToneMappingPass );
-				hdrEffectComposer.addPass( bloomPass );
-				hdrEffectComposer.addPass( gammaCorrectionPass );
-
-				ldrEffectComposer.addPass( skyboxPass );
-				ldrEffectComposer.addPass( scenePass );
-				ldrEffectComposer.addPass( ldrToneMappingPass );
-				ldrEffectComposer.addPass( bloomPass );
-				ldrEffectComposer.addPass( gammaCorrectionPass );
-
-				const gui = new GUI();
-
-				const sceneGui = gui.addFolder( 'Scenes' );
-				const toneMappingGui = gui.addFolder( 'ToneMapping' );
-				const staticToneMappingGui = gui.addFolder( 'StaticOnly' );
-				const adaptiveToneMappingGui = gui.addFolder( 'AdaptiveOnly' );
-
-				sceneGui.add( params, 'bloomAmount', 0.0, 10.0 );
-				sceneGui.add( params, 'sunLight', 0.1, 12.0 );
-
-				toneMappingGui.add( params, 'enabled' );
-				toneMappingGui.add( params, 'middleGrey', 0, 12 );
-				toneMappingGui.add( params, 'maxLuminance', 1, 30 );
-
-				staticToneMappingGui.add( params, 'avgLuminance', 0.001, 2.0 );
-				adaptiveToneMappingGui.add( params, 'adaptionRate', 0.0, 10.0 );
-
-				gui.open();
-
-				window.addEventListener( 'resize', onWindowResize );
-
-			}
-
-			function onWindowResize() {
-
-				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
-				windowThirdX = window.innerWidth / 3;
-
-				camera.aspect = windowThirdX / window.innerHeight;
-				camera.updateProjectionMatrix();
-
-				cameraCube.aspect = windowThirdX / window.innerHeight;
-				cameraCube.updateProjectionMatrix();
-
-				renderer.setSize( window.innerWidth, window.innerHeight );
-
-			}
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-				if ( bloomPass ) {
-
-					bloomPass.combineUniforms[ 'strength' ].value = params.bloomAmount;
-
-				}
-
-				if ( adaptToneMappingPass ) {
-
-					adaptToneMappingPass.setAdaptionRate( params.adaptionRate );
-					adaptiveLuminanceMat.uniforms[ 'map' ].value = adaptToneMappingPass.luminanceRT;
-					currentLuminanceMat.uniforms[ 'map' ].value = adaptToneMappingPass.currentLuminanceRT;
-
-					adaptToneMappingPass.enabled = params.enabled;
-					adaptToneMappingPass.setMaxLuminance( params.maxLuminance );
-					adaptToneMappingPass.setMiddleGrey( params.middleGrey );
-
-					hdrToneMappingPass.enabled = params.enabled;
-					hdrToneMappingPass.setMaxLuminance( params.maxLuminance );
-					hdrToneMappingPass.setMiddleGrey( params.middleGrey );
-					if ( hdrToneMappingPass.setAverageLuminance ) {
-
-						hdrToneMappingPass.setAverageLuminance( params.avgLuminance );
-
-					}
-
-					ldrToneMappingPass.enabled = params.enabled;
-					ldrToneMappingPass.setMaxLuminance( params.maxLuminance );
-					ldrToneMappingPass.setMiddleGrey( params.middleGrey );
-					if ( ldrToneMappingPass.setAverageLuminance ) {
-
-						ldrToneMappingPass.setAverageLuminance( params.avgLuminance );
-
-					}
-
-				}
-
-				directionalLight.intensity = params.sunLight;
-
-				orbitControls.update();
-
-				render();
-
-			}
-
-			function render() {
-
-				camera.lookAt( scene.position );
-				cameraCube.rotation.copy( camera.rotation );
-
-				renderer.setViewport( 0, 0, windowThirdX, window.innerHeight );
-				ldrEffectComposer.render( 0.017 );
-
-				renderer.setViewport( windowThirdX, 0, windowThirdX, window.innerHeight );
-				hdrEffectComposer.render( 0.017 );
-
-				renderer.setViewport( windowThirdX * 2, 0, windowThirdX, window.innerHeight );
-				dynamicHdrEffectComposer.render( 0.017 );
-
-			}
-
-		</script>
-
-	</body>
-</html>

+ 0 - 1
test/e2e/puppeteer.js

@@ -63,7 +63,6 @@ const exceptionList = [
 	'webgl_effects_ascii',
 	'webgl_loader_pdb',
 	'webgl_multiple_elements_text',
-	'webgl_shaders_tonemapping',
 
 	// Unknown
 	// TODO: most of these can be fixed just by increasing idleTime and parseTime