Basic topics from Computer Graphics
- Geometry description.
- Displaying the model as polygons. The Algorithm Bresenham.
- Animation creation, affine transformations.
- Bezier curves.
- Bezier clock.
- Rendering 3D model. OpenGL.
pip install -U -r requirements.txt
Obj file - Utah Teapot model:
- The list of vertices - "v" market
- Facets - "f" market
The program finds: number of vertices and faces, max and min values of (x, y, z) and the surface area.
python main.py -p source/teapot.obj
Drawing of the teapot using the algorithm Bresenham.
python main.py -p source/teapot.obj -s 1024 1024 -b 255 255 255 -c 0 0 255 --scale 145 --save True
Create rotation animations, zoom, and color changes. Affine transformation.
Download ffmpeg.exe to create gif or mp4 animations. On the developer's website.
wget https://github.com/Vlad15lav/Computer-Graphics/releases/download/animation/ffmpeg.exe -O source/ffmpeg.exe
python main.py -f source/ffmpeg.exe -p source/teapot.obj -b 255 255 255 --frames 100 --fps 24 --interval 30
Create an animation of changing digits (0-9) based on Bezier curves.
wget https://github.com/Vlad15lav/Computer-Graphics/releases/download/animation/ffmpeg.exe -O source/ffmpeg.exe
python main.py -f source/ffmpeg.exe -p source/digits.json -t 200 -u 24 -b 0 0 0 -c 0 255 0 --fps 24 --interval 30
Creating the Bezier clock.
python main.py -p source/digits.json -b 0 0 0 -c 0 0 255 --bright 10 --zone 3
Rendering 3D model, OpenGL annotation.
Reference Coordinates in 3D graphics:
- Local space
- World space
- View space
- Clip space
- Screen space
Culling of invisible faces
- Back-face culling
- Z-buffer
Texture overlay
- Texture coordinates (vt)
- Interpolation of barycentric coordinates
Lighting with the Phong reflection model
- Ambient, Diffuse, Specular
- Lighting attenuation
Rendering
- Wire model
- Model with faces (gray color)
- Model with textures
- Model with lighting
- Model with textures + lighting
Rendering help:
python main.py --help
usage: Computer Graphics: 3D Rendering - Vlad15lav [-h] [-m MODEL]
[-s LOAD_SCENE]
[-b BGCOLOR [BGCOLOR ...]]
[--wire] [--gray]
[--texture] [--light]
[--save] [--save_scene]
optional arguments:
-h, --help show this help message and exit
-m MODEL, --model MODEL
path yml file
-s LOAD_SCENE, --load_scene LOAD_SCENE
path scene file
-b BGCOLOR [BGCOLOR ...], --bgcolor BGCOLOR [BGCOLOR ...]
background color
--wire wire model
--gray gray model by back-face culling
--texture texture enable
--light light enable
--save save img
--save_scene save scene
Rendering command:
python main.py -m african_head --texture --light --save
Rendering the african head
python main.py -m african_head --texture --light --save_scene
Add the model's eyes
python main.py -m african_eyes --load_scene african_head --texture --light --save --save_scene
Rotate african head model
python rotate_model.py -m african_head -f source/ffmpeg.exe --texture --light
python rotate_light.py -m african_head -f source/ffmpeg.exe --texture --light