3D engine from scratch (without OpenGL or any other 3D graphics library)

Related tags

Graphics 3d
Overview

3dzavr

About:

Simple 3d engine based on SFML library. I tried to make this engine powerful and easy to understand.

The main goal - to implement basic 3D graphics from scratch (without OpenGL or any other 3D graphics library)

For this moment I already implemented:

  • Operations with Point4D, Matrix4x4, Triangles and Mesh. I used operators overloading to simplify coding.
  • Projections from 3D on 2D plane, movement and rotation of camera and meshes.
  • Triangles clipping
  • Advanced smooth animations by using Bézier curves for meshes and camera
  • External camera (You can see how 3D world projected on 2D plane and the process of clipping)
  • You can render animated scene to .mp4 files or sequence of .png files (film/img/ & film/mp4). But it is extremely slow process due-to SFML waste a lot of time on saving .png files. It is still better to capture your screen by some additional software.

TODO:

  • Physics engine

  • Ray-tracing & recursive ray-tracing

  • Textures

Installation:

  1. Download and install OpenAL library for SFML sound support (in current version you can't setup this engine without OpenAL)

    openal: https://openal.org/downloads/

  2. Install SFML on your computer:

    sfml: https://www.sfml-dev.org/download.php

  3. Open CLion or Visual Studio

    CLion (recommended): https://www.jetbrains.com/clion/

    Visual Studio: https://visualstudio.microsoft.com/ru/

  4. Clone this repository

    rep url: https://github.com/vectozavr/3dzavr

  5. Built project

For any issues, please, create new issue in this repository.

Demonstration of how does this engine work: hippo hippo Project demonstration Project demonstration Project demonstration Project demonstration Project demonstration Project demonstration

Issues
  • Improvements

    Improvements

    Replaced linked list with two vectors to reduce CPU cache misses and reduce memory allocation operations. Added window focus checks before any input. Added const modifier to mesh in Camera::project to prevent mesh::triangles from coping. Added virtual destructors for safety purposes. Replaced loop in matrix and point multiplication with straight code to improve performance. Added parallel execution policy for sorting.

    opened by Neirokan 0
  • Improvements

    Improvements

    Replaced time implementation with more precise version. Added FIXED_STEP define and realDeltaTime function. Removed pointers from Point4D with just (&x)[i] (actually hidden behind STORE_POINTER define just in case). Replaced some deprecated code. Removed z from Triangle.

    opened by Neirokan 0
  • Painter's algorithm problem

    Painter's algorithm problem

    For now I use average z of triangle to sort them in correct order:

    double z1 = t1[0].z + t1[1].z + t1[2].z; double z2 = t2[0].z + t2[1].z + t2[2].z; return z1 > z2;

    where t1 and t2 - two triangles to compare.

    But anyway we have glitches when some triangles wrongly overlap other triangles. Example:

    1
    opened by vectozavr 2
Owner
Vectozavr
Student of Physical Department in Novosibirsk State University. I mainly do physics, math and have a common interest in computer science.
Vectozavr
OpenGL®-Starter is a template for your upcoming OpenGL Projects which has been compiled to run the most basic Hello World OpenGL Program from LearnOpenGL.com.

OpenGL®-Starter OpenGL®-Starter is a template for your upcoming OpenGL Projects which has been compiled to run the most basic Hello World OpenGL Progr

Kushagra 8 May 27, 2022
Vire is a C++ voxel rendering engine. It is written in C++14 and uses OpenGL for graphics.

Vire Vire is a C++ voxel rendering engine. It is written in C++14 and uses OpenGL for graphics. Downloads If you'd just like to just download and try,

null 35 Jun 25, 2022
Software RayTracing engine written in C++ without the usage of any libraries.

Software Raytracing Engine This is a software unidirectional raytracing engine, fully written in C++17, with no dependencies or external libraries use

Makar Ivashko 2 Jun 23, 2022
A terminal-based graphics library for both 2D and 3D graphics.

TermGL A terminal-based graphics library for both 2D and 3D graphics. Written in C, created for terminals supporting ANSI escape codes. Table of Conte

null 201 Jun 26, 2022
OpenGL Object Loading can load virtually every 3d.obj file you can find on the internet, without using another object loading library

OpenGL Object Loading can load virtually every 3d.obj file you can find on the internet, without using another object loading library (assimp for example). The program can load Object with 12M+ triangles and more

Phan Sang 4 Jun 21, 2022
Yet another Chip-8 interpreter, this time written in C++ using GLFW and OpenGL as its graphics library 💻

Yet another Chip-8 interpreter, but this time with a beautiful interface ??

Akshit Garg 26 Jun 4, 2022
A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input

GLFW Introduction GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platf

GLFW 9.2k Jun 24, 2022
kaun is a replacement for löve's built-in love.graphics module intended for 3D graphics

kaun kaun is a replacement for löve's built-in love.graphics module intended for 3D graphics. It is a Lua module you can require from a shared library

Joel Schumacher 4 Apr 5, 2021
This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.

DirectX-Graphics-Samples This repo contains the DirectX 12 Graphics samples that demonstrate how to build graphics intensive applications for Windows

Microsoft 4.6k Jun 27, 2022
Brand new engine with new and QoL features. Grafex is Psych engine with some additions and Better graphics

Friday Night Funkin' - Graphex Engine Credits: Grafex Mod aka Psych Graphic Rework: Xale - Lead Coding, Artist PurpleSnake - Second Coder Psych Engine

Xale 2 Jun 27, 2022
My attempt at OpenGL graphics

Graphics My attempt at OpenGL graphics. I have no idea what this will end up as, but it's a bit of fun and something to do. Formerly subject to a C-on

null 2 Dec 12, 2021
ORE (OpenGL Rendering Engine) is a rendering engine developed for my college minor project assessment.

ORE (OPENGL RENDERING ENGINE) What is ORE? ORE(OpenGL Rendering Engine) is a rendering engine with great and easy to use UI that allows the user to lo

HARSHIT BARGUJAR 4 Dec 20, 2021
A legacy OpenGL simulator for OpenGL 4.4, written in C++.

the-ancient-tri A legacy OpenGL simulator for OpenGL 4.4, written in C++. Why? My Uni forces us to use legacy OpenGL (eww!), and I didn't want to lear

Mohammad Issawi 4 Feb 10, 2022
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

bgfx - Cross-platform rendering library GitHub Discussions Discord Chat What is it? Cross-platform, graphics API agnostic, "Bring Your Own Engine/Fram

Бранимир Караџић 11.8k Jul 2, 2022
2D Vector Graphics Engine Powered by a JIT Compiler

Blend2D 2D Vector Graphics Powered by a JIT Compiler. Official Home Page (blend2d.com) Official Repository (blend2d/blend2d) Public Chat Channel Zlib

Blend2D 1.1k Jun 25, 2022
Dear PyGui 3D Engine (early development) and Graphics API demos.

Marvel This repo is the working location of the eventual Dear PyGui 3D Engine. It also contains several single file examples of creating a triangle wi

Jonathan Hoffstadt 79 Jun 29, 2022
Orbit is a multiplatform-focus graphical engine build on top of OpenGl, ImGui

Orbit Engine Orbit is a multiplatform-focus graphical engine build on top of OpenGl, ImGui and more... The development of the engine is documented via

Madsycode 11 Jul 3, 2021
C++/openGL/Vulkan 3D engine

DeusEx Machina engine C++/GL/Vulkan 3D graphic engine First commit, hello world! :D Reddit post about why I started with skeletal animation system and

Brais 41 May 19, 2022
Software ray tracer written from scratch in C that can run on CPU or GPU with emphasis on ease of use and trivial setup

A minimalist and platform-agnostic interactive/real-time raytracer. Strong emphasis on simplicity, ease of use and almost no setup to get started with

Arnon Marcus 44 May 18, 2022