No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-05-09 01:04:02 -03:00
assets Add gif to readme 2026-04-27 20:39:30 -03:00
config restore main menu merge 2026-05-08 04:33:51 -03:00
engine restore main menu merge 2026-05-08 04:33:51 -03:00
saves restore main menu merge 2026-05-08 04:33:51 -03:00
.gitignore Initial commit 2026-04-16 01:08:09 -03:00
ARCHITECTURE.md update documentation 2026-05-09 01:04:02 -03:00
CLAUDE.md update documentation 2026-05-09 01:04:02 -03:00
go.mod sound system, 3d sound and background, entity sound 2026-04-21 04:00:52 -03:00
go.sum sound system, 3d sound and background, entity sound 2026-04-21 04:00:52 -03:00
main.go restore main menu merge 2026-05-08 04:33:51 -03:00
README.md Update README.md 2026-04-27 20:44:44 -03:00

Attalo Engine

A real-time 3D rendering engine written in Go, built on OpenGL 4.1 Core + GLFW.


Example Example 2

Features

Rendering

  • PBR shading — Cook-Torrance BRDF with roughness, metallic, and ambient occlusion
  • Image-Based Lighting (IBL) — full pipeline: equirectangular HDR → cubemap → irradiance map → GGX specular pre-filter → BRDF LUT
  • HDR skybox — tone-mapped equirectangular sky with a procedural gradient + star field fallback
  • Shadow mapping — PCF soft shadows via a 4096×4096 depth map with slope-scale bias
  • Water — reflection/refraction FBOs, configurable color, wind direction, and clarity
  • Particle system — GPU-driven emitters (rain, snow, custom effects)
  • MSAA — 4× multisample anti-aliasing

World & Terrain

  • Chunked streaming terrain — Perlin-noise height, dynamically generated per-chunk meshes as the camera moves
  • Splatmap blending — 5 material types (Grass, Dirt, Road, Sand, Snow) painted per vertex
  • Live terrain editing — real-time sculpting (raise/lower) and texture painting via the debug UI
  • Path tool — click-to-place waypoints that stamp road geometry onto the terrain
  • Collision world — AABB boxes, ramps (X and Z axis), and a configurable floor plane

Vehicles & Characters

  • Car — Ackermann steering model with throttle, brake, and grip
  • Boat — buoyancy and water locomotion
  • Airplane — pitch/roll/throttle flight model
  • Helicopter — lateral strafe, yaw, and altitude control
  • Motorcycle / Bicycle — two-wheel variants
  • Human — walk, run, jump, dance, and swim (surface + dive)
  • Vehicle entry/exit — animated door approach and seat-snap sequence
  • Skeletal animation with GLTF skin data; per-vehicle animation config

Asset Loading

  • GLTF 2.0 — multi-mesh models, per-mesh PBR materials, embedded textures, alpha modes (opaque / mask / blend), skeletal animations
  • OBJ — legacy .obj model support

Audio

  • OpenAL via cgo — spatial 3D audio, static clips and streaming music
  • OGG Vorbis and WAV decoding

Debug UI

  • In-window ImGui inspector — entity/camera state, terrain editing tools, weather presets, hitbox visualisation

Weather System

8 built-in presets with smooth interpolation: Clear, Overcast, Foggy, Drizzle, Rain, Storm, Snow, Sandstorm

Each preset controls cloud cover, fog density/color, rain/snow intensity, and wind strength.


Requirements

  • Go 1.21+
  • A GPU and driver supporting OpenGL 4.1 Core Profile
  • GLFW system libraries (provided automatically via the Go module on most platforms)
  • OpenAL runtime library

Getting Started

git clone <repo-url>
cd AttaloNew
go run .

Place assets under assets/ (see Assets below). The engine falls back gracefully if the HDR sky or scene files are missing.


Controls

Camera / Movement

Key Action
W A S D Move camera (free-fly) or drive active vehicle
Mouse Look around
Space Move camera up / jump (human) / climb (helicopter)
Left Ctrl Move camera down / descend (helicopter)
Q / E Pitch elevator (airplane) / yaw (helicopter)
Scroll wheel Zoom (adjust FOV)
P Toggle first-person / third-person camera

Interaction

Key Action
E Enter nearest vehicle / exit current vehicle (human)
G Grab / move selected object
Space Jump (human on ground)
C Toggle dive mode (human in water)
G Dance (human)

Terrain Editing

Key Action
M Toggle paint mode (click terrain to paint material)
N Toggle sculpt mode (left-click raise, right-click lower)

