Froggy Engine

What is Froggy Engine?

Froggy Engine is a C++ OpenGL game engine designed with infinite world generation in mind, using several techniques to prevent floating-point precision errors.

The motivation behind the project came from my interest in procedural worlds, generating terrain from combined and layered noise, and creating my own world meshes. I knew that Unity relies heavily on floats, meaning floating-point precision would eventually become a problem in a sufficiently large world. With more experience in OpenGL, I decided to start working on my own C++ engine and experiment with solving this problem myself. I also wanted more control over things such as custom attributes and descriptor set layouts, which was something I felt I was missing when working with Unity.

Over the past year, I have used both what I learned during my studies at Howest and my own research to figure out how I wanted to design the engine. It currently features mesh rendering, a scene graph, automatic asset deallocation, asset bundling, GLSL shaders, post-processing, skinned meshes, 3D physics, debug tools, an animation controller editor, an asset browser, ImGui debug utilities, instanced transparent rendering, alpha cutoff shadows and several other features.

How does it work?

The main idea behind solving the floating-point precision problem is to move the precision relative to the camera. I do this by combining the projection, view and model matrices as double-precision matrices on the CPU before converting the final result to a float matrix and uploading it to the shader. This approach creates some additional challenges when information about the scene is needed in world space. World-space rotation can still be used, for example for world normals, but position data has to be handled differently. This became especially important when storing information for deferred shading. Instead of storing an absolute world position, I store the position relative to the camera. Other positional data, such as point lights and shadows, then needs to be provided in the same relative space.

One of the more controversial decisions I made was to avoid scene serialization and systems such as prefabs. There were a few reasons for this. The first is reflection. The second is simply the nature of an infinite world. If the world is generated rather than predetermined, storing an entire predefined scene becomes less useful. I also prefer leaving more control over this to the user of the engine. Another reason is that I personally feel more comfortable keeping asset fetching and prefab creation in C++ rather than relying on reflection to search for fields that need to be filled in. This means I can convert strings into hashes at compile time and fetch assets that way. For me, this makes it easier to understand exactly what is being fetched and gives me more control over when it is fetched.

Gallery

Physics engine

https://www.youtube.com/watch?v=npP3vRviLPI

Froggy engine uses Bullet Physics as its physics engine. Here is just a simple scene with a ground plane and randomly spawned cubes.

Sponza Test Render

A rendering test using the Sponza scene provided as a glTF model, which I had also used as part of my Graphics Programming 2 course.

Sponza Test Render 2

Sponza scene with different exposure and light direction.

Alpha cutoff shadows

Froggy engine allows for materials to submit a cutoff texture for shadow rendering.

Parallax

Example using an albedo map, normal map and height map.

God Rays Post Processing

Asset browser

An asset browser to aid in managing multiple json files. It features some import functions, a model wireframe renderer and a texture viewer.

Animation browser

An animation browser and tool for setting up animation controllers.

Current plans for the engine

I am still debating whether to make the repository public. I have put a lot of effort into creating the engine and I am not sure whether I want to release it yet. It is also not fully finished to a point where I am completely satisfied with it. At the moment, I am working on refactoring the rendering system so that objects are first sorted by distance and then organized into batches for instanced rendering. The new system also provides rendering callbacks that allow the user to add custom rendering passes, including a callback for buffering into the deferred shading buffer and another for the transparency accumulator. I also plan to implement a networking solution for the engine, add support for compute shaders and auto exposure, improve the handling of lights for transparent meshes, and add LOD group support for rendered objects.

Source code available on request