3D-engine-from-scraph--pygame

3D Engine from scratch with python using pygame.


Package Requirement

         PYGAME -> pip install pygame
         COLORSYS -> pip install colorsys

Bugs (unsolved issues)

- The z sorting of triangles still has some noticeable issues
- still need some optimization to run faster ( maybe using numpy matrices can help a little bit)
- issues with translate matrix , gonna fix it later still trying a couple of things

Support .obj files although the zsorting isn't working properly

121646510-06faf980-cab3-11eb-9edf-b26271163645


Directional Light

          light = Light(position)
          # to disable the light in the scene you can set the light = None
           light = None

121668156-a5de2080-cac8-11eb-9efa-9d5e8bf80428


Controls

          might work on a much better controls later but for now to move around the scene you can use
          'WASD' and "Arrows"
          The controls are weird , i'm gonna try to improve them

parameters

122714091-652e9600-d284-11eb-9349-d694e6f2b49a


Display normals:

          ShowNormals = True
          # you can set the normal lines length in the world.py file

121646570-1712d900-cab3-11eb-8ae0-5a640291659b


Camera clipping

    it's still has a couple of issues when it comes to the boundary clipping , since it's only clip the faces
    that are in front of the camera.

121647190-bfc13880-cab3-11eb-8ee7-c0ee61f47849


Wireframe Mode

          wireframe = True

121646751-41649680-cab3-11eb-8a56-8ee20a5c08ab


Display Point Vertices

          vertices = True

121646975-7ec92400-cab3-11eb-8d73-f5eebe130b62


Display Axis

          showAxis = True
          red-> x axis
          green-> y axis
          blue-> z axis

122591036-000a5300-d080-11eb-82dd-8c29d3842702


121646963-7cff6080-cab3-11eb-9341-cb007f568611


utah teapot

122714245-a0c96000-d284-11eb-8da7-202bff79e0bc

GitHub

https://github.com/Josephbakulikira/3D-engine-from-scraph--pygame