Computer Graphics Programming Assignment #5
Here, I want to write a program that visualizes a 3D scene and uses 2D canvas drawing operations to construct a 2D projected view of it on the screen.
This presentation shows how to visualize a 3D scene that uses Canvas drawing instructions. The example demonstrates all of the transforms involved the 3D modelling pipeline, including the model, the LookAt, the Projection(s) and the viewPort transforms. I want to create a visualization that is similar to the camera view of this example.
I can take the project from project #3 and #4 and "lift it to 3d by having the drawing happen on a plane. It is ideal, though to have the code to be natively 3-dimenaional.
The requirements are as specified:
There has to be a movable camera.
The 3D world must contain a hierarchical network, or a parametric curve, or both.
I have to make it certain that a 3D scene is being observed.
And I need to use a projection transform
Create a object that uses 3D motion and transforms, and have objects fly along 3d curves.
Or have solid-filled polygons "hide" each other. We should only be able to see 3 of the 6 faces of a cube, for example. Or maybe create an airplane that flies along a spiral-shaped path.
So first, I want to be able to implement the moveable camera, but in 2 screens, not one.The first thing that I want to do is to open up visual studio and type the HTML skeleton code.
and the following is my code:
Now it's time to write the Javascript code.
Now, I'm taking a look into TransformMat4.
This link does a good job in describing mat4 functionality.
transformMat4(out, a, m) → {vec4}
fromValues(x, y, z) → {vec3}
Here, I want to draw a rectangular diagram, kind of like a cube, but with one side longer than the other.
My first goal is to create a 3-dimensional cube using the WebGL library. Use this link.
I realized that I can just emulate the creation of the camera or a simple 3d shape, and then just connect the vertices, so I can do that instead.
I have now had a weird 2D curve as follows:

Comments
Post a Comment