Skip to content

DenDunno/Dengine

Repository files navigation

Build & Usage (.NET 7 required)

The editor has a similar UX to Unity. When play mode, use WASD + mouse for exploring.

If you get "System.DllNotFoundException: Unable to load DLL 'cimgui' or one of its dependencies", load Visual C++ Redistributable from MS VS from https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170

Avaliable demos

Particle system

Command: dotnet run --project ParticleSystemDemo/ParticleSystemDemo.csproj

Key features:

  • Hold left mouse button to emit particles
  • GPU instancing for rendering
  • Compute shader for update cycle
  • Zero CPU allocation. Particle data stores at SSBO (shader storage buffer object).
  • Usage of pool
  • Main bottleneck is emitting: accesing of SSBO from CPU side.
public unsafe void Emit(Vector3 position, int particlesCount = 1)
{ 
    _shaderStorageBuffer.Bind();
    Particle* particles = _shaderStorageBuffer.MapBuffer(BufferAccess.WriteOnly);
    
    for (int i = 0; i < particlesCount; ++i)
    {
        ResetParticle(particles, position);
        MovePoolIndex();
    }
    
    _shaderStorageBuffer.UnMapBuffer();
}

GPU instancing

Command: dotnet run --project GPUInstancingDemo/GPUInstancingDemo.csproj

Key features:

  • Compute shader for asteroids update
  • Perling noise shader for sun
  • Simple lighting shader for asteroids
  • Custom OBJ parser (Obj must be triangulated)
  • Rotating space skybox

LOD Group

Command: dotnet run --project LODGroupDemo/LODGroupDemo.csproj

Key features:

  • The selection of LOD is determined by recalculating the distance between an object and the camera during runtime.
public void Bind()
{
    _current = GetLODMesh();
    _current.Bind();    
}

private MeshBinding GetLODMesh()
{
    float distance = Vector3.Distance(_camera.Transform.Position, _transform.Position);
    MeshBinding result = _lodMeshes[0].Mesh;

    for (int i = 0; i < _lodMeshes.Length - 1; ++i)
    {
        if (distance > _lodMeshes[i].Distance)
        {
            result = _lodMeshes[i + 1].Mesh;
        }
    }

    return result;
}

About

Bachelor thesis. Render engine using OpenTK and ImGui

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published