webgl_lights_deferred_pointlights.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. <!DOCTYPE HTML>
  2. <html lang="en">
  3. <head>
  4. <title>three.js webgl - deferred rendering</title>
  5. <meta charset="utf-8" />
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <style>
  8. body {
  9. background-color: #000;
  10. margin: 0px;
  11. overflow: hidden;
  12. }
  13. #info {
  14. position: absolute;
  15. top: 0px; width: 100%;
  16. color: #ffffff;
  17. padding: 5px;
  18. font-family: Monospace;
  19. font-size: 13px;
  20. text-align: center;
  21. }
  22. a {
  23. color: #ff0080;
  24. text-decoration: none;
  25. }
  26. a:hover {
  27. color: #0080ff;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <div id="info">
  33. <a href="http://threejs.org" target="_blank">three.js</a> - deferred point lights WebGL demo by <a href="http://de.redplant.de" target=_blank>redPlant</a>.<br />
  34. Walt Disney head by <a href="http://davidoreilly.com/post/18087489343/disneyhead" target="_blank">David OReilly</a><br>
  35. Point Light attenuation formula by <a href="http://imdoingitwrong.wordpress.com/tag/glsl/" target=_blank>Tom Madams</a>
  36. </div>
  37. <div id="container"></div>
  38. <script src="../build/three.min.js"></script>
  39. <script src="js/Detector.js"></script>
  40. <script src="js/libs/stats.min.js"></script>
  41. <script src="js/shaders/CopyShader.js"></script>
  42. <script src="js/postprocessing/EffectComposer.js"></script>
  43. <script src="js/postprocessing/RenderPass.js"></script>
  44. <script src="js/postprocessing/ShaderPass.js"></script>
  45. <script src="js/postprocessing/MaskPass.js"></script>
  46. <script src="js/controls/TrackballControls.js"></script>
  47. <script src="js/loaders/ctm/lzma.js"></script>
  48. <script src="js/loaders/ctm/ctm.js"></script>
  49. <script src="js/loaders/ctm/CTMLoader.js"></script>
  50. <script src="js/loaders/UTF8Loader.js"></script>
  51. <script src="js/loaders/MTLLoader.js"></script>
  52. <script>
  53. if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
  54. var WIDTH = window.innerWidth;
  55. var HEIGHT = window.innerHeight;
  56. var NEAR = 1.0, FAR = 250.0;
  57. var VIEW_ANGLE = 45;
  58. var ASPECT = WIDTH / HEIGHT;
  59. // core
  60. var renderer, camera, controls, stats, clock;
  61. // scenes and scene nodes
  62. var lightScene, lightNode, scene, sceneNode, emitterScene, emitterNode, quadScene, quadNode;
  63. // rendertargets
  64. var rtNormals, rtDepth, rtLightBuffer, rtEmitter;
  65. // composer
  66. var compNormals, compDepth, compLightBuffer, compFinal, compEmitter, compositePass;
  67. // materials
  68. var matNormal, matClipDepth, matBasic, matUnlit;
  69. var numLights = 0;
  70. var lights = new Array();
  71. // -----------------------
  72. // shader definitions
  73. // -----------------------
  74. var clipdepth_frag = ""+
  75. "varying vec4 clipPos;"+
  76. "void main() {"+
  77. "gl_FragColor = vec4( clipPos.z / clipPos.w, 1.0, 1.0, 1.0 );"+
  78. "}";
  79. var clipdepth_vert = "" +
  80. "varying vec4 clipPos;"+
  81. "void main() {"+
  82. "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );"+
  83. "clipPos = gl_Position;"+
  84. "}";
  85. // -----------------------
  86. var normals_vert = "" +
  87. "varying vec3 normalView;"+
  88. "void main() {"+
  89. "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );"+
  90. "normalView = normalize( normalMatrix * normal );"+
  91. "}";
  92. var normals_frag = "" +
  93. "varying vec3 normalView;"+
  94. "void main() {"+
  95. "gl_FragColor = vec4( vec3( normalView * 0.5 + 0.5 ), 1.0 );"+
  96. "}";
  97. // -----------------------
  98. var unlit_vert = "" +
  99. "varying vec4 clipPos;"+
  100. "void main() {"+
  101. "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );"+
  102. "clipPos = gl_Position;"+
  103. "}";
  104. var unlit_frag = "" +
  105. "varying vec4 clipPos;"+
  106. "uniform sampler2D samplerDepth;"+
  107. "uniform float viewHeight;"+
  108. "uniform float viewWidth;"+
  109. "uniform vec3 lightColor;" +
  110. "void main() {"+
  111. "vec2 texCoord = gl_FragCoord.xy / vec2( viewWidth, viewHeight );"+
  112. "float z = texture2D( samplerDepth, texCoord ).x;"+
  113. "vec4 color = vec4( lightColor, 1.0 );"+
  114. "float depth = clipPos.z / clipPos.w;"+
  115. "if( depth > z && z > 0.0 ) color.w = 0.0;"+
  116. "gl_FragColor = color;"+
  117. "}";
  118. // -----------------------
  119. var deferredlight_vert = "" +
  120. "varying vec3 lightView;" +
  121. "uniform vec3 lightPos;" +
  122. "uniform mat4 matView;" +
  123. "void main() { " +
  124. "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );"+
  125. "lightView = vec3( matView * vec4( lightPos, 1.0 ) );" +
  126. "}"
  127. var deferredlight_frag = "" +
  128. "varying vec3 lightView;"+
  129. "uniform sampler2D samplerDepth;"+
  130. "uniform sampler2D samplerNormals;"+
  131. "uniform sampler2D samplerLightBuffer;"+
  132. "uniform float lightRadius;"+
  133. "uniform float lightIntensity;"+
  134. "uniform float viewHeight;"+
  135. "uniform float viewWidth;"+
  136. "uniform vec3 lightColor;"+
  137. "uniform mat4 matProjInverse;"+
  138. "void main() {"+
  139. "vec2 texCoord = gl_FragCoord.xy / vec2( viewWidth, viewHeight );"+
  140. "float z = texture2D( samplerDepth, texCoord ).x;"+
  141. "if ( z == 0.0 ) {"+
  142. "gl_FragColor = vec4( vec3( 0.0 ), 1.0 );"+
  143. "return;"+
  144. "}"+
  145. "float x = texCoord.x * 2.0 - 1.0;"+
  146. "float y = texCoord.y * 2.0 - 1.0;"+
  147. "vec4 projectedPos = vec4( x, y, z, 1.0 );"+
  148. "vec4 viewPos = matProjInverse * projectedPos;"+
  149. "viewPos.xyz /= viewPos.w;"+
  150. "viewPos.w = 1.0;"+
  151. "vec3 lightDir = lightView - viewPos.xyz;"+
  152. "float dist = length( lightDir );"+
  153. "float cutoff = 0.3;"+
  154. "float denom = dist/lightRadius + 1.0;"+
  155. "float attenuation = 1.0 / ( denom * denom );"+
  156. "attenuation = ( attenuation - cutoff ) / ( 1.0 - cutoff );"+
  157. "attenuation = max( attenuation, 0.0 );"+
  158. "vec3 normal = texture2D( samplerNormals, texCoord ).xyz * 2.0 - 1.0;" +
  159. "float diffuse = max( dot( normal, normalize( lightDir ) ), 0.0 );" +
  160. "vec4 color = vec4( 0.0 );"+
  161. "color.xyz = lightColor * lightIntensity;"+
  162. "color.w = attenuation;"+
  163. "gl_FragColor = color * diffuse;"+
  164. "}";
  165. var composite_vert = "" +
  166. "varying vec2 texCoord;"+
  167. "void main() {"+
  168. "vec4 pos = vec4( sign( position.xy ), 0.0, 1.0 );"+
  169. "texCoord = pos.xy * vec2( 0.5, 0.5 ) + 0.5;"+
  170. "gl_Position = pos;"+
  171. "}";
  172. var composite_frag = "" +
  173. "varying vec2 texCoord;"+
  174. "uniform sampler2D samplerLightBuffer;" +
  175. "uniform sampler2D samplerEmitter;" +
  176. "uniform vec3 lightPos;" +
  177. "void main() {" +
  178. "vec3 color = texture2D( samplerLightBuffer, texCoord ).xyz;" +
  179. "vec3 emitter = texture2D( samplerEmitter, texCoord ).xyz;"+
  180. "if ( emitter != vec3( 0.0 ) ) {"+
  181. "gl_FragColor = vec4( emitter, 1.0 );" +
  182. "} else {"+
  183. "gl_FragColor = vec4( color, 1.0 );" +
  184. "}"+
  185. "}"
  186. // -----------------------
  187. var normalShader = {
  188. uniforms: {},
  189. vertexShader: normals_vert,
  190. fragmentShader: normals_frag
  191. };
  192. // -----------------------
  193. var clipDepthShader = {
  194. uniforms: {},
  195. vertexShader: clipdepth_vert,
  196. fragmentShader: clipdepth_frag
  197. };
  198. // -----------------------
  199. var unlitShader = {
  200. uniforms: {
  201. samplerDepth: { type: "t", value: null },
  202. viewWidth: { type: "f", value: WIDTH },
  203. viewHeight: { type: "f", value: HEIGHT },
  204. lightColor: { type: "v3", value: new THREE.Vector3( 0, 0, 0 ) }
  205. },
  206. vertexShader: unlit_vert,
  207. fragmentShader: unlit_frag
  208. };
  209. // -----------------------
  210. var lightShader = {
  211. uniforms: {
  212. samplerLightBuffer: { type: "t", value: null },
  213. samplerNormals: { type: "t", value: null },
  214. samplerDepth: { type: "t", value: null },
  215. matView : { type: "m4", value: new THREE.Matrix4() },
  216. matProjInverse : { type: "m4", value: new THREE.Matrix4() },
  217. viewWidth: { type: "f", value: WIDTH },
  218. viewHeight: { type: "f", value: HEIGHT },
  219. lightPos: { type: "v3", value: new THREE.Vector3( 0, 0, 0 ) },
  220. lightColor: { type: "v3", value: new THREE.Vector3( 0, 0, 0 ) },
  221. lightIntensity: { type: "f", value: 1.0 },
  222. lightRadius: { type: "f", value: 1.0 }
  223. },
  224. vertexShader: deferredlight_vert,
  225. fragmentShader: deferredlight_frag
  226. };
  227. // -----------------------
  228. var compositeShader = {
  229. uniforms: {
  230. samplerLightBuffer: { type: "t", value: null },
  231. samplerEmitter: { type: "t", value: null }
  232. },
  233. vertexShader: composite_vert,
  234. fragmentShader: composite_frag
  235. };
  236. // -----------------------------
  237. function bootstrap() {
  238. renderer = new THREE.WebGLRenderer();
  239. renderer.setSize( WIDTH, HEIGHT );
  240. renderer.setClearColorHex( 0x000000 );
  241. var container = document.getElementById( 'container' );
  242. container.appendChild( renderer.domElement );
  243. // scene camera
  244. camera = new THREE.PerspectiveCamera( VIEW_ANGLE, ASPECT, NEAR, FAR );
  245. camera.position.z = 150;
  246. controls = new THREE.TrackballControls( camera, renderer.domElement );
  247. // scene for walt's head model
  248. scene = new THREE.Scene();
  249. sceneNode = new THREE.Object3D();
  250. scene.add( sceneNode );
  251. scene.add( camera );
  252. // scene for light proxy geometry
  253. lightScene = new THREE.Scene();
  254. lightNode = new THREE.Object3D();
  255. lightScene.add( lightNode );
  256. // scene for the coloured emitter spheres
  257. emitterScene = new THREE.Scene();
  258. emitterNode = new THREE.Object3D();
  259. emitterScene.add( emitterNode );
  260. // full screen quad for compositing
  261. quadScene = new THREE.Scene();
  262. quadNode = new THREE.Object3D();
  263. quadScene.add( quadNode );
  264. quadNode.add( new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ) ) );
  265. // stats
  266. stats = new Stats();
  267. stats.domElement.style.position = 'absolute';
  268. stats.domElement.style.top = '8px';
  269. stats.domElement.style.zIndex = 100;
  270. container.appendChild( stats.domElement );
  271. // clock
  272. clock = new THREE.Clock();
  273. }
  274. // -----------------------------
  275. function createRenderTargets() {
  276. var rtParams = { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter,
  277. format: THREE.RGBAFormat, type: THREE.FloatType };
  278. // ----------------------------------------------------------
  279. // g-buffer
  280. // ----------------------------------------------------------
  281. rtNormals = new THREE.WebGLRenderTarget( WIDTH, HEIGHT, rtParams );
  282. rtDepth = new THREE.WebGLRenderTarget( WIDTH, HEIGHT, rtParams );
  283. var passNormals = new THREE.RenderPass( scene, camera );
  284. compNormals = new THREE.EffectComposer( renderer, rtNormals );
  285. compNormals.addPass( passNormals );
  286. var passDepth = new THREE.RenderPass( scene, camera );
  287. compDepth = new THREE.EffectComposer( renderer, rtDepth );
  288. compDepth.addPass( passDepth );
  289. // ----------------------------------------------------------
  290. // light emitter spheres
  291. // ----------------------------------------------------------
  292. var emitterPass = new THREE.RenderPass( emitterScene, camera );
  293. rtEmitter = new THREE.WebGLRenderTarget( WIDTH, HEIGHT, rtParams );
  294. compEmitter = new THREE.EffectComposer( renderer, rtEmitter );
  295. compEmitter.addPass( emitterPass );
  296. // ----------------------------------------------------------
  297. // lighting pass
  298. // ----------------------------------------------------------
  299. rtLightBuffer = new THREE.WebGLRenderTarget( WIDTH, HEIGHT, rtParams );
  300. rtLightBuffer.generateMipmaps = false;
  301. var passLight = new THREE.RenderPass( lightScene, camera );
  302. compLightBuffer = new THREE.EffectComposer( renderer, rtLightBuffer );
  303. compLightBuffer.addPass( passLight );
  304. lightShader.uniforms['samplerNormals'].value = compNormals.renderTarget2;
  305. lightShader.uniforms['samplerDepth'].value = compDepth.renderTarget2;
  306. lightShader.uniforms['samplerLightBuffer'].value = rtLightBuffer;
  307. for ( var x = 0; x < numLights; x ++ ) {
  308. // setup material
  309. var matLight = new THREE.ShaderMaterial({
  310. uniforms: THREE.UniformsUtils.clone( lightShader.uniforms ),
  311. vertexShader: lightShader.vertexShader,
  312. fragmentShader: lightShader.fragmentShader
  313. });
  314. matLight.blending = THREE.AdditiveBlending;
  315. matLight.transparent = true;
  316. matLight.depthWrite = false;
  317. matLight.uniforms["lightPos"].value = lights[x].position;
  318. matLight.uniforms["lightRadius"].value = lights[x].distance;
  319. matLight.uniforms["lightIntensity"].value = lights[x].intensity;
  320. matLight.uniforms["lightColor"].value = lights[x].color;
  321. // setup proxy geometry for this light
  322. var geomLight = new THREE.SphereGeometry( lights[x].distance, 16, 10 );
  323. var meshLight = new THREE.Mesh( geomLight, matLight );
  324. lightNode.add( meshLight );
  325. // create emitter sphere
  326. var geomEmitter = new THREE.SphereGeometry( 0.7, 7, 7 );
  327. var matEmitter = new THREE.ShaderMaterial({
  328. uniforms: THREE.UniformsUtils.clone( unlitShader.uniforms ),
  329. vertexShader: unlitShader.vertexShader,
  330. fragmentShader: unlitShader.fragmentShader
  331. });
  332. var meshEmitter = new THREE.Mesh( geomEmitter, matEmitter );
  333. meshEmitter.position = lights[ x ].position;
  334. emitterNode.add( meshEmitter );
  335. // add emitter to light node
  336. meshLight.emitter = meshEmitter;
  337. }
  338. // ----------------------------------------------------------
  339. // composite
  340. // ----------------------------------------------------------
  341. compositeShader.uniforms['samplerLightBuffer'].value = compLightBuffer.renderTarget2;
  342. compositeShader.uniforms['samplerEmitter'].value = compEmitter.renderTarget2;
  343. compositePass = new THREE.ShaderPass( compositeShader );
  344. compositePass.needsSwap = true;
  345. compositePass.renderToScreen = true;
  346. compFinal = new THREE.EffectComposer( renderer );
  347. compFinal.addPass( compositePass );
  348. }
  349. // -----------------------------
  350. function initScene( object ) {
  351. object.traverse( function( node ) {
  352. if ( node.material ) {
  353. node.material = new THREE.MeshBasicMaterial();
  354. }
  355. } );
  356. object.position.y = -35;
  357. sceneNode.add( object );
  358. }
  359. // -----------------------------
  360. function initMaterials() {
  361. matNormal = new THREE.ShaderMaterial({
  362. uniforms: normalShader.uniforms,
  363. vertexShader: normalShader.vertexShader,
  364. fragmentShader: normalShader.fragmentShader
  365. });
  366. matClipDepth = new THREE.ShaderMaterial({
  367. uniforms: clipDepthShader.uniforms,
  368. vertexShader: clipDepthShader.vertexShader,
  369. fragmentShader: clipDepthShader.fragmentShader
  370. });
  371. }
  372. // -----------------------------
  373. function initLights() {
  374. var distance = 50;
  375. var tmp = new THREE.PointLight();
  376. tmp.color = new THREE.Vector3( 0.0, 0.0, 1.0 );
  377. tmp.intensity = 1.0;
  378. tmp.distance = distance;
  379. lights[ 0 ] = tmp;
  380. var tmp = new THREE.PointLight();
  381. tmp.color = new THREE.Vector3( 0.0, 1.0, 0.0 );
  382. tmp.intensity = 1.0;
  383. tmp.distance = distance;
  384. lights[ 1 ] = tmp;
  385. var tmp = new THREE.PointLight();
  386. tmp.color = new THREE.Vector3( 1.0, 0.0, 0.0 );
  387. tmp.intensity = 1.0;
  388. tmp.distance = distance;
  389. lights[ 2 ] = tmp;
  390. var tmp = new THREE.PointLight();
  391. tmp.color = new THREE.Vector3( 0.0, 1.0, 1.0 );
  392. tmp.intensity = 1.0;
  393. tmp.distance = distance;
  394. lights[ 3 ] = tmp;
  395. numLights = 4;
  396. }
  397. // -----------------------------
  398. function animate() {
  399. var delta = clock.getDelta();
  400. requestAnimationFrame( animate );
  401. controls.update( delta );
  402. stats.update();
  403. render();
  404. }
  405. // -----------------------------
  406. function render() {
  407. // -----------------------------
  408. // g-buffer depth
  409. // -----------------------------
  410. sceneNode.traverse( function( node ) {
  411. if ( node.material ) {
  412. node.material = matClipDepth;
  413. }
  414. } );
  415. compDepth.render();
  416. // -----------------------------
  417. // g-buffer normals
  418. // -----------------------------
  419. sceneNode.traverse( function( node ) {
  420. if ( node.material ) {
  421. node.material = matNormal;
  422. }
  423. } );
  424. compNormals.render();
  425. // -----------------------------
  426. // emitter pass
  427. // -----------------------------
  428. for ( var idx in lightNode.children ) {
  429. var light = lightNode.children[idx];
  430. var color = light.material.uniforms["lightColor"].value;
  431. var emitter = light.emitter;
  432. emitter.material.uniforms['samplerDepth'].value = compDepth.renderTarget2;
  433. emitter.material.uniforms["lightColor"].value = color;
  434. }
  435. compEmitter.render();
  436. // -----------------------------
  437. // light pass
  438. // -----------------------------
  439. for ( var idx in lightNode.children ) {
  440. camera.projectionMatrixInverse.getInverse( camera.projectionMatrix );
  441. lightNode.children[idx].material.uniforms["matProjInverse"].value = camera.projectionMatrixInverse;
  442. lightNode.children[idx].material.uniforms["matView"].value = camera.matrixWorldInverse;
  443. }
  444. var time = Date.now() * 0.0005;
  445. // update lights
  446. var lightPosition = lightNode.children[0].material.uniforms["lightPos"].value;
  447. lightPosition.x = Math.sin( time * 0.7 ) * 30;
  448. lightPosition.y = Math.cos( time * 0.5 ) * 40;
  449. lightPosition.z = Math.cos( time * 0.3 ) * 30;
  450. lightNode.children[0].emitter.position = lightPosition;
  451. lightNode.children[0].position = lightPosition;
  452. lightNode.children[0].frustumCulled = false;
  453. lightPosition = lightNode.children[1].material.uniforms["lightPos"].value;
  454. lightPosition.x = Math.sin( time * 0.5 ) * 30;
  455. lightPosition.y = Math.cos( time * 0.5 ) * 40;
  456. lightPosition.z = Math.cos( time * 0.7 ) * 30;
  457. lightNode.children[1].emitter.position = lightPosition;
  458. lightNode.children[1].position = lightPosition;
  459. lightNode.children[1].frustumCulled = false;
  460. lightPosition = lightNode.children[2].material.uniforms["lightPos"].value;
  461. lightPosition.x = Math.sin( time * 0.7 ) * 30;
  462. lightPosition.y = Math.cos( time * 0.3 ) * 40;
  463. lightPosition.z = Math.cos( time * 0.5 ) * 30;
  464. lightNode.children[2].emitter.position = lightPosition;
  465. lightNode.children[2].position = lightPosition;
  466. lightNode.children[2].frustumCulled = false;
  467. lightPosition = lightNode.children[3].material.uniforms["lightPos"].value;
  468. lightPosition.x = Math.sin( time * 0.3 ) * 30;
  469. lightPosition.y = Math.cos( time * 0.7 ) * 40;
  470. lightPosition.z = Math.cos( time * 0.5 ) * 30;
  471. lightNode.children[3].emitter.position = lightPosition;
  472. lightNode.children[3].position = lightPosition;
  473. lightNode.children[3].frustumCulled = false;
  474. compLightBuffer.render();
  475. // -----------------------------
  476. // composite pass
  477. // -----------------------------
  478. compFinal.render();
  479. }
  480. // -----------------------------
  481. // entry point
  482. // -----------------------------
  483. var loader = new THREE.UTF8Loader();
  484. loader.load( "models/utf8/WaltHi.js", function ( object ) {
  485. bootstrap();
  486. initScene( object );
  487. initMaterials();
  488. initLights();
  489. createRenderTargets();
  490. animate();
  491. }, { normalizeRGB: true } );
  492. </script>
  493. </body>
  494. </html>