Older Examples:
ShaderLib Alpha v1.3
Alpha v1.3 (May 26, 2014)
- Blinn-Phong lighting added to Lighting Engine for cases where a sprite uses a normal map (this feature is off by default and is intended for TC mods and a possible future where more sprites have normal maps)
- Added "enableNormal", "specularIntensity", "specularHardness", and "lightDepth" options to settings.json
- Rare NVIDIA fullscreen "ghosting" issue resolved
- Light data documentation added (in the data/lights folder)
- Custom material maps supported (to use, link a texture to the ship/weapon by adding a key to "graphics" in data/config/settings.json; see example in ShaderLib)
- Custom normal maps supported (to use, link a texture to the ship/weapon by adding a key to "graphics" in data/config/settings.json; see example in ShaderLib)
- Example normal and material maps added for Conquest, Onslaught, and Paragon (the normal maps were machine-generated)
This update adds support for
Material Maps and
Normal Maps for ship and weapon sprites.
Material Map: This texture determines the reflectivity of the sprite. Internally, the lighting engine uses a minimum function (i.e. reflectivity = the darker of the pixel on screen and the corresponding pixel on the material map), so there are limitations on what you can do with a material map. In general, you want to begin with the original ship sprite and then
darken areas that should not reflect as much light. You can also darken individual color channels to allow interesting effects like having reflected shines being a different color than the hull. Also, the material map influences specularity if you are using normal maps; a brighter material will have a brighter shine. Remember that the material map must have an
alpha channel that matches the original sprite's alpha channel. To link a material map to a ship/weapon, add a key under the "shipMaterial" or "weaponMaterial" category in the "graphics" section of data/config/settings.json. The key name must match the id of the ship/weapon you are adding the material map for, appended with "_hardpoint" or "_turret". Individual frames for animated weapons should be named as such: "weaponId_turret0", "weaponId_turret1", "weaponId_turret2", etc. See the example in ShaderLib. If a sprite lacks a material map, the default is the original sprite (i.e. identical to previous lighting versions).
Normal Map: This texture is difficult to make and is
NOT RECOMMENDED FOR MOST MODS. The effect gained by using normal maps is subtle and is typically a very large amount of work for a small amount of gain. There are many tutorials for making normal maps elsewhere on the Internet, if you are interested in making them for vanilla sprites or your own ships. Remember that the normal map must have an
alpha channel that matches the original sprite's alpha channel. To link a normal map to a ship/weapon, add a key under the "shipNormal" or "weaponNormal" category in the "graphics" section of data/config/settings.json. The key name must match the id of the ship/weapon you are adding the normal map for, appended with "_hardpoint" or "_turret". Individual frames for animated weapons should be named as such: "weaponId_turret0", "weaponId_turret1", "weaponId_turret2", etc. See the example in ShaderLib. If a sprite lacks a normal map, the lighting engine will default to using the old lighting model for that sprite rather than the new Blinn-Phong model.
Normal maps are NOT RECOMMENDED. They are intended for total conversions and special occasions. Make normal maps AT YOUR OWN RISK!Normal maps are very time-consuming to make and they should absolutely
NOT become the norm for Starsector mods. ShaderLib is meant to enhance the user experience, not force modders to do significantly more work. As such, normal maps are disabled by default and must be manually enabled in ShaderLib's settings.json.