Giter Club home page Giter Club logo

triton's Introduction

Triton Game Engine

This might become a game engine sometime in the future, but right now a lot of core functionality is missing.

Features

Renderer

  • Tiled deferred rendering
  • IBL
  • PBR
  • FXAA, SMAA
  • Shadow Maps
    • Point & spot light shadows
    • CSM for directional lights
    • Poisson tap PCF
  • HDR
  • Filmic tonemapping (Reinard / Unhcarted / Filmic / ASEC)
  • Bloom
  • Eye adaptation
  • SSAO

Dependencies

  • OpenTK
  • ImageMagick
  • Bullet physics
  • SharpFileSystem
  • Dear ImGui

Building

Open up Triton.sln and hit compile.

Samples

There are several samples available in the samples folder. Actually ... just the one.

Content pipeline

ContentProcessor.exe in=<inputDir> out=<outputDir> processes the input folder as a package if it contains a package.json file, it the package file is not present then it processes each sub directory that contains a package file. Currently only meshes and textures are processed. Collision meshes can be compiled as well but need to use ogre xml format .col.xml or have their type changed manually in the __cache.json file that gets created for the package.

Example: `ContentProcessor.exe in=..\Media out=..Data'

Supported content file formats

Meshes

  • Ogre mesh format
  • FBX + Whatever Assimp supports, probably

Textures

  • tga
  • png
  • bmp
  • dds

Audio

  • ogg

Texture naming convention

  • _d => diffuse map
  • _n => normal map

Assemblies

  • ContentProcessor - Front end executable for the content processor.
  • Triton.Common - Virtual file system, resource manager, logging and more.
  • Triton.Content - Contains all content compilers (ie meshes, textures and skeletons).
  • Triton.Game - Game base system.
  • Triton.Audio - Audio subsystem using ogg and OpenAL.
  • Triton.Graphics - Contains the high level renderers and the core graphics backend class, the backend class can be used to feed the rendering thread with commands. There are also various utilities and resource loaders in here.
  • Triton.Input - Input system
  • Triton.Math - Math classes including Vector2, Vector3, Matrix4 and Quaternion.
  • Triton.Physics - Simple wrapper for the JitterPhysics library.
  • Triton.Renderer - Core renderer, manages all GL state and provides wrapper functions for all common functionality. This is the low level renderer implementation, use the rendering backend in Triton.Graphics to issue the actual commands as thread safety is not guaranteed by the core renderer.

Cewl screenshot Cewl screenshot Cewl screenshot

triton's People

Contributors

johang88 avatar

Stargazers

Alexander avatar  avatar Wulferis avatar Philippe Paré avatar MaximovInk avatar Alexander Gunger avatar Steven Gann avatar Eirik Mildestveit Hammerstad avatar zhangqiang avatar  avatar Orhan Hajderovic avatar Jeongrok Oh avatar Enrico Speranza avatar Zelim Damian avatar

Watchers

 avatar James Cloos avatar Wulferis avatar Stylianos Polychroniadis avatar  avatar

Forkers

mengdada jwoff78

triton's Issues

RenderTarget description class

This class will be used to describe a complete render target, ie what draw targets it should, depth attachments etc .. this is then used to initialize an fbo, getting rid of all the various initialization methods that are currently in use.

GetAliasedUniformLocation and HasUniformAlias

A function in ShaderProgram to get the uniform location for an alias, for example if the following uniform is declared uniform(vec3, myLightPosition, LightPosition), then GetAliasedUniformLocation("LightPosition") will get the uniform location of myLightPosition.

HasUniformAlias is just used to check if a specific alias exists :)

Simple test application

Create a simple test application showing a cube or something to test the mesh, shader and texture systems.

Will probably find a few bugs while doing this as nothing has been tested yet :D

Seperate rendering backend from the actual thread stuff

Instead, expose a single ProcessCommands method that can be run from the outside. The rendering backend will have to be constructed on the main rendering thread.

Renderer resource transfer & creation will be done in ProcessCommands. With a time limit just like it currently is.

But the public interface to add commands to the work queue will be remove.

// Add
public void ProcessCommands();
// Remove
public void AddCommandToWorkQueue(Action workItem);

Basic math types

The high level sub systems like Triton.Graphics should use custom math classes, projects that use these sub systems should not have to reference OpenTK directly. I will probably use much of the basic OpenTK math classes however or maybe look into the math classes in SlimDX or SharpDX, I think they were quite nice :)

Resource complete callbacks in all subsystems

Ie in the graphics system CreateMesh, CreateTexture etc. should have some kind of callback to indicate that they are done.

These callbacks are then used in the resource management system. This will allow us to check when all resources have been loadede etc.

Suggested callback in graphics subsystem:

// int => resource handle, bool => success, string => error messages
Action<int, bool, string> ResourceInitialized

Suggested callback for resource loaders:

Action<Resource> ResourceLoaded

Skeletal Animation

This is going to involve a lot of work. A lib for the actual animation, the mesh file format has to be extended with bone information or maybe separate files for animations/bones is enough?

Shadow mapping

Spot
Point (cube maps, with geometry shaders?)
Directional (PSSM)

PCF filtering or maybe something else like ESM or VSM?

Implement BatchBuffer

This is used to implement SpriteBatch classes, particle systems and other kind of dynamic renderers.

class BatchBuffer : IDisposable {
    public BatchBuffer(int intialVertexCount);

    // Begins rendering of a new batch
    public void Begin();

    /** Methods that add data to th vertex buffer **/
    public void AddVector3(float x, float y, float z);
    public void AddVector3(ref Vector3 v);

    public void AddVector4(float x, float y, float z, float w);
    public void AddVector4(ref Vector4 v);

    // Adds a triangle to the index buffer
    public void AddTriangle(int v1, int v2, int v3);

    // Flushes the buffer and uploads the data to the gpu
    public void End();

    // Internal resource handle, should probably not be managed by the resource manager?
    public Resources.Mesh Mesh { get; }
}

Test mesh

I need a test mesh, maybe a cube? :)

game object template system

It should support inheritance, efficient saving of derived templates would be cool as well (ie only write changed values).

A game object is just a list of components, the components should probably implement the serialization explicitly. But an automated solution could work. ServiceStack might work nicely for that if we can customize it enough to work with the inheritance feature.

Proposed json syntax:

// object_templates/base_crate.tmpl.v
{
    "components": [
        {
            "type": "Mesh",
            "filename": "models/crate"
        },
        {
            "type": "BoxRigidBody",
            "length": 1,
            "width": 1,
            "hiehgt": 1,
            "mass": 10
        }
    ]
}
// object_templates/heavy_box.tmpl.v
{
    "parent": "object_templates/base_crate",
    "components": [
        {
            "type": "BoxRigidBody",
            "mass": 100
        }
    ]
}

Culling systems

Start with basic frustum culling, maybe implement some better methods after that?

Custom vertex formats

Need to support custom vertex formats somehow. Necessary for particle systems, sprites etc that need vertex color and usually do not need normals or tangents.

Stage System

We need a stage system in the graphics subsystem. Graphics entities will be created on the stage, each entity should have a location and orientation, or maybe just a world matrix.

The stage will then be used to feed the graphics backend and render the scene.

Support for FragDataLocation in shaders

This will allow mrt's to be used. The preprocessor has to be extended to detect shader outputs. ie something like:


out(vec4, oColor, 0);

The last parameter will determine the color output index.

Render Target manager

It should be possible to create render targets in the render system.

Proposed interface

int CreateRenderTarget(int width, int height, PixelFormat pixelFormat, int textureHandle, int? depthTextureHandle)
void ResizeRenderTarget(int handle, int width, int height)
void DestroyRenderTarget(int handle)

This interface will work for now, in the future we will want support for MRT and maybe shared depth buffers, stencil targets etc.

Simple physics layer

I will use Jitter physics for this, just make a semi nice wrapper so that it can be exchanged if necessary.

Content processor

Processes assets in the Media folder and puts them in the Data folder.

Start with texture and mesh processing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.