gdx-psx
gdx-psx its a library for LibGDX designed to assist you in simulation of PlayStation 1 graphics with few simple steps!
If you have questions or suggestions for this project, or you want to just chat about it - welcome to our discord.
Features:
- Vertex Jitter(Inacuraccy)
- Screen dithering
- Color depth change
- Texture shrink(compression)
- Resolution downscaling
Install
- Add JitPack repository in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the psx-gdx dependency
dependencies {
...
implementation 'com.github.fxgaming:gdx-psx:0.1.1a'
}
Quick start
gdx-psx have a lot of configurable parameters, recommended to check the demo before starting work with library!
Textures (Texture shrinking)
Library provides tool that helping you process textures and and downgrade their quality!
Fast texture processing:
TextureTransformer.shrinkTexture(Pixmap, ResizeType, textureSizeFactor, colorDepthFactor);
or with recommended parameters:
TextureTransformer.shrinkTexture(pixmap, ResizeType.EQUAL, 128f, 4f);
Instead of using Pixmap
you can use FileHandle
with your texture's path.
If you need to process bigger amount of textures with specified parameters:
TextureTransformer transformer = new TextureTransformer(); //using recommended parameters by default
transformer.setResizeType(ResizeType.ACCORDING_TO_HEIGHT);
transformer.setColorDepthFactor(8f);
//...
Texture newTexture = transformer.shrinkTexture(fileHandle);
3D effects (Vertex Jitter)
Library can provide Vertex Jitter effect to your models (via ModelBatch
)
//You can provide your own shaders, but using libgdx's default shader by default.
ShaderTransformer transformer = new ShaderTransformer();
transformer.setResolution(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
transformer.setFactor(4f); //Jitter factor
//You can provide Config for ShaderProvider if needed
ModelBatch myModelBatch = new ModelBatch(transformer.createShaderProvider());
Library also supports gdx-gltf by mgsx To use ShaderTransformer
with PBRShaderProvider
use PBRShaderTransformer
.
Post-processing (Downscaling, Color depth, Screen dithering)
Also library provides few things to work with post-processing!
- Create and customize post processing tool
PSXPostProcessing postProcessing = new PSXPostProcessing(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
postProcessing.setDownscalingIntensity(2f);
postProcessing.setColorDepth(64, 64, 64);
postProcessing.setDitheringMatrix(DitherMatrix.Dither4x4);
postProcessing.setFlagState(FlagType.DITHERING, true);
- Put this in the render loop
postProcessing.capture();
//rendering everything
postProcessing.endCapture();
postProcessing.drawImage();