Skip to content

AlphaPixel/osgSlug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

osgSlug

osgSlug is a frontend for the slughorn library, simplifying the usage of the recent OSS release of the Slug technique by Eric Lengyel in OpenSceneGraph.

Overview

This project is currently a rapid testing frontend, visualizer, and "proof-of-concept" demo for slughorn (where most of the critical, generic C++ code lives). As of mid-April, 2026, both projects are currently under very active development. Check back regularly to follow our progress, as we have some really great ideas moving forward!

Examples

Demos

Preview Description
Emoji glyph demo Emoji glyphs

Single-codepoint emoji rendered through osgSlug. This demo uses visually distinct glyphs such as octopus, scorpion, peacock, and T-Rex to exercise different silhouette shapes.
Animated glyph effects Animated glyph effects

Shader-driven animation applied to Slug-rendered glyph geometry.
Animated logo Animated logo

osgSlug logo/demo asset rendered through the vector pipeline.
Morphing shapes Morphing shapes

Demonstrates animated vector-style transitions using osgSlug-rendered geometry.
2D projection demo 2D projection

Orthographic-style 2D placement/rendering of Slug shapes in an OpenSceneGraph scene.
3D projection demo 3D projection

Slug-rendered geometry placed into a 3D OpenSceneGraph scene.
Shapes and composite shapes Shapes and composite shapes

Basic shapes and layered composite shapes rendered through the osgSlug pipeline.
3D sphere demo 3D sphere

Slug-rendered content mapped or positioned in a 3D scene context.
SVG import demo SVG import

Authored SVG assets imported and rendered through osgSlug.
Mixed text demo Mixed text

Mixed glyph/text rendering demo exercising different characters and layout cases.
Text rendering demo Text rendering

Slug-style text rendering running inside OpenSceneGraph.

TODO

Critical

  • Demonstrate drawing multiple layers on the SAME QUAD (instead of each having its OWN quad)
  • Use slug_t (instead of float) everywhere it's appropriate! Potentially even introduce using Vec3 = osg::Vec3f inside osgSlug namespace to further reinforce! IMPORTANT Also need to ensure things like sin/cos return slug_t, any usage of osg::DegreesToRadians, etc.
  • Improved osgSlug::{Font/Text} support
  • Add an example showing toggle/cycle layers

Soon

  • Create a reusable "screen grid" widget
  • Audio visualizer effect/demo
  • Progress meter demo
  • Convert to using better VertexAtribIPointer where appropriate (effectId and band{Tex,Max}{X,Y}.
  • Change slughorn_render.py to dump SVG for the save_curves_debug
  • Add CMake helpers for compiling in each backend
  • Slug "mip-mapping"! Starting with osgSlug, introduce the ability to "short-circuit" the Slug quad based on some "level of detail" rule; when the shape is some threshold of distance AWAY, revert to simple texture lookup approximations. NOTE: slughorn MIGHT be able to participate in this optmization as well ... somehow
  • Fix numBands auto-calculation and account for spatial curve distribution, not just count
  • pybind11 wrapper
  • Change composites to compositeShapes in serialization, etc
  • Change the autoMetrics defaul to true
  • Rename slughorn-ft2.hpp to slughorn-freetype.hpp
  • Enforce VERSION compatibility in backends
  • UDL types for slughorn::Key::from{String,Codepoing}, potentially as _ukey, _skey or similar?
  • Add additional per-vertex metadata (like which "quad corner" we are)
  • Improve osgSlug::Font to expose the additional font metrics exposed by slughorn-freetype.hpp(so that the Text object can do better layout)

Medium Term

  • Add gl_InstanceID quad creation
  • Add per-Layer profiling; will requiring profiling per-quad, if that's even possible?
  • Convert osgSlug::Atlas to be an osg::StateAttribute (or behave like one, at least)
  • Introduce slughorn-harfbuzz.hpp text API, using Harfbuzz to "shape" it properly. Note: it will necessarily NEED to be built on top of the FreeType2 backend (slughorn-freetype.hpp)!
  • Qt6 QPainterPath provides moveTo / lineTo / quadTo / cubicTo / closeSubpath via elementAt() iteration; maps cleanly to CurveDecomposer. Quadratics are native to Qt6 (unlike Cairo which works in cubics). QFont / QRawFont provide glyph outline extraction as a potential FreeType2 complement. QSvgRenderer provides SVG loading as a potential NanoSVG complement. Structure to match slughorn-cairo.hpp: decomposePath(QPainterPath, Atlas&).
  • Allow serial::writeJSON for ANY object (not JUST Atlas)
  • Helpers for the 9-slice method of a rounded rectangle
  • Atlas::createDefaultStateSet() member instead of free function in Drawable.hpp
  • Sync TEX_WIDTH / kLogBandTextureWidth; uniform or shader preamble injection
  • Premultiplied alpha
  • Proper depth testing and render order
  • Remove slug_color uniform remnant from shaders (color is pure vertex attribute now)
  • Simulate a fragment processing frame in Python and inspect the math
  • Tooling for "optimizing" Atlas::build
  • Generate tight carrier mesh from Slug coverage via sampling + contour extraction + triangulation (offline). Preserve em-space UVs.
  • Generate SDF/MSDF texture data with Python emulator

When Ready

  • Add an effectId/shapeId UDL and helper like slug_t/_cv/cv
  • Atlas::Key type conversion (uint32_t -> Codepoint | Name discriminated union)
  • Conic subdivision for Skia circular geometry (iter.conicWeight())
  • Minimal Skia args.gn build config (trim from 25GB)
  • Non-square band grids (bandMaxX != bandMaxY)
  • Layer::scale - evaluate for removal; currently only meaningful for FT2/text. All geometry backends leave it at 1.0. If osgSlug::Font / osgSlug::Text take full ownership of font-size-to-world scaling, Layer::scale becomes dead weight and computeQuad could take scale as a call-site parameter instead. Defer until text pipeline stabilizes.

Someday / Fun

  • Live numBands slider tool with real-time rebuild + heatmap feedback
  • VSG adapter (trivial now given slughorn separation)

About

Slug support for OpenSceneGraph via SlugHorn

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors