Skip to content

Generate an animated GIF of a rotating sphere using simple 3D rendering techniques in Go.

Notifications You must be signed in to change notification settings

bagasdisini/go-renderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sphere Rendering Animation

Ball

This repository contains Go code to generate an animated GIF of a rotating sphere rendered with simple 3D graphics techniques.

Features:

  • 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.

Instructions:

  1. Install Go: Make sure you have Go installed on your system. You can download it here.
  2. Clone the Repository:
git clone https://github.com/bagasdisini/go-renderer.git
  1. Navigate to the Directory:
cd go-renderer
  1. Run the Code:
go run main.go
  1. Output: The animated GIF named sphere.gif will be generated in the same directory.

Customization:

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!

Technologies:

  • Go

Enjoy rendering your own animated spheres! 🌐✨

About

Generate an animated GIF of a rotating sphere using simple 3D rendering techniques in Go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages