Open scene graph
OpenSceneGraph (OSG) is an open-source 3D graphics toolkit written in C++, built on top of OpenGL. It provides a high-level scene graph abstraction for building, rendering, and managing complex 3D scenes efficiently.
Common use case
| Area | Description |
|---|---|
| Simulation & Training | Flight simulators, military simulators, driving trainers |
| Scientific Visualization | Displaying large 3D datasets or terrains |
| Geospatial Systems | Used by osgEarth to render real-world maps and terrain |
| Virtual Reality (VR) | Basis for immersive 3D visualization |
| Game Engines / Tools | Lightweight base for building visualization or engine tools |
Install
Demo
Learn path create by chatGPT
Each week builds on the previous one. For each topic, Iβve included:
- π Concepts β what youβll learn
- π» Practice Goals β what youβll implement
- π Resources β where to learn more
ποΈ Week 1 β Setup & Core Concepts
Goal: Understand what OSG is, how it organizes scenes, and render your first object.
π Concepts - Scene graph structure (Nodes, Groups, Geodes) - Viewer and event loop (osgViewer::Viewer) - Geometry, Drawables, and simple shapes - Installing OSG and using CMake with VSCode
π» Practice
- β Install OSG (sudo apt install libopenscenegraph-dev)
- β Build your first program (sphere example)
- β Add multiple shapes (cube + sphere + cone)
- β Use osg::Group to attach nodes
- β Experiment with osgViewer::Viewer::run()
π Resources
OSG Wiki β Getting Started
ποΈ Week 2 β Transforms & Cameras
Goal: Learn to position objects and control the camera.
π Concepts
- Transform nodes (osg::MatrixTransform)
- Local vs global coordinates
- Orbit manipulator (osgGA::OrbitManipulator)
- Camera node (osg::Camera)
π» Practice
- β Move an object using MatrixTransform
- β Animate a rotation using osg::AnimationPathCallback
- β Add a camera and control with mouse (OrbitManipulator)
- β Play with setHomeViewpoint() to set default view
π Resources
Example: examples/osganimationpath
Camera Manipulators Doc
ποΈ Week 3 β Models, Materials & Lighting
Goal: Load real 3D models and make your scene look realistic.
π Concepts
- Loading models (osgDB::readNodeFile)
- Materials, textures, and lights
- StateSets (managing OpenGL state)
- Shaders overview
π» Practice
- β Load a .obj or .osgb model
- β Add texture using osg::Texture2D
- β Add a light source (osg::LightSource)
- β Adjust materials via osg::Material
π Resources
- Example: examples/osglight
- Example: examples/osgshadercomp
- Book: Beginnerβs Guide Ch. 4β6
ποΈ Week 4 β Interaction & Events
Goal: Make the scene respond to input.
π Concepts
- Event handlers (osgGA::GUIEventHandler)
- Keyboard and mouse input
- Picking (selecting objects with mouse)
- Callbacks (update, cull, draw)
π» Practice
- β Create a custom event handler for key presses
- β Implement simple object movement (e.g., arrow keys to move)
- β Add text overlay using osgText::Text
- β Implement a basic βobject pickerβ
π Resources
- Example: examples/osgevent
- osgGA::GUIEventHandler API
- OSG Callback System
ποΈ Week 5 β Performance & Advanced Features
Goal: Understand optimization and advanced scene graph concepts.
π Concepts
- Level of Detail (osg::LOD)
- Culling and bounding volumes
- Paging (loading large datasets dynamically)
- Multithreaded rendering overview
- Using shaders (GLSL in OSG)
π» Practice
- β Create LOD nodes for distant objects
- β Visualize bounding boxes (osg::BoundingBox)
- β Try replacing default shader with custom GLSL
- β Explore example: osgmultitexture
π Resources
- Example: examples/osglod
- OSG Rendering Optimization
ποΈ Week 6 β Integration & osgEarth
Goal: Combine what you learned and build a mini-project.
π Concepts
- osgEarth basics (MapNode, ImageLayer, ElevationLayer)
- Adding UI (Qt or ImGui optional)
- Combining 3D models + terrain
- Exporting and saving scenes
π» Practice
- β Install osgEarth (sudo apt install osgEarth)
- β Load OpenStreetMap base layer
- β Add a model (e.g., aircraft or robot) at specific lat/lon
- β Use OrbitManipulator to explore the map
- β Export scene with osgDB::writeNodeFile()
π Resources
- osgEarth GitHub: https://github.com/gwaldron/osgearth
π§© Optional Weeks (7+)
- Week 7 β integrate with Qt GUI (using osgQt::GLWidget)
- Week 8 β build plugin or viewer utility
- Week 9 β add VR support (OpenVR / Oculus)
- Week 10 β integrate with ROS 2 or simulation data (e.g., real sensor visualization)