Misc

Key Action
` Toggle debug UI
Esc Release mouse cursor / clear selection / quit

Project Structure

AttaloNew/
├── main.go                  # Scene setup and engine entry point
├── config/
│   └── scene.json           # Scene configuration
├── engine/
│   ├── engine.go            # Core loop, draw pipeline, input handling
│   ├── scene.go             # Scene graph: objects, entities, vehicles, lights
│   ├── scene_config.go      # Scene config loading
│   ├── weather.go           # Weather presets and smooth interpolation
│   ├── debug.go             # ImGui scene inspector
│   ├── imgui_platform.go    # GLFW input routing for ImGui
│   ├── imgui_renderer.go    # OpenGL ImGui draw-data renderer
│   ├── loading.go           # Asset loading helpers
│   ├── render/
│   │   ├── glsl_pbr.go      # PBR vertex + fragment shaders
│   │   ├── glsl_shadow.go   # Shadow depth shaders
│   │   ├── glsl_terrain.go  # Terrain splatmap shaders
│   │   ├── glsl_water.go    # Water shaders
│   │   ├── glsl_particle.go # Particle shaders
│   │   ├── shader.go        # Shader compilation + uniform cache
│   │   ├── texture.go       # Texture loading (PNG, JPEG)
│   │   ├── hdr.go           # HDR equirectangular texture loading
│   │   ├── ibl.go           # IBL map generation pipeline
│   │   ├── skybox.go        # Skybox rendering
│   │   ├── water.go         # Water FBO + reflection/refraction pass
│   │   ├── water_volume.go  # Underwater volume rendering
│   │   ├── particle_renderer.go
│   │   ├── terrain_shader.go
│   │   └── wireframe.go     # Hitbox wireframe overlay
│   ├── world/
│   │   ├── entity.go        # Base renderable: transform + meshes + AABB
│   │   ├── object.go        # Static scene object
│   │   ├── vehicle.go       # Shared vehicle physics base
│   │   ├── car.go
│   │   ├── boat.go
│   │   ├── airplane.go
│   │   ├── helicopter.go
│   │   ├── motorcycle.go
│   │   ├── bicycle.go
│   │   ├── human.go         # Character: walk/run/jump/swim/dance
│   │   ├── camera.go        # First-person and third-person cameras
│   │   ├── light.go         # Light types and Material definition
│   │   ├── mesh.go          # GPU mesh (VAO/VBO/EBO)
│   │   ├── skinned_mesh.go  # Skeletal mesh with bone transforms
│   │   ├── animated_model.go
│   │   ├── animation.go     # GLTF animation samplers and channels
│   │   ├── particle.go      # Particle emitter
│   │   ├── collision.go     # Hitbox, ramp, collision world
│   │   └── culling.go       # AABB + frustum culling
│   ├── terrain/
│   │   ├── terrain.go       # Chunked terrain manager
│   │   ├── splatmap.go      # Splatmap: per-vertex material weights
│   │   ├── materials.go     # Material definitions
│   │   ├── noise.go         # Perlin noise height generation
│   │   └── path.go          # Path/road tool
│   ├── loader/
│   │   ├── gltf.go          # GLTF 2.0 static model loader
│   │   ├── gltf_animated.go # GLTF 2.0 skeletal model loader
│   │   └── obj.go           # OBJ loader
│   └── audio/
│       ├── audio.go         # OpenAL device/context management
│       ├── source.go        # Static audio source
│       ├── stream.go        # Streaming audio source
│       ├── loader.go        # OGG Vorbis / WAV decoding
│       └── al.go            # OpenAL cgo bindings
└── assets/                  # Models, textures, HDR skies (not tracked in git)

Assets

The assets/ directory is excluded from version control. At runtime the engine looks for:

Path Description
assets/Skyboxes/*.hdr Equirectangular HDR environment map
GLTF models, OBJ files, textures Referenced from main.go or config/scene.json

Missing assets degrade gracefully — the engine falls back to a gradient skybox and built-in geometry.


Dependencies

Module Purpose
github.com/go-gl/gl OpenGL 4.1 Core bindings
github.com/go-gl/glfw/v3.3/glfw Window creation and input
github.com/go-gl/mathgl Vector/matrix math (mgl32)
github.com/qmuntal/gltf GLTF 2.0 parsing
github.com/inkyblackness/imgui-go/v4 ImGui bindings
github.com/jfreymuth/oggvorbis OGG Vorbis decoding
golang.org/x/image HDR / image decoding support

License

See assets/license.txt for third-party asset attributions.