This repository contains Go code to generate an animated GIF of a rotating sphere rendered with simple 3D graphics techniques.
- Sphere Generation: The code generates a sphere by approximating it with triangles. The sphere can be customized by adjusting the number of latitudes and longitudes.
- 3D Rendering: Utilizes simple 3D rendering techniques including perspective projection, shading based on the angle between the normal vector and the view vector, and z-buffering.
- Animation: Creates an animated GIF of the rotating sphere.
- Install Go: Make sure you have Go installed on your system. You can download it here.
- Clone the Repository:
git clone https://github.com/bagasdisini/go-renderer.git
- Navigate to the Directory:
cd go-renderer
- Run the Code:
go run main.go
- Output: The animated GIF named sphere.gif will be generated in the same directory.
You can customize the sphere by adjusting the parameters in the main.go file:
- latitudes and longitudes: Control the smoothness of the sphere by changing the number of latitudes and longitudes.
- width and height: Set the dimensions of the output GIF.
- Colors: You can adjust the colors of the sphere segments by modifying the color.RGBA values in the code.
Feel free to experiment with the parameters to create different variations of the sphere animation!
- Go
Enjoy rendering your own animated spheres! 🌐✨