/Deus_In_Machina_engine

C++/openGL/Vulkan 3D engine

Primary LanguageC++MIT LicenseMIT

Deus In Machina engine

C++/GL/Vulkan 3D graphic engine

This project should be an abstraction of the engine that I am using on BOC: Birth of Cultures, my intention is to be able to dedicate some time each month to update this OpenSource project, Deus In Machina is focused on performance, using most moderns indirect draw APIs, to avoid drawing API overdrive as a first major goal.

Shaders aren't a target on this project (compiling/implement are out of this), but I still can recommend the Book of Shaders, which so far is the best online resource that I could find.

First commit, hello world! :D Here is my Reddit post about why I started with a skeletal animation system. Additionally, I also discuss the future updates for this project.

[notice: until BoC early access release, I will delay the frequency of the updates for this repository] [Project renamed to: Deus In Machina]

Table of Contents

1. MultiDraw Elements Indirect

2. Multi-threading and Asynchronous Chunks Sync

3. Interface Items System

4. Skeleton Animation

  • More content coming in the near future, watch this space!

1. MultiDraw Elements Indirect

  • Coming in the next update

2. Multi-threading and asynchronous chunks sync

  • Pending organization

3. Interface Items system

  • Pending organization

4. Skeleton Animation

Skeleton animation system should not have numbers restrictions on how many skeletons, animations, keyframes or even how many game entities use each one of them, for this reason there are two separate buffers with different purposes.

The first one is static (SSBO) while the other is dynamic (UBO), GPU allows the interpolation between two final positions on shader, while is the CPU that only takes care to computing animations play-time.

There are no uniform over-load, the uniform buffer object is the only point to sync, (the 32 kb size of that guarantees a fast cpu<->gpu update). All animations transforms are pre-computed inside the static buffer SSBO to avoid extra CPU load on runtime, his max size of 128mb guarranted a lot of capacity to fill large ammount of pre-computed transforms from many diferentes animations for each skeleton.

Simplified data atlas

classDiagram
    entityAnimation <|-- entitySkeleton
    entitySkeleton <|-- entitySkeletalAnimations

    entityAnimation : startRange
    entityAnimation : animationLoader animation
    class entitySkeleton{
      Ranges
      vector#60;entityAnimation#62; animations
      skeletonLoader skeleton
    }
    class entitySkeletalAnimations{
      vector#60;entitySkeleton#62; skeletons
      vector#60;mat4#62; stackTransformations
    }
    class Mesh{
      ...vertex attributes
      skeleton_id
      bone weight [ ]
      bone ids [ ]
    }
    class SSBO_Buffer_static_draw{
      mat4 array_StackTransformations[]
      
    }
    class UBO_Buffer_dynamic_draw{
      skeleton index[skeletons][animations]
      animationPlaytime[skeletons][animations]
      keyframesLimit[skeletons][animations]
    }

(pending to end update)

Dependencies

  • ASSIMP: vcpkg install assimp.
  • GLM: vcpkg install glm.
  • GLAD: vcpkg install glad.
  • GLFW: vcpkg install glfw3.