New shader sample
Posted: Sat Mar 24, 2007 5:22 pm
Here’s a more complex shader example. It’s a version of Charlie’s Dream Team cobra, which uses all the data Oolite provides – laser heat, hull heat, engine power and time. It also implements per-pixel specular lighting, although with neither specular mapping nor smoothing this isn’t very obvious. If anyone feels like sending me a model with a specular map…
During the development of the shaders I discovered a problem: Oolite uses light 0 as the “showroom” light (for the demo and shipyard screens) and light 1 as the sun. There is no way in GLslang to know whether a light is enabled. My workaround for this is to ignore light 0 all the time, meaning the ship is illuminated from the direction of Lave’s sun relative to the station (!) during the demo screen.
![Image](http://wiki.alioth.net/images/a/ac/How-not-to-sun-skim.png)
The shaders work with Oolite 1.67 and 1.67.1 for OS X, although the hull temperature glow is disabled.
http://wiki.alioth.net/images/3/3a/Shady-cobra.oxp.zip
Limitation: the laser glow for all four lasers is based on the laser currently in use, i.e. the last in-ship camera you selected.
During the development of the shaders I discovered a problem: Oolite uses light 0 as the “showroom” light (for the demo and shipyard screens) and light 1 as the sun. There is no way in GLslang to know whether a light is enabled. My workaround for this is to ignore light 0 all the time, meaning the ship is illuminated from the direction of Lave’s sun relative to the station (!) during the demo screen.
![Image](http://wiki.alioth.net/images/a/ac/How-not-to-sun-skim.png)
The shaders work with Oolite 1.67 and 1.67.1 for OS X, although the hull temperature glow is disabled.
http://wiki.alioth.net/images/3/3a/Shady-cobra.oxp.zip
Limitation: the laser glow for all four lasers is based on the laser currently in use, i.e. the last in-ship camera you selected.