<commit_before><!DOCTYPE HTML>
<html lang="en">
	<head>
		<title>three.js webgl - materials - grass</title>
		<meta charset="utf-8">
		<style type="text/css">
			body {
				background:#030;
				color:#fff;
				padding:0;
				margin:0;
				overflow:hidden;
				font-family:georgia;
				text-align:center;
			}
		</style>
	</head>

	<body>
		<script type="text/javascript" src="../build/Three.js"></script>

		<script type="text/javascript" src="js/Detector.js"></script>
		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>

		<script type="text/javascript">

			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();

			var camera, scene, renderer,
			mesh, levels = [];

			init();
			animate();

			function init() {

				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
				camera.position.y = 75;
				camera.position.z = 100;

				scene = new THREE.Scene();

				var geometry = new THREE.Plane( 100, 100 );

				var texture = generateTextureBase();
				texture.needsUpdate = true;

				for ( var i = 0; i < 15; i ++ ) {

					mesh = levels[ i ] = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: new THREE.Texture( generateTextureLevel( texture ), new THREE.UVMapping(), THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping ), depthTest: false } ) );
					mesh.materials[0].map.needsUpdate = true;
					mesh.rotation.x = - 90 * ( Math.PI / 180 );
					mesh.position.y = i * 0.25;
					scene.addObject( mesh );

				}

				renderer = new THREE.WebGLRenderer();
				renderer.sortObjects = false;
				renderer.setSize( window.innerWidth, window.innerHeight );
				document.body.appendChild( renderer.domElement );

			}

			function generateTextureBase() {

				var canvas = document.createElement( 'canvas' );
				canvas.width = 1024;
				canvas.height = 1024;

				var context = canvas.getContext( '2d' );

				for ( var i = 0; i < 20000; i ++ ) {

					context.fillStyle = 'rgba(0,' + Math.floor( Math.random() * 64 + 32 ) + ',16,1)';
					context.beginPath();
					context.arc( Math.random() * canvas.width, Math.random() * canvas.height, Math.random() * 2 + 1, 0, Math.PI * 2, true );
					context.closePath();
					context.fill();

				}

				context.globalAlpha = 0.075;
				context.globalCompositeOperation = 'lighter';

				return canvas;
			}

			function generateTextureLevel( texture ) {

				texture.getContext( '2d' ).drawImage( texture, 0, 0 );

				var canvas = document.createElement( 'canvas' );
				canvas.width = texture.width;
				canvas.height = texture.height;

				canvas.getContext( '2d' ).drawImage( texture, 0, 0 );

				return canvas;
<commit_msg>More tweaks to grass example. Less texture resolution, same result.<commit_after><!DOCTYPE HTML>
<html lang="en">
	<head>
		<title>three.js webgl - materials - grass</title>
		<meta charset="utf-8">
		<style type="text/css">
			body {
				background:#030;
				color:#fff;
				padding:0;
				margin:0;
				overflow:hidden;
				font-family:georgia;
				text-align:center;
			}
		</style>
	</head>

	<body>
		<script type="text/javascript" src="../build/Three.js"></script>

		<script type="text/javascript" src="js/Detector.js"></script>
		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>

		<script type="text/javascript">

			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();

			var camera, scene, renderer,
			mesh, levels = [];

			init();
			animate();

			function init() {

				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
				camera.position.y = 75;
				camera.position.z = 100;

				scene = new THREE.Scene();

				var geometry = new THREE.Plane( 100, 100 );

				var bitmap = generateTextureBase();

				for ( var i = 0; i < 15; i ++ ) {

					mesh = levels[ i ] = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: new THREE.Texture( generateTextureLevel( bitmap ) ), depthTest: false } ) );
					mesh.materials[0].map.needsUpdate = true;
					mesh.rotation.x = - 90 * ( Math.PI / 180 );
					mesh.position.y = i * 0.25;
					scene.addObject( mesh );

				}

				renderer = new THREE.WebGLRenderer();
				renderer.sortObjects = false;
				renderer.setSize( window.innerWidth, window.innerHeight );
				document.body.appendChild( renderer.domElement );

			}

			function generateTextureBase() {

				var canvas = document.createElement( 'canvas' );
				canvas.width = 512;
				canvas.height = 512;

				var context = canvas.getContext( '2d' );

				for ( var i = 0; i < 20000; i ++ ) {

					context.fillStyle = 'rgba(0,' + Math.floor( Math.random() * 64 + 32 ) + ',16,1)';
					context.beginPath();
					context.arc( Math.random() * canvas.width, Math.random() * canvas.height, Math.random() * 1 + 0.5, 0, Math.PI * 2, true );
					context.closePath();
					context.fill();

				}

				context.globalAlpha = 0.075;
				context.globalCompositeOperation = 'lighter';

				return canvas;
			}

			function generateTextureLevel( texture ) {

				texture.getContext( '2d' ).drawImage( texture, 0, 0 );

				var canvas = document.createElement( 'canvas' );
				canvas.width = texture.width;
				canvas.height = texture.height;

				canvas.getContext( '2d' ).drawImage( texture, 0, 0 );

				return canvas;

{'fraction_non_alphanumeric': 0.15447775443956463, 'fraction_numerical': 0.027687607408821844, 'mean_word_length': 3.0292307692307694, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4993186', 'n_tokens_mistral': 2203, 'n_tokens_neox': 1657, 'n_words': 393}