WARNINGS
Certain Integrated GPUs have trouble with GraphicsLib shaders!
Use a discrete GPU or disable shaders if you have trouble.
Some GPUs and graphics drivers cannot run Combat Radar and GraphicsLib shaders at the same time (black screen!)
If you experience this problem, disable Combat Radar or disable shaders.
Antialiasing is (mostly) not supported when using shaders!
Use 100%/200%/300% scaling, use AA compatibility mode, or disable shaders.
What is this?GraphicsLib is a mod package containing numerous graphical improvements, including a variety of effects plugins, a dynamic lighting engine, and a screen-space distortion shader. This library can also be used by other modders to implement unique shaders and make use of the built-in lighting, distortion, and post-processing APIs.
Features- Dynamic Lighting
- Distortion Shader
- Post-Processing Shader
- Graphics Enhancement Plugins:
- Enhanced Ship Destruction
- Ship Damage Smoke
- Overload Arcs
- Officer Insignias
- Missile Self-Destrution
- Modding API
Screenshots How to UseFor players: Just download and enable the mod. You don't have to do anything else; it works right out of the box. If your computer can't handle GraphicsLib, follow the
Mod Troubleshooting Guide.
For modders: If you want to incorporate GraphicsLib into your mod, you should follow this setup procedure:
Spoiler
Use the following mod detection code in your ModPlugin class. If you want to make calls to GraphicsLib functions or use GraphicsLib objects, you must first check to see that hasGraphicsLib is true before calling/referencing them! Note that some scenarios may make this arrangement difficult, requiring GraphicsLib for resolving class links. Note that "shaderLib" is intentional here; the mod ID has remained the same to ensure backwards-compatibility.
public static boolean hasGraphicsLib;
@Override
public void onApplicationLoad() {
hasGraphicsLib = Global.getSettings().getModManager().isModEnabled("shaderLib");
if (hasGraphicsLib) {
ShaderLib.init();
LightData.readLightDataCSV("data/lights/your_light_data.csv");
TextureData.readTextureDataCSV("data/lights/your_texture_data.csv");
}
}
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. Remember that the material map must have an
alpha channel that matches the original sprite's alpha channel. For implementation, see the example in GraphicsLib. 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 properly, but the results can be well worth it. 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. However, if you want an easy way out, an adequate normal map can be generated automatically through Photoshop, Crazy Bump, or similar programs, which takes far less time than making a normal map from the ground up. Remember that the normal map must have an
alpha channel that matches the original sprite's alpha channel. For implementation, see the example in GraphicsLib. 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.
Surface Map: This texture is completely optional (even more so than the other two). Surface maps enhance the normal map of the object by influencing how the specularity looks. The red channel corresponds to luminosity and will cause the ship to appear to glow wherever the red channel is nonzero. The green channel determines the specular intensity of the object; a value of zero is totally matte while a high value will be very shiny. The blue channel determines specular hardness, so a value of zero is cartoonishly shiny while a high value is very glossy; a value of 0.2 (or 51 on the integer scale) corresponds to the default behavior. Remember that the surface map must have an
alpha channel that matches the original sprite's alpha channel. If a sprite lacks a surface map, the lighting engine will substitute red = 0, green = (derived from material map), blue = 0.2.
WarningsYou generally need a card made in 2008 or later to have a reasonable expectation of supporting GraphicsLib. Performance may vary, but a GTX 460 or better should be sufficient to run without any performance hit on the default settings, and with settings tweaks virtually any compatible card will work fine. Mobile and integrated chipset drivers are known to have problems with GraphicsLib.
If you are using an integrated graphics chipset, disable distortions and post-processing!Change LogVersion 1.9.0 (February 3, 2024):
- Updated for Starsector 0.97a
Version 1.8.0 (January 7, 2024):
- Updated for Starsector 0.96a RC10
- No more '!!!'
- Adjusted/fixed behavior of dead ships regarding surface maps
- Added 'optimizeNormals' option to the settings for slightly better performance in some situations
- API expansion for RippleDistortion and WaveDistortion
- A default white directional sun-light is now visible in non-campaign battles (simulator, missions)
- Various private variables in RippleDistortion, WaveDistortion, and StandardLight changed to protected
- Improved performance of ship chunks (vanilla tessellation issue solved via caching)
- Added "shaderlib_do_not_render" custom data key, which applies to anything that has custom data, to completely ignore that entity for lighting purposes (improves performance, especially for ships)
Version 1.7.0 (May 9, 2023):
- Updated for Starsector 0.96a
- Added new option in settings: "enableFullExplosionEffects"
* Disabled by default because the vanilla game handles this part now
- Added new spreadsheet: data/config/glib/no_shield_ripple.csv
* Prevents shield ripples from being generated by the listed projectiles
- Added support for fighter skin texture maps
* List them in the texture data the same way they're listed in settings.json
* e.g., "xyphos_LOW_TECH"
- Trigonometry fixes
- Proximity fuse "hit" lights now work properly
* GraphicsLib will replace the original ProximityExplosionEffect (if any) with a custom ProximityExplosionEffect
* This custom ProximityExplosionEffect first instantiates and calls the original one, then adds the appropriate lights
- Fixed serious issue where some proximity fuse weapons would prematurely disappear
- Updated the options in the Preset Options folder to include a Low VRAM Compatibility mode
* When using this preset, nearly all features requiring extra video memory are disabled
* Use this if you have weirdly low FPS and heavy stuttering during combat
Version 1.6.1 (January 5, 2022):
- Fixed arc attenuation for distortion effects
- Updated for Starsector 0.95.1a RC6
Version 1.6.0 (December 12, 2021):
- Updated for Starsector 0.95.1a
Version 1.5.1 (March 30, 2021):
- Made sun-generated lights less extreme when multiple stars are in system
- Insignia icons are scaled to the new range of officer levels
* Tier 1: Level 1-2 (freshly hired officers)
* Tier 2: Level 3-4
* Tier 3: Level 5-6 (max for trainable/mercenary/NPC officers)
* Tier 4: Level 7+ (max for procgen officers, NPC commanders, and AI or unique officers)
- Added "aaCompatMode" to GRAPHICS_OPTIONS.ini
* Prevents GraphicsLib from crashing out at the start if you have antialiasing enabled
* Disables the second pass of the post processing shader
* You'll have antialiased sharpness in the campaign and the combat interface, but the actual in-battle ships/weapons/effects will be as blurry as if you weren't using antialiasing
Version 1.5.0 (March 29, 2021):
- Updated for Starsector 0.95a
- Now works with screen scaling
* Mod-added custom shaders will almost certainly need modification to work with screen scaling
- DOES NOT WORK with antialiasing
* GraphicsLib will crash out with a message asking you to either disable shaders OR disable antialiasing
* This is not a temporary measure; going forward, GraphicsLib and antialiasing don't mix
* 4K monitor users should use 200% screen scaling (antialiasing off)
- 5K users should use 200% scaling and 4K resolution, fullscreen-upscaled to native monitor resolution (You won't lose that much quality)
* 1080p monitor users should use 100% screen scaling (antialiasing off)
* 1440p monitor users potentially have a tough choice
- 100% scaling will work if the monitor is large enough (or if you have glasses)
- Upscaling 1080p to fullscreen native resolution might look passable (depending on your monitor and video driver) but you'll definitely lose some quality
- Otherwise, consider disabling shaders if you can't read the text
- I personally use a 1440p monitor and can play fine at 100% scaling, but your mileage may vary
- Added shader maps for new vanilla content
- Added lights definitions for new vanilla content
- Ship explosions no longer create cinematic anamorphic flares
Version 1.4.5 (March 10, 2021):
- Slot cover normal map fix
- Fixed compile error with one of the normal map shaders on certain Radeon drivers
Version 1.4.4 (December 25, 2020):
- Possible surface map transparency fix?
- Fixed version file HTTPS redirect
- Overload EMP colors now match the default overlay (or any special overload colors that might be scripted in)
* Added "useVentColorsForOverloadArcs" option for old behavior
Version 1.4.3 (September 28, 2020):
- Fixed the Benchmark progress indicator
- Fixed normal map scaling when flipped
- Migrated version file to custom host (sigh)
Version 1.4.2 (July 8, 2020):
- Added global function suppressEffects() to ShipDestructionEffects to suppress spawning effects for a particular ship
- Migrated version file to BitBucket
Version 1.4.1 (September 8, 2019):
- Render order fix for layered modules
Version 1.4.0 (May 17, 2019):
- Updated for Starsector 0.9.1a
- Added shader maps for new Starsector 0.9.1a sprites
- Support for alternative ship textures
- Minor fix for light fade-in logic
- Minor fix for automatic distortion fade-out logic
- Render order update
Version 1.3.1 (February 15, 2019):
- Fixed lighting for plasma burn system
- Rendering order fix for lighting
Version 1.3.0 (November 17, 2018):
- Added a bunch of shader maps for new/updated Starsector 0.9a sprites
- Updated lighting settings where applicable for new/updated Starsector 0.9a content
- Fixed rendering order for station modules
- Added lighting support for mine explosions
- Works in Starsector 0.9a
Version 1.2.1 (June 10, 2017)
- Improved various effects for certain edge cases with sprites that are significantly smaller than the collision radius
Version 1.2.0 (June 4, 2017)
- Now works on Starsector 0.8.1a
- Additional LazyLib check
- Fixed some misc. bugs that nobody noticed
- Tweaked ship destruction effects for ship pieces to avoid fx spam
- Updated even more sprites
Version 1.1.0 (April 23, 2017)
- Now works on Starsector 0.8a
- Supports lighting on destroyed ship pieces
- New maps for the new ships/weapons, and updated maps for a large number of existing ships/weapons
Version 1.0.4 (March 26, 2017)
- Adjusted ripple intensity for ship deaths
- Disable bloom automatically on Intel IGPs
Version 1.0.3 (January 8, 2017)
- Nvidia post processing bug is fixed
Version 1.0.2 (May 21, 2016)
- General compatibility update
Version 1.0.1 (April 22, 2016)
- Added sun/hyperspace lighting from SS+
Version 1.0.0 (April 15, 2016)
- Renamed GraphicsLib
- shaderSettings.json renamed to GRAPHICS_OPTIONS.ini
- Added graphical effects plugins previously in Starsector+
- Added data/config/no_self_destruct.csv in case you want your mod-added missiles to not explode automatically