Skip to content

PSIEngine :: My Custom 3D Engine. (OpenGL, C++14, Lua-scripting)

Notifications You must be signed in to change notification settings

Sakari369/psiengine_public

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSITriangle 3D Engine

My custom built 3D engine. Supports macOS 10.13+.

Features:

  • C++14 & Lua -scripting.
  • Simple OpenGL 3.3+ renderer.
  • Application logic can be written with C++ or Lua. Scripting with Lua preferred.
  • Focus on simplicity and ease of use.
  • Fast startup time & idea iteration.
  • Geometry shader based line rendering for closed polygon shapes. This engine was originally designed to be used with very specifical recursive geometric shapes, which required fast line rendering methods.

Wrote this engine originally for the Geometrify VR project (https://geometrify.net) and to understand how 3D engines work. In it's current state this is a toy engine, but with the Lua scriptability you can already do some pretty advanced stuff with fast iteration times and ease of development.

NOTE: That said, I have not included the Geometry shader based line rendering code in this public release, as we are developing IP around this idea and have put a lot of work into iterating this implementation. For this public release, all other code is available though.

This is more of a toy engine, as I have no interest in trying to optimize the performance to match those of commercial or other game engines. Focus is on trying out 3D -ideas in as simple as possible way. I have an undestanding on how to make the engine perform better, but making this happen would mean having to implement a lot of state tracking optimizations, which are are a pain in the ass and not fun to implement :) For any serious use case, I would prefer to use Godot these days.

Motivation behind writing a 3D engine

Wrote this engine to understand how 3D and 3D engines work and to target specifically rendering this kind of recursive geometry in an efficient way:

Geometry shader circle polylines

(click on image to open video)

Currently I use this engine to toy around, as the Lua scripting environment that I've setup for this project is very nice and performant to use, and it's nice to be more close to the metal when doing for example demo-coding or creating some cool effects.

The engine is pretty simple. Supports basic textured phong shaded models, mouse and keyboard input support, OpenGL 3.3+, shader loading, glTF -model loading and generating geometry meshes procedurally. Text rendering using Freetype-gl, video support through GLFW, optional audio playback with fmodx, custom logging framework and HSV color manipulation.

Based on a simple object based system, where application logic runs from Lua scripts. All rendered objects are placed inside a scene, and the scene is rendered.

Main unique feature of this engine are the Poly classes which can render complex, recursive, closed polygonal formations in a fast way. Utilizes geometry shader support in OpenGL 3.3.

This engine was mostly written during 2014 - 2016, with some updates being worked afterwards. I've tried to update the code to match my current style preference with C++, but it is still a pretty naive implementation. My C++ skills have evolved a lot since building this, so this does not represent my current knowledge on this subject :)

Releases using PSIEngine

The only publicly released project made with this engine is an demoscene demo made for the Skrolli Party 2017. Our demo placed first place in the compo, which I am happy about :) This demo showcases our fast procedural closed polygonal fractal rendering support.

Skrollightenment screenshot

You can download the demo for macOS here: http://www.pouet.net/prod.php?which=69986

We also had a Geometrify demo with Oculus Rift DK2 support pretty far, but ultimately we could not create this application without tooling back in 2015. You can see a video of how far we got with the DK2 demo here:

Geometrify DK2 demo

(click on image to open video)

Now we have OmniGeometry for creating the scenes (http://www.omnigeometry.com) and I have been since implementing the same idea utilizing Godot -game engine and now latest one with Unity, but still this vision has not been finished. Work continues :)

Directory Structure

The project is structured into the following directories:

  • engine :: Main source code

    • core :: Main source for the core engine parts. Compiles as separate library.
    • src :: Application source code. Utilizes the PSICore library and defines the Lua -scripting interface.
    • assets :: Assets like application scripts, music, scenes and graphics.
    • assets/scripts :: Lua -scripts for main program logic.
    • assets/shaders :: OpenGL GLSL shaders.
  • testing : Test projects in mainly C++.

Software needed for building.

PSIEngine uses the following open source libraries and software:

Needed to compile:

Library dependencies installed via Conan:

Provided prebuilt library for macOS x64:

You need to also have Lua installed and compiled with a C++ compiler:

Compiling & Running

Clone the repository, run:

git submodule update --init --recursive

To pull in the engine core and required submodules.

Change to directory 'engine', and run:

mkdir build && cd build
conan install ../
cmake -G Ninja ../
ninja

(You can also use 'cmake -g "Unix Makefiles"' and make, if you dont have Ninja installed.)

Now you should have the engine binary under 'build/bin/psiengine'. You can now run this from the build directory (script assets are loaded relative to the binary path currently):

bin/psiengine hypercube

This will start the engine and load the application logic from the provided 'engine/assets/scripts/hypercube.lua' script.

Screenshots

Hypercube screenshot Polyzoomer screenshot DNA Snake screenshot Icosahedron ball Pong game screenshot

About

PSIEngine :: My Custom 3D Engine. (OpenGL, C++14, Lua-scripting)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published