Skip to content

A simple 3D graphics engine designed to serve as a tool for proof-of-concept algorithms

Notifications You must be signed in to change notification settings

robotaro/simple_3d_graphics_engine

Repository files navigation

Simple 3D Graphics Engine

A simple 3D graphics engine designed to serve as a tool for proof-of-concept algorithms

main_printscreen.PNG

Documentation will be sparse and updated when major milestones are reached.

Important Notes

  • Events
    • DO NOT modify components main data, ONLY state data
      • State data is akin to boolean and intergers
    • Cannot be stacked
    • work immediately across systems
  • Actions:
    • DO modify components. All data, including state data
    • Only happens during update
    • May be immediate or over time
    • Can be queued up by systems

https://github.com/ubuntunux/PyEngine3D

High Performance Computing Sources

Gizmo design ideas

https://projects.blender.org/blender/blender/issues/54661

Gizmo sources

Python 3D graphics sources

Camera math and depth conversion

https://stackoverflow.com/questions/7777913/how-to-render-depth-linearly-in-modern-opengl-with-gl-fragcoord-z-in-fragment-sh

How to count lines-of-code

https://codetabs.com/count-loc/count-loc-online.html

2D rendering to consider

Useful Sources

Insights on current engine inner workings

  • WHen node's translation/rotation/scale is changed via the setter, it sets the translation to None, and if None when requested via a getter, it recalculates it just in time. This is a flexible solution, but not a very efficient one.

Shaders to study

https://shadered.org/view?s=0xMVU6DEAe

Bit of Offline brainstorming

  • Scenes need to be introduced to separate groups of 3d Elements.
    • 3D cameras in a scene render all objects in that 3D scene. Same for 2D cameras
    • Render 2D scenes on top of 3D scenes?d

ModernGL tips:

  • Valid formats for VBO: ['f', 'f1', 'f2', 'f4', 'f8', 'u', 'u1', 'u2', 'u4', 'i', 'i1', 'i2', 'i4', 'nf', 'nf1', 'nf2', 'nf4', 'nu', 'nu1', 'nu2', 'nu4', 'ni', 'ni1', 'ni2', 'ni4']

Optimisation TODOs:

  • Scale should notbe applicable to orthographic projection!
  • If a component/system does not handle any graphics, make it 100% Numba-complient
  • Reduce number of uniform variable access. Maybe Uniform Array Object?
  • Separate meshes by layer in list/array so we don't have to go over all objects. Alternatively, consider multi-layed meshes

Numba Tips

Jitclass caching

numba/numba#6522 numba/numba#4830

Linux installation

If you are getting this error when you try creating a context (most likely from moderngl.create_context()):

Exception: (detect) glXGetCurrentContext: cannot detect OpenGL context

Do the following:

  • List all the vailable drivers
ubuntu-drivers devices

Pick the latest one that is compatible an run:

sudo apt install nvidia-driver-name

Then Reboot

sudo reboot

Then update the system

sudo apt update
sudo apt upgrade

Install the mesa drivers

sudo apt install mesa-utils

And reboot again

sudo reboot
---
title: Animal example
---
classDiagram
    note "From Duck till Zebra"
    Animal <|-- Duck
    note for Duck "can fly\ncan swim\ncan dive\ncan help in debugging"
    Animal <|-- Fish
    Animal <|-- Zebra

    Scene : render()

    Entity : +int age
    Animal : +String gender
    Animal: +render()
    Animal: +mate()

    class Duck{
        +String beakColor
        +swim()
        +quack()
    }
    class Fish{
        -int sizeInFeet
        -canEat()
    }
    class Zebra{
        +bool is_wild
        +run()
    }
Loading

About

A simple 3D graphics engine designed to serve as a tool for proof-of-concept algorithms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published