Read Me

by Alex Young

Description

A simple Lightwave object file reader.

This library provides functions for reading Lightwave object files (.lwo), and converting them to either a Yaml (www.yaml.org) or Xaml (msdn.microsoft.com/windowsvista/about/) representation.

Specifically, it generates a Xaml ResourceDictionary file with the following contents:

- A Model3DGroup for each Lightwave object layer.  Child layers are 
  included as StaticResources which point to Model3DGroups.
- A GeometryModel3D tag within each Model3DGroup for each surface.  The 
  Geometry attribute is a StaticResource that points to a MeshGeometry3D,
  and the Material attribute is a StaticResource that points to a
  MaterialGroup.[1]
- A Model3DGroup.Transform tag to shift the contained geometry to the 
  pivot point of the Lightwave layer.  This allows child hierarchies to be 
  transported from Lightwave through to Xaml.

Currently only colour textures are supported, and it’s an either/or situation: either you have a single image texture, or a single colour texture. This is planned to change imminently.

1

Lightwave supports surfaces per polygon. Xaml supports materialgroups per GeometryModel3D. Splitting the Lightwave geometry along surface boundaries is the simplest way to emulate the former with the latter.

Documentation

Examples

Simple:

$ ruby lw2xaml.rb MyLightwaveObject > MyLightwaveObject.xaml

See the test/ directory of this project for more examples of code using the internals.

Questions and/or Comments

Feel free to email Alex Young with any questions.