OpenGL


2nd year projects at university, spanning 2017-2018

Demonstration of GLSL and low level understanding

EARTH 2018


Team: 1 (Solo)

Duration: 6-8 weeks

Year: 2018

Platform: PC

Format: C++ / GLSL


This project was the finale of learning about OpenGL - the concept was to demonstrate and/or combine all shaders we have written into something interesting


In the hopes of educating the viewer, I decided to create models of some popular landmarks of continents, also adding GDP and largest cities information


Adding on from writing Phong shaders, using textures and normal maps, I decided to write a Bloom shader and use Percentage Closer Filtering (PCF) with the shadows to great effect. As well as this, a perticle effect at each Pole of the Earth was written as a pair of vertex/fragment shaders


main.cpp

bloom.frag

blur.frag

particles.frag

atmosphere.frag

model.frag

REFLECTIVE WATER


Team: 1 (Solo)

Duration: 2 weeks

Year: 2017

Platform: PC

Format: C++ / GLSL


Playing with solutions of reflective water, I decided to try out some of the native OpenGL features - stencils and clipping planes. The idea was to clip the terrain at water level so only any part of it that is above water is rendered. After this, flip the terrain over (which also means that textures applied must be flipped and also lighting!) - this is then applied to a stencil buffer and applied as a texture on the water surface, with a mixture of the water colour


There are issues as seen in the screenshot to the left - where the waves break, the viewer can see where the clipping plane has been set. This can be mitigated but will need the manipulation of vertices of the terrain itself, which is too inefficient. The most efficient way to apply this effect is to calculate the reflection vector of the camera and simply apply this as a texture


main.cpp

water.frag

terrain.frag

INDOOR SCENE


Team: 1 (Solo)

Duration: 2-4 weeks

Year: 2017

Platform: PC

Format: C++ / GLSL


This project was a long running demonstration and evolution of our understanding of lighting, texturing, reflections, shadows and Vertex Buffer Objects. Firstly, I worked with the vertex shader, ambient and specular lighting - then moved onto fragment shaders and adding textures/normal maps and reflections


The vertex shader use the Phong Reflection Model for ambient, diffuse and specular lighting - the use of a cubemap for the reflections on the vase, and prepares tangents for normal maps. As can be seen in the screenshots, the spotlight was moved from vertex to fragment shader and had a much more realistic effect. The fragment shader also determines which shadow map to use based on which light is active, and also takes advantage of the mix() for the vase's texture


main.cpp

basic.frag

 

All content and trademarks property of their respectve owners.