SmallWorld3D

The White Box of 3D Programming

About

SmallWorld3D is an educational realtime 3DCG library. Entire system including polygon rasterizer is written in short javascript.

No Blackbox Hardware No Proprietary Library Only Pure Javascript

Download

Please download zip or pull from Github

Getting Started

Step 1: Create framebuffer and rasterizer.

	framebuffer = new smallworld3d.ImageBuffer(300, 300, true);
	rasterizer = new smallworld3d.Rasterizer(framebuffer);
	rasterizer.enableZTest = false;

Step 2: Draw a polygon.

	rasterizer.setVertexAttribute(0,
			10, 10, 0, 1,
			255, 0, 0, 255);

	rasterizer.setVertexAttribute(1,
			290, 20, 0, 1,
			0, 255, 0, 255);

	rasterizer.setVertexAttribute(2,
			80, 290, 0, 1,
			0, 0, 255, 255);
			
	rasterizer.fillTriangle();

Step 3: Output.

	framebuffer.emitToCanvas(g); // g is a 2d context of canvas

You'll get:
output

Demonstrations

Screenshot1
Simple Polygon
Screenshot2
Miku Model
Screenshot3
SH PRT
Screenshot3
Motion
2012 ushiroad