Skip to content

Custom Graphics Renderer

Description

Here is some progress pictures from a graphics renderer project that I was working on a year ago while learning graphics programming. I was mainly focused on OpenGL, but the idea was to write a general graphics/game engine and add a Vulkan API support for it too.

Testing mesh repeater settings

Obj settings

Testing instancing ( copying all vertex data to GPU and drawing only once )

Instancing Instancing2

Mesh pointer

The grid can be navigated by moving around the pointer with keyboard. Instancing

Modifying individual mesh properties in a mesh grid

The idea here was that each mesh, or an object would have this 'repeater' setting built in, so that they could be copied to all directions, add padding, rotating and scaling them individually just changing the configs. Grid modifying

Multi select

Meshes can be multi-selected in the 'repeater' grid, and adjusting the transformations all at once. Multiselect Multiselect2

Materials

Testing materials Materials Material Instancing

Textures

Testing texture loading. Textures

Models

Testing 3D model loading Models Models2 Models3

Lighting

Implemented the Phong lighting model, which consists of different components; ambient, specular and diffuse lighting. These are all calculated in the fragment shader.

Here are different types of lights:

Directional lights ( diffuse )

Ambient light is also present, otherwise the unlit side of the boxes would be completely black and the texture would not show up. Directional Light

Specular maps

This adds the 'metal' effect to the texture Specular

Pointlight fadeout

Pointlight Fadeout

Spotlight

Spotlight

Multiple different lights

MultiLights

Multiple point lights

MultiPointLights

Physics

Testing the 'Bullet' real-time physics simulation engine Physics Physics2

Terrain

Testing terrain generation with berlin noise

Something's not right

Terrain Terrain2 Terrain3

Refactoring

At this point the test code base structure was getting a bit out of hand and I decided to start designing a little bit how it would work better. I was thinking that the renderer would work as an 'engine' library, separately from the game or other use case. I also moved to a ECS ( Entity Component System ) based system, which optimizes the CPU cache for handling the data. I also started to think about how to abstract the graphics API so that Vulkan API could be added later on to the engine.

Some terrain and cubes from the new 'engine' library added to the scene

ECS