Thursday 29 November 2012

Theme Park Scene 5

Since my last update, I have made some alterations to the disc primitive that give it a centre point. From here, I was able to create a cone primitive to be used as the roof of the carousel. I have also improve efficiency by removing the normal calculations from the disc, and simply looped through all of the vertices and assigned them to Y 1. This prevents a considerable amount of unnecessary computation taking place. I have also created a 'ring' and 'hoop' primitive. The ring is flat, the same as a disc, however has a hole of customizable size in the centre. The hoop is a 3D implementation of the ring, using two ring primitives for the top and bottom surfaces. However, my normal calculations algorithm does not yet work properly for rings or cones, and this is what I will be working on next.

The normals for the cone primitive on the roof make it appear black.

The centre point of the disc primitive can be seen in wireframe mode.

Tuesday 27 November 2012

Theme Park Scene 4

I have successfully added a Cylinder primitive to my program. The cylinder primitive contains two disc primitives which are used to approximate a circle for the top and base of the cylinder. From here, the cylinder allocates the top and bottom vertex, then bottom and top vertex around the discs for each face. The number of faces the cylinder has can be defined in the constructor, meaning you can get various levels of smoothness. It also means the class can be used to create prisms, passing three as the number of base points for example will produce a triangular prism. From here, I can use the disc and cylinder class as a basis to build both cones and quarter cylinders (to be used as corners on a go-kart track). I can also produce cylinders with no top face to be used as park bins, and I can also begin to model lights to go around the park. Below are some screenshots of the cylinder class being used.

A cylinder with 32 base points. Any more than 32 base points means that the indices being drawn will have to use negative values, as GLbyte is being used as the type for vertex indices.

A cylinder with 64 base points. This means 256 vertices for the central faces, plus 128 for the top and bottom discs,
a total of 512 vertices.

More vertices mean a more expensive computation when generating the cylinder, but do improve it's smoothness.

A triangular prism made by passing three as the number of base points.

Saturday 24 November 2012

Theme Park Scene 3

Today, I have added a river to the scene. The river is created by being given four initial points as it's corners, and then this quad is subdivided using a recursive member function. The number of subdivisions can be altered via a parameter passed to the class' constructor. Each vertex is then given a random height. In order to get the river to update when the camera was not moving, I had to make use of GLUT's idle function in order to re-calculate the river's vertices and normals on each frame. This meant that I also had to call redisplay on each frame, and so at the moment all geometry is being redrawn every single frame. This is not the most efficient way of going about animating the river, but it will stay in place for the time being. Every time the river is updated, it is subdivided again. However, I wish to change this and simply generate new heights for each existing vertex inside a separate function. This will make the program more efficient. Below are some images of the river, along with an image in wireframe mode so that the subdivision of the surface can be seen.




Below is a video that shows the river as it re-generates it's vertices to create a basic water effect. It is in no way a uniform or highly realistic effect, but it works for now. Video is low quality due to the screen capture software and upload process, however when in wireframe mode the subdivisions can be seen moving.


Friday 23 November 2012

Theme Park Scene 2

Continuing my work on the Theme Park scene, I have been attempting to add a Cylinder primitive. In order to do so, I have also created a Disc primitive to be used inside the cylinder primitive. However, I am having trouble defining a draw order for the vertices that make up the faces between the rings, and have been getting some strange results from my algorithms. My intention was to use the existing vertices in the discs to create quad surfaces between each four points. I will continue work on the cylinder primitive at another time. Some pictures of the results are below.



I have also modelled a small ring toss stand to go in the park, displayed below. This is yet to be complete, as I need a cylinder primitive to finish it.




I have also modified the scene's lighting to make it brighter. In true christmas spirit, I also intend to add a 'Christmas' mode to the Theme Park, which will change the ground to snow and spawn snowmen at various locations around the scene. If I have time before the deadline, I will also add a basic snow effect.



My final addition in this update is the ability to move the camera up and down on the Y axis. However, the camera does not rotate on it's X axis, so it does not fly freely as of yet.


Wednesday 21 November 2012

Theme Park Scene 1

I am currently developing a Theme Park scene as part of a Graphics Programming module at University. We are using OpenGL and C++. Thus far, I have a basic class structure that allows me to inherit from a 'Primitive' class, which allows me to easily create primitive shapes such as cubes or tetrahedrons. Vertex normal calculations and texture mapping is black boxed by the Primitive class, all the derived class' constructor needs to do is define the vertices, texture mapping coordinates and draw order for the vertices, all on the constructor's stack and the primitive class creates these in the heap as it's own members. I can also inherit from a Model class, and each model can contain a number of primitives to create it's geometry. The camera also moves and rotates on the XZ plane, however I hope to expand this so that the camera is free to move/rotate in all directions. The following are some screenshots of the scene at present, with a few models implemented.

This bridge will go over a river, which will have a small and very basic ripple effect created using recursive subdivision of a single quad surface.




By my next update, I hope to have implemented an algorithm to allow me to generate circles/curved surfaces in order to create a Cylinder primitive. This will require some modification of the vertex normal calculations as well.

First Post

Hello! This blog is going to be used as a portfolio of my game development work, as well as showing progress on specific projects.