Framebuffer - Basic Scene
How do I make an framebuffer - basic scene?
This is an example for the Tuts+ tutorial on rendering to a texture in Three.js. What is a framebuffer - basic scene? How do you make a framebuffer - basic scene? This script and codes were developed by Omar Shehata on 13 August 2022, Saturday.
Framebuffer - Basic Scene - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Framebuffer - Basic Scene</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src='http://cdnjs.cloudflare.com/ajax/libs/three.js/r70/three.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Framebuffer - Basic Scene - Script Codes CSS Codes
/* We want our scene to span the entire window */
body { margin: 0; }
Framebuffer - Basic Scene - Script Codes JS Codes
//@author Omar Shehata. 2015.
//We are loading the Three.js library from the cdn here: http://cdnjs.com/libraries/three.js/
///////////////////This is the basic scene setup
var scene = new THREE.Scene();
var width = window.innerWidth;
var height = window.innerHeight;
var camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
//////////////Create some arbitrary objects in our scence
//Let's create a red box
var redMaterial = new THREE.MeshBasicMaterial({color:0xF06565});
var boxGeometry = new THREE.BoxGeometry( 5, 5, 5 );
var boxObject = new THREE.Mesh( boxGeometry, redMaterial );
boxObject.position.z = -10;
scene.add(boxObject);
///And a blue plane behind it
var blueMaterial = new THREE.MeshBasicMaterial({color:0x7074FF})
var plane = new THREE.PlaneBufferGeometry( window.innerWidth, window.innerHeight );
var planeObject = new THREE.Mesh(plane,blueMaterial);
planeObject.position.z = -15;
scene.add(planeObject);
//Render everything!
function render() { requestAnimationFrame( render ); //Make the box rotate on box axises boxObject.rotation.y += 0.01; boxObject.rotation.x += 0.01; //Finally, draw to the screen renderer.render( scene, camera );
}
render();
Developer | Omar Shehata |
Username | omarshe7ta |
Uploaded | August 13, 2022 |
Rating | 3 |
Size | 2,217 Kb |
Views | 36,432 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Buggy Smoke | 3,213 Kb |
Smoke Shader - Setup | 2,339 Kb |
Initial Scene | 2,545 Kb |
Framebuffer - Texture Render | 2,402 Kb |
Basic Threejs Scene | 2,188 Kb |
Rotating Cube | 2,151 Kb |
Framebuffer - Final | 2,491 Kb |
Smoke Shader - Frame Buffer | 2,672 Kb |
Simple Lighting Model | 3,365 Kb |
Smoke Shader - Diffuse | 3,283 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
TweenMax transformOrigin Bubble | Nicolund | 2,209 Kb |
Fun animations with CSS3 | Minimalmonkey | 2,360 Kb |
Print element on a page | Mrs_snow | 2,081 Kb |
Spinners using Font Icons | Keyamoon | 3,007 Kb |
Single element checkbox | Ivijaygupta | 1,996 Kb |
BSP Dungeon Generation | Xgundam05 | 5,326 Kb |
Confirm Close Of Foundation Reveal Modal | Winghouchan | 1,818 Kb |
Simple animated hover effect | Pobee-norris | 3,044 Kb |
Pure CSS read more toggle | Idered | 2,344 Kb |
HEXAGON | Aurumlux | 1,684 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!