Skip to content

simple demo of 3d to 2d projection using plain js

Notifications You must be signed in to change notification settings

VinzSpring/JS3Dview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS3Dview

pyramids being rendered

Fig1 pyramids being rendered

This project is the result of me posing myself the challenge of coding a simple 3D renderer using only 2D canvas drawing. It was especially important to not look anything up online which could serve any hints or solutions on how to do 3D/2D projection. Fig1 shows the rendering of a bunch of pyramids. The renderer also supports transformation and moving around using hotkeys definded in Renderer.js. 3D rays can be added using

//add x-axis to linebuffer
renderer.commit(
        [
            [0, 0, 0],
            [100, 0, 0]
        ]);
// draw all lines onto the 2D canvas
renderer.draw();

//clear linebuffer/remove all lines
renderer.flush();

About

simple demo of 3d to 2d projection using plain js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published