I set out to create an image of a dimly lit library, the kind where secret knowledge and untold adventures await anyone brave enough to dive in. More specifically, I wanted to draw a dark and moody room with a bookshelf filled with books in the back and a simple wooden table being lit by a lamp. In the table, an empty tinted glass and a marble chessboard with a finished game lie. The game of chess shows a king defeated by three simple pawns. Make of that what you will...
The project had the goal of incorporating many of the different aspects of computer graphics into a single scanline image that was either artistic or realistic. I focused mainly on trying to attain a more realistic image.
The geometry in the scene is composed of 8 different objects, all loaded from OBJ files. However, 7 of those OBJ files I created myself from scratch, writing vertex positions and faces for each model by hand. The models I created are: the chess pieces (king and pawn), the glass, the table, table legs (which are not particularly visible in the images), the chessboard, and a simple background plane. The eight object, the lamp on the table, is a model I obtained from the Internet that even included its own textures. If you wish to see some of the meshes I used in my scene individually, please use the button below.
To make the geometry look better and have a more realistic effect, I worked with several textures to paint my models. As I have mentioned already, the lamp model already included its own texture. The glass uses a mixture of a yellowish material and a normal map to give it the appearance of a tinted glass with ridges. The table uses an image of wood I mapped to it to look like a real wooden table. The background plane also has a simple image mapped to it, that of a dark and barely lit bookshelf filled with books. Both king and pawns use only simple material, but had loop subdivision performed on them for a smoother and much more realistic look. Finally, the chessboard has a combination of textures to give it a better look. It has both a color map, which has the black and white tiles as well as green marble look, and a normal map to make the colored tiles stand out with some volume as well as add a bit of height to the edge around them. You can see the textures I used in my scene with the button below.
To give the scene a feeling of darkness and of being only dimly lit, I used a spotlight located near the top of the lamp model (as it's supposed to model the lightbulb in it) that points downward towards the chessboard. Because the original shaders we had only contemplated positional lights and an RGB color space, however, I faced the challenge of modifying the shaders in order to achieve 3 things. Using other shaders from the Internet, alongside the original ones, I was able to create a couple of shaders that handled colors as RGBA vectors, hence including alpha channels (which allow the glass to look transparent), were capable of handling all of the different textures (4 color maps, 2 normal maps), and modeled light as a spotlight (using its attenuation exponent and cutoff angle).
Additionally, because I was loading models from OBJ files with texture coordinates stored in them, I had to tweak the STTriangleMesh class in order to include a method that was capable of reading texture coordinates and correctly storing them alongside the rest of the geometry so that the textures would actually show properly. In order to generate the texture coordinates for the OBJ files, I imported them into Blender, where I mapped the textures to the geometry and tweaked it a little before exporting the model again, this times with uv's added to it